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

Unified Diff: tracing/tracing/metrics/system_health/cpu_time_metric.html

Issue 2334863002: Ignore overhead slices in cpu time computation. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/metrics/system_health/cpu_time_metric.html
diff --git a/tracing/tracing/metrics/system_health/cpu_time_metric.html b/tracing/tracing/metrics/system_health/cpu_time_metric.html
index eed94f0365adb8168b9e73d6055be8cbc707bb91..caef2cab20ca9af1a6a9647058a667c686d85be6 100644
--- a/tracing/tracing/metrics/system_health/cpu_time_metric.html
+++ b/tracing/tracing/metrics/system_health/cpu_time_metric.html
@@ -25,10 +25,12 @@ tr.exportTo('tr.metrics.sh', function() {
function cpuTimeMetric(values, model, optOptions) {
var rangeOfInterest = optOptions ? optOptions.rangeOfInterest : undefined;
var allProcessCpuTime = 0;
+ var allOverhead = 0;
for (var pid in model.processes) {
var process = model.processes[pid];
var processCpuTime = 0;
+ var processOverhead = 0;
for (var tid in process.threads) {
var thread = process.threads[tid];
var threadCpuTime = 0;
@@ -40,10 +42,26 @@ tr.exportTo('tr.metrics.sh', function() {
threadCpuTime += slice.cpuDuration;
});
processCpuTime += threadCpuTime;
+
+ var threadOverhead = 0;
+ thread.sliceGroup.slices.forEach(function(slice) {
+ if (rangeOfInterest &&
+ !rangeOfInterest.intersectsExplicitRangeInclusive(
+ slice.start, slice.end))
+ return;
+ if (slice.category != 'trace_event_overhead' ||
+ slice.name != 'overhead')
+ return;
+ threadOverhead += slice.cpuDuration;
+ });
+ processOverhead += threadOverhead;
}
allProcessCpuTime += processCpuTime;
+ allOverhead += processOverhead;
}
+ allProcessCpuTime -= allOverhead;
+
// Normalize cpu time by clock time.
var normalizationRange = rangeOfInterest ?
rangeOfInterest : model.bounds.range;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698