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

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

Issue 2446423009: Normalize thread_times metric against the bounds of the browser process. (Closed)
Patch Set: Comments from nednguyen. Created 4 years, 1 month 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: tracing/tracing/metrics/system_health/cpu_time_metric_test.html
diff --git a/tracing/tracing/metrics/system_health/cpu_time_metric_test.html b/tracing/tracing/metrics/system_health/cpu_time_metric_test.html
index 2b39597b37e98d299c2aacbbf942766669268395..0b0e47789c3cffbbc451cca6851d913ff5042c65 100644
--- a/tracing/tracing/metrics/system_health/cpu_time_metric_test.html
+++ b/tracing/tracing/metrics/system_health/cpu_time_metric_test.html
@@ -6,6 +6,7 @@ found in the LICENSE file.
-->
<link rel="import" href="/tracing/core/test_utils.html">
+<link rel="import" href="/tracing/extras/chrome/chrome_test_utils.html">
<link rel="import" href="/tracing/metrics/system_health/cpu_time_metric.html">
<link rel="import" href="/tracing/value/histogram_set.html">
@@ -50,6 +51,41 @@ tr.b.unittest.testSuite(function() {
assert.closeTo(value, 0.033, 0.001);
});
+ // Normalize against the browser process, whose non-CPU slice goes from 2900
+ // to 3000.
+ test('cpuTimeMetric_browserProcess', function() {
+ var sliceDuration = 50;
+ var totalDuration = 3000;
+ var model = tr.e.chrome.ChromeTestUtils.newChromeModel(function(model) {
+ model.browserMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
+ type: tr.model.ThreadSlice,
+ isTopLevel: true,
+ start: totalDuration - 2 * sliceDuration,
+ duration: 2 * sliceDuration,
+ }));
+ model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
+ type: tr.model.ThreadSlice,
+ isTopLevel: true,
+ start: 0,
+ duration: sliceDuration,
+ cpuStart: 0,
+ cpuDuration: sliceDuration,
+ }));
+ model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
+ type: tr.model.ThreadSlice,
+ isTopLevel: true,
+ start: totalDuration - sliceDuration,
+ duration: sliceDuration,
+ cpuStart: totalDuration - sliceDuration,
+ cpuDuration: sliceDuration,
+ }));
+ });
+ var values = new tr.v.HistogramSet();
+ tr.metrics.sh.cpuTimeMetric(values, model);
+ var value = tr.b.getOnlyElement(values).average;
+ assert.closeTo(value, 0.5, 0.001);
+ });
+
// Makes sure that rangeOfInterest works correctly.
test('cpuTimeMetric_oneProcess_rangeOfInterest', function() {
var sliceDuration = 50;
« no previous file with comments | « tracing/tracing/metrics/system_health/cpu_time_metric.html ('k') | tracing/tracing/model/helpers/chrome_model_helper.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698