Commit 9d13e639 authored by Eric Robinson's avatar Eric Robinson Committed by Commit Bot

Add aggregate metrics for cpu usage.

Adds total time spent in tasks by ad creatives on a page.
These metrics mirror the existing metrics that keep track
of the percentage of overall time that an ad creative consumes.

Bug: 960457
Change-Id: Ie49a22fc48bd74a9c3dfd326b3dcf74869ae7ef2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1599686Reviewed-by: default avatarJosh Karlin <jkarlin@chromium.org>
Reviewed-by: default avatarCharlie Harrison <csharrison@chromium.org>
Commit-Queue: Eric Robinson <ericrobinson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658734}
parent e44b691b
......@@ -570,29 +570,40 @@ void AdsPageLoadMetricsObserver::RecordHistogramsForCpuUsage(
FrameData::InteractiveStatus::kPreInteractive);
base::TimeDelta task_duration_post = ad_frame_data.GetInteractiveCpuUsage(
FrameData::InteractiveStatus::kPostInteractive);
base::TimeDelta task_duration_total =
task_duration_pre + task_duration_post;
if (total_duration.InMilliseconds() > 0) {
ADS_HISTOGRAM("Cpu.AdFrames.PerFrame.PercentUsage.Unactivated",
UMA_HISTOGRAM_PERCENTAGE, visibility,
GetCpuPercentage(task_duration_pre + task_duration_post,
total_duration));
GetCpuPercentage(task_duration_total, total_duration));
ADS_HISTOGRAM("Cpu.AdFrames.PerFrame.TotalUsage.Unactivated",
PAGE_LOAD_HISTOGRAM, visibility, task_duration_total);
}
if (pre_interactive_duration_.InMilliseconds() > 0) {
ADS_HISTOGRAM(
"Cpu.AdFrames.PerFrame.PercentUsage.Unactivated.PreInteractive",
UMA_HISTOGRAM_PERCENTAGE, visibility,
GetCpuPercentage(task_duration_pre, pre_interactive_duration_));
ADS_HISTOGRAM(
"Cpu.AdFrames.PerFrame.TotalUsage.Unactivated.PreInteractive",
PAGE_LOAD_HISTOGRAM, visibility, task_duration_pre);
}
if (post_interactive_duration.InMilliseconds() > 0) {
ADS_HISTOGRAM(
"Cpu.AdFrames.PerFrame.PercentUsage.Unactivated.PostInteractive",
UMA_HISTOGRAM_PERCENTAGE, visibility,
GetCpuPercentage(task_duration_post, post_interactive_duration));
ADS_HISTOGRAM(
"Cpu.AdFrames.PerFrame.TotalUsage.Unactivated.PostInteractive",
PAGE_LOAD_HISTOGRAM, visibility, task_duration_post);
}
} else {
base::TimeDelta task_duration_pre = ad_frame_data.GetActivationCpuUsage(
FrameData::UserActivationStatus::kNoActivation);
base::TimeDelta task_duration_post = ad_frame_data.GetActivationCpuUsage(
FrameData::UserActivationStatus::kReceivedActivation);
base::TimeDelta task_duration_total =
task_duration_pre + task_duration_post;
base::TimeDelta pre_activation_duration =
ad_frame_data.pre_activation_foreground_duration();
base::TimeDelta post_activation_duration =
......@@ -600,20 +611,27 @@ void AdsPageLoadMetricsObserver::RecordHistogramsForCpuUsage(
if (total_duration.InMilliseconds() > 0) {
ADS_HISTOGRAM("Cpu.AdFrames.PerFrame.PercentUsage.Activated",
UMA_HISTOGRAM_PERCENTAGE, visibility,
GetCpuPercentage(task_duration_pre + task_duration_post,
total_duration));
GetCpuPercentage(task_duration_total, total_duration));
ADS_HISTOGRAM("Cpu.AdFrames.PerFrame.TotalUsage.Activated",
PAGE_LOAD_HISTOGRAM, visibility, task_duration_total);
}
if (pre_activation_duration.InMilliseconds() > 0) {
ADS_HISTOGRAM(
"Cpu.AdFrames.PerFrame.PercentUsage.Activated.PreActivation",
UMA_HISTOGRAM_PERCENTAGE, visibility,
GetCpuPercentage(task_duration_pre, pre_activation_duration));
ADS_HISTOGRAM(
"Cpu.AdFrames.PerFrame.TotalUsage.Activated.PreActivation",
PAGE_LOAD_HISTOGRAM, visibility, task_duration_pre);
}
if (post_activation_duration.InMilliseconds() > 0) {
ADS_HISTOGRAM(
"Cpu.AdFrames.PerFrame.PercentUsage.Activated.PostActivation",
UMA_HISTOGRAM_PERCENTAGE, visibility,
GetCpuPercentage(task_duration_post, post_activation_duration));
ADS_HISTOGRAM(
"Cpu.AdFrames.PerFrame.TotalUsage.Activated.PostActivation",
PAGE_LOAD_HISTOGRAM, visibility, task_duration_post);
}
}
}
......@@ -634,23 +652,29 @@ void AdsPageLoadMetricsObserver::RecordHistogramsForCpuUsage(
base::TimeDelta task_duration_post =
aggregate_frame_data_->GetInteractiveCpuUsage(
FrameData::InteractiveStatus::kPostInteractive);
base::TimeDelta task_duration_total = task_duration_pre + task_duration_post;
if (total_duration.InMilliseconds() > 0) {
ADS_HISTOGRAM("Cpu.FullPage.PercentUsage", UMA_HISTOGRAM_PERCENTAGE,
visibility,
GetCpuPercentage(task_duration_pre + task_duration_post,
total_duration));
GetCpuPercentage(task_duration_total, total_duration));
ADS_HISTOGRAM("Cpu.FullPage.TotalUsage", PAGE_LOAD_HISTOGRAM, visibility,
task_duration_total);
}
if (pre_interactive_duration_.InMilliseconds() > 0) {
ADS_HISTOGRAM(
"Cpu.FullPage.PercentUsage.PreInteractive", UMA_HISTOGRAM_PERCENTAGE,
visibility,
GetCpuPercentage(task_duration_pre, pre_interactive_duration_));
ADS_HISTOGRAM("Cpu.FullPage.TotalUsage.PreInteractive", PAGE_LOAD_HISTOGRAM,
visibility, task_duration_pre);
}
if (post_interactive_duration.InMilliseconds() > 0) {
ADS_HISTOGRAM(
"Cpu.FullPage.PercentUsage.PostInteractive", UMA_HISTOGRAM_PERCENTAGE,
visibility,
GetCpuPercentage(task_duration_post, post_interactive_duration));
ADS_HISTOGRAM("Cpu.FullPage.TotalUsage.PostInteractive",
PAGE_LOAD_HISTOGRAM, visibility, task_duration_post);
}
}
......
......@@ -144188,10 +144188,16 @@ should be kept until we use this API. -->
<suffix name="PreActivation" label="Usage before user activation."/>
<affected-histogram
name="PageLoad.Clients.Ads.Cpu.AdFrames.PerFrame.PercentUsage.Activated"/>
<affected-histogram
name="PageLoad.Clients.Ads.Cpu.AdFrames.PerFrame.TotalUsage.Activated"/>
<affected-histogram
name="PageLoad.Clients.Ads.NonVisible.Cpu.AdFrames.PerFrame.PercentUsage.Activated"/>
<affected-histogram
name="PageLoad.Clients.Ads.NonVisible.Cpu.AdFrames.PerFrame.TotalUsage.Activated"/>
<affected-histogram
name="PageLoad.Clients.Ads.Visible.Cpu.AdFrames.PerFrame.PercentUsage.Activated"/>
<affected-histogram
name="PageLoad.Clients.Ads.Visible.Cpu.AdFrames.PerFrame.TotalUsage.Activated"/>
</histogram_suffixes>
<histogram_suffixes name="AdsPageLoadMetricsBytes" separator=".">
......@@ -144214,6 +144220,9 @@ should be kept until we use this API. -->
label="The average load of an ad creative across the life of the page.
This is measured at percentage of a cpu core used and capped at
100% for multicore systems."/>
<suffix base="true" name="AdFrames.PerFrame.TotalUsage"
label="The total load of an ad creative across the life of the page.
This is measured in milliseconds and capped at 10 seconds."/>
<affected-histogram name="PageLoad.Clients.Ads.Cpu"/>
<affected-histogram name="PageLoad.Clients.Ads.NonVisible.Cpu"/>
<affected-histogram name="PageLoad.Clients.Ads.Visible.Cpu"/>
......@@ -144226,10 +144235,16 @@ should be kept until we use this API. -->
label="Includes only creatives without a user gesture."/>
<affected-histogram
name="PageLoad.Clients.Ads.Cpu.AdFrames.PerFrame.PercentUsage"/>
<affected-histogram
name="PageLoad.Clients.Ads.Cpu.AdFrames.PerFrame.TotalUsage"/>
<affected-histogram
name="PageLoad.Clients.Ads.NonVisible.Cpu.AdFrames.PerFrame.PercentUsage"/>
<affected-histogram
name="PageLoad.Clients.Ads.NonVisible.Cpu.AdFrames.PerFrame.TotalUsage"/>
<affected-histogram
name="PageLoad.Clients.Ads.Visible.Cpu.AdFrames.PerFrame.PercentUsage"/>
<affected-histogram
name="PageLoad.Clients.Ads.Visible.Cpu.AdFrames.PerFrame.TotalUsage"/>
</histogram_suffixes>
<histogram_suffixes name="AdsPageLoadMetricsCpuFullPage" separator=".">
......@@ -144237,6 +144252,9 @@ should be kept until we use this API. -->
label="The average load of the page across its lifetime. This is
measured at percentage of a cpu core used and capped at 100% for
multicore systems."/>
<suffix base="true" name="FullPage.TotalUsage"
label="The total load of the page across its lifetime. This is measured
in milliseconds and capped at 10 minutes."/>
<affected-histogram name="PageLoad.Clients.Ads.Cpu"/>
</histogram_suffixes>
......@@ -144246,11 +144264,18 @@ should be kept until we use this API. -->
<suffix name="PreInteractive" label="Usage before the page is interactive."/>
<affected-histogram
name="PageLoad.Clients.Ads.Cpu.AdFrames.PerFrame.PercentUsage.Unactivated"/>
<affected-histogram
name="PageLoad.Clients.Ads.Cpu.AdFrames.PerFrame.TotalUsage.Unactivated"/>
<affected-histogram name="PageLoad.Clients.Ads.Cpu.FullPage.PercentUsage"/>
<affected-histogram name="PageLoad.Clients.Ads.Cpu.FullPage.TotalUsage"/>
<affected-histogram
name="PageLoad.Clients.Ads.NonVisible.Cpu.AdFrames.PerFrame.PercentUsage.Unactivated"/>
<affected-histogram
name="PageLoad.Clients.Ads.NonVisible.Cpu.AdFrames.PerFrame.TotalUsage.Unactivated"/>
<affected-histogram
name="PageLoad.Clients.Ads.Visible.Cpu.AdFrames.PerFrame.PercentUsage.Unactivated"/>
<affected-histogram
name="PageLoad.Clients.Ads.Visible.Cpu.AdFrames.PerFrame.TotalUsage.Unactivated"/>
</histogram_suffixes>
<histogram_suffixes name="AdsPageLoadMetricsMainFrameBytes" separator=".">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment