metrics: Enable font and glyph cache memory metrics in Cobalt#9127
Merged
Awallky merged 7 commits intoyoutube:mainfrom Feb 26, 2026
Merged
metrics: Enable font and glyph cache memory metrics in Cobalt#9127Awallky merged 7 commits intoyoutube:mainfrom
Awallky merged 7 commits intoyoutube:mainfrom
Conversation
Contributor
🤖 Gemini Suggested Commit Message💡 Pro Tips for a Better Commit Message:
|
Contributor
There was a problem hiding this comment.
Code Review
This pull request successfully enables font and glyph cache memory metrics, providing valuable insights into memory usage. The changes are well-structured, including the necessary initialization, metric collection logic, a new browser test, and documentation.
I've provided a few suggestions to improve the precision of the new metrics, enhance test coverage, and ensure the documentation is consistent with the implementation. Overall, this is a solid contribution.
1a49c38 to
5e4032d
Compare
62cc58f to
9a784b0
Compare
This change enables the reporting of font-related memory usage metrics to UMA, which were previously defined in the engine but not collected. - Initialize the memory instrumentation client in the Cobalt browser process to enable process-level allocator dumps. - Update CobaltMetricsServiceClient to explicitly extract and record Skia (sk_glyph_cache) and Blink (font_caches/shape_caches) allocator dumps. - Add new font cache metrics to the memory histograms allowlist. - Add a new browsertest (font_metrics_browsertest) to verify that the new histograms are correctly populated on a running device. - Add documentation for the identified font metrics in cobalt/docs/. These metrics provide visibility into the memory footprint of character rasterization and text shaping caches, aiding in identifying font-related memory regressions and optimizing resource usage. Bug: None
When requesting a SUMMARY_ONLY memory dump, providing an empty list of allocator names results in no Chrome-level allocator metrics being returned. Conversely, providing a non-empty list acts as a whitelist, omitting any allocators not in the list. Explicitly request 'malloc' along with the new font and glyph cache allocators to ensure comprehensive memory reporting remains intact. Verified with FontMetricsBrowserTest on Android.
- Optimize RecordMemoryMetrics by moving process_name constant outside the loop. - Improve precision of Skia and font cache reporting by switching from MB to KB. - Fix a fatal crash on Android during startup by ensuring idempotent and thread-safe memory instrumentation client registration. - Update documentation and add unit/browser test expectations to verify the new granular font memory histograms. Bug: None
16bd717 to
b55d2f8
Compare
johnxwork
approved these changes
Feb 26, 2026
cobalt-github-releaser-bot
pushed a commit
that referenced
this pull request
Feb 26, 2026
This change enables the reporting of font-related memory usage metrics to UMA, which were previously defined in the engine but not collected. - Initialize the memory instrumentation client in the Cobalt browser process to enable process-level allocator dumps. - Update CobaltMetricsServiceClient to explicitly extract and record Skia (sk_glyph_cache) and Blink (font_caches/shape_caches) allocator dumps. - Add new font cache metrics to the memory histograms allowlist. - Add a new browsertest (font_metrics_browsertest) to verify that the new histograms are correctly populated on a running device. - Add documentation for the identified font metrics in cobalt/docs/. These metrics provide visibility into the memory footprint of character rasterization and text shaping caches, aiding in identifying font-related memory regressions and optimizing resource usage. Bug: 483758673 (cherry picked from commit 9769f6a)
cobalt-github-releaser-bot
pushed a commit
that referenced
this pull request
Feb 26, 2026
This change enables the reporting of font-related memory usage metrics to UMA, which were previously defined in the engine but not collected. - Initialize the memory instrumentation client in the Cobalt browser process to enable process-level allocator dumps. - Update CobaltMetricsServiceClient to explicitly extract and record Skia (sk_glyph_cache) and Blink (font_caches/shape_caches) allocator dumps. - Add new font cache metrics to the memory histograms allowlist. - Add a new browsertest (font_metrics_browsertest) to verify that the new histograms are correctly populated on a running device. - Add documentation for the identified font metrics in cobalt/docs/. These metrics provide visibility into the memory footprint of character rasterization and text shaping caches, aiding in identifying font-related memory regressions and optimizing resource usage. Bug: 483758673 (cherry picked from commit 9769f6a)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change enables the reporting of font-related memory usage metrics to UMA, which were previously defined in the engine but not collected.
These metrics provide visibility into the memory footprint of character rasterization and text shaping caches, aiding in identifying font-related memory regressions and optimizing resource usage.
Bug: 483758673