Skip to content

Conversation

@cobalt-github-releaser-bot
Copy link
Collaborator

Refer to the original PR: #8845

Implement the collection of the private memory footprint metric.
This change leverages the Chromium memory_instrumentation service
to periodically request global memory dumps and record the total
private memory footprint as a UMA histogram. This provides crucial
data for monitoring memory usage in Cobalt. A new command-line
switch is added to allow configuration of the collection interval.

Note: Local testing was also done via python3 cobalt/tools/uma/pull_uma_histogram_set_via_cdp.py --no-manage-cobalt --output-file=uma_output.txt.

Test: out/android-x86_devel/bin/run_cobalt_unittests --gtest_filter="*CobaltMetricsServiceClientTest*"
Test: out/android-x86_devel/bin/run_cobalt_browsertests --gtest_filter="*CobaltMetricsBrowserTest*"

Bug: 479261728

…8845)

Implement the collection of the private memory footprint metric.
This change leverages the Chromium memory_instrumentation service
to periodically request global memory dumps and record the total
private memory footprint as a UMA histogram. This provides crucial
data for monitoring memory usage in Cobalt. A new command-line
switch is added to allow configuration of the collection interval.

Note: Local testing was also done via `python3
cobalt/tools/uma/pull_uma_histogram_set_via_cdp.py --no-manage-cobalt
--output-file=uma_output.txt`.

Test: `out/android-x86_devel/bin/run_cobalt_unittests
--gtest_filter="*CobaltMetricsServiceClientTest*"`
Test: `out/android-x86_devel/bin/run_cobalt_browsertests
--gtest_filter="*CobaltMetricsBrowserTest*"`

Bug: 479261728
(cherry picked from commit 52f2617)
@cobalt-github-releaser-bot
Copy link
Collaborator Author

MERGE CONFLICT CAT

Caution

There were merge conflicts while cherry picking! Check out cherry-pick-26.eap-8845 and fix the conflicts before proceeding. Check the log at https://github.com/youtube/cobalt/actions/runs/21886594466 for details.

@github-actions
Copy link

🤖 Gemini Suggested Commit Message


cobalt: Implement private memory footprint metric

Implement the collection of the private memory footprint metric. This
change leverages the Chromium memory_instrumentation service to
periodically request global memory dumps and record the total private
memory footprint as a UMA histogram. This provides crucial data for
monitoring memory usage in Cobalt. A new command-line switch allows
configuration of the collection interval.

Bug: 479261728

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

Copy link
Contributor

@Awallky Awallky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix merge conflicts

@Awallky Awallky self-requested a review February 11, 2026 19:54
@Awallky Awallky marked this pull request as ready for review February 11, 2026 19:55
@Awallky Awallky requested a review from a team as a code owner February 11, 2026 19:55
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to implement the collection of the private memory footprint metric by leveraging Chromium's memory instrumentation service to periodically gather and report memory usage. While the core memory metrics collection appears correct, a medium-severity Path Traversal vulnerability was identified in the pull_uma_histogram_set_via_cdp.py script due to unvalidated user-supplied filenames, which could allow arbitrary file reads. Additionally, two command-line switches in cobalt/browser/switches.h are unrelated to this PR's purpose and should be moved to a separate pull request.

Comment on lines 38 to 44
// Whether to request, download, and install uncompressed (rather than
// compressed) Evergreen binaries.
constexpr char kUseUncompressedUpdates[] = "use_uncompressed_updates";

// Uses the QA update server to test the changes to the configuration of the
// PROD update server.
constexpr char kUseQAUpdateServer[] = "use_qa_update_server";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These two switches, kUseUncompressedUpdates and kUseQAUpdateServer, appear to be unrelated to the memory metrics functionality being added in this pull request. To maintain clear and atomic commits, it's recommended to move these changes to a separate pull request that deals with update server configuration.

@Awallky
Copy link
Contributor

Awallky commented Feb 11, 2026

Tests look to be passing locally:

out/linux-x64x11_devel/cobalt_unittests --gtest_filter="*CobaltMetricsServiceClientTest*" --single-process-tests [current working directory … │
│                                                                                                                                                        │
│ [938679:/938679:INFO:cobalt_metrics_service_client.cc(160)] Starting refresh timer for: 60 seconds                                                     │
│ [       OK ] CobaltMetricsServiceClientTest.IdleTimerCallbackInvokesOnApplicationNotIdleInternal (0 ms)                                                │
│ [ RUN      ] CobaltMetricsServiceClientTest.IdleTimerIsRepeatingAndKeepsFiring                                                                         │
│ [938679:/938679:INFO:cobalt_metrics_service_client.cc(160)] Starting refresh timer for: 150 seconds                                                    │
│ [938679:/938679:INFO:cobalt_metrics_service_client.cc(160)] Starting refresh timer for: 40 seconds                                                     │
│ [       OK ] CobaltMetricsServiceClientTest.IdleTimerIsRepeatingAndKeepsFiring (0 ms)                                                                  │
│ [ RUN      ] CobaltMetricsServiceClientTest.StartIdleRefreshTimerStopsAndRestartsExistingTimer                                                         │
│ [938679:/938679:INFO:cobalt_metrics_service_client.cc(160)] Starting refresh timer for: 150 seconds                                                    │
│ [938679:/938679:INFO:cobalt_metrics_service_client.cc(160)] Starting refresh timer for: 300 seconds                                                    │
│ [       OK ] CobaltMetricsServiceClientTest.StartIdleRefreshTimerStopsAndRestartsExistingTimer (1 ms)                                                  │
│ [----------] 22 tests from CobaltMetricsServiceClientTest (128 ms total)                                                                               │
│                                                                                                                                                        │
│ [----------] Global test environment tear-down                                                                                                         │
│ [==========] 22 tests from 1 test suite ran. (128 ms total)                                                                                            │
│ [  PASSED  ] 22 tests.                         

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants