Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp

Issue 2687023003: [LazyParseCSS] Add metrics for total # of rules at 0% and 100% usage (Closed)
Patch Set: rune review Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp
index c5ed81cc30a8bbd6fa11196056f1df49ca57964b..b61e716c9cb99fdd7622b7a4ba18b05d237daa24 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp
@@ -23,7 +23,9 @@ CSSLazyParsingState::CSSLazyParsingState(const CSSParserContext* context,
m_totalStyleRules(0),
m_styleRulesNeededForNextMilestone(0),
m_usage(UsageGe0),
- m_shouldUseCount(m_context->isUseCounterRecordingEnabled()) {
+ m_shouldUseCount(m_context->isUseCounterRecordingEnabled()) {}
+
+void CSSLazyParsingState::finishInitialParsing() {
recordUsageMetrics();
}
@@ -91,8 +93,13 @@ bool CSSLazyParsingState::shouldLazilyParseProperties(
void CSSLazyParsingState::recordUsageMetrics() {
DEFINE_STATIC_LOCAL(EnumerationHistogram, usageHistogram,
("Style.LazyUsage.Percent", UsageLastValue));
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, totalRulesHistogram,
+ ("Style.TotalLazyRules", 0, 100000, 50));
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, totalRulesFullUsageHistogram,
+ ("Style.TotalLazyRules.FullUsage", 0, 100000, 50));
switch (m_usage) {
case UsageGe0:
+ totalRulesHistogram.count(m_totalStyleRules);
m_styleRulesNeededForNextMilestone = m_totalStyleRules * .1;
break;
case UsageGt10:
@@ -111,6 +118,7 @@ void CSSLazyParsingState::recordUsageMetrics() {
m_styleRulesNeededForNextMilestone = m_totalStyleRules - 1;
break;
case UsageAll:
+ totalRulesFullUsageHistogram.count(m_totalStyleRules);
m_styleRulesNeededForNextMilestone = m_totalStyleRules;
break;
}

Powered by Google App Engine
This is Rietveld 408576698