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

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

Issue 1730313007: Metric-ify SystemHealth metrics (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: rebase Created 4 years, 9 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: tracing/tracing/metrics/system_health/efficiency_metric_test.html
diff --git a/tracing/tracing/metrics/system_health/efficiency_metric_test.html b/tracing/tracing/metrics/system_health/efficiency_metric_test.html
index 346dfc21a7e5bea548befe9d7d4e34b9b1dc9681..37afcbf445e5db582b65e168fc59d56427f7eabf 100644
--- a/tracing/tracing/metrics/system_health/efficiency_metric_test.html
+++ b/tracing/tracing/metrics/system_health/efficiency_metric_test.html
@@ -6,38 +6,49 @@ found in the LICENSE file.
-->
<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/user_model/idle_expectation.html">
<link rel="import"
href="/tracing/metrics/system_health/efficiency_metric.html">
+<link rel="import" href="/tracing/metrics/value_list.html">
+<link rel="import" href="/tracing/model/user_model/idle_expectation.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
- function createIdleIR() {
- var slice = tr.c.TestUtils.newSliceEx({
- title: 'foo',
- start: 0,
- end: 100,
- type: tr.model.ThreadSlice
- });
- slice.isTopLevel = true;
+ function createModel() {
+ return tr.c.TestUtils.newModel(function(model) {
+ model.p1 = model.getOrCreateProcess(1);
+ model.t2 = model.p1.getOrCreateThread(2);
- var idleIR = new tr.model.um.IdleExpectation(undefined, 0, 100);
- idleIR.associatedEvents.push(slice);
- return idleIR;
+ var slice = tr.c.TestUtils.newSliceEx({
+ title: 'foo',
+ start: 0,
+ end: 100,
+ type: tr.model.ThreadSlice
+ });
+ slice.isTopLevel = true;
+
+ var idle = new tr.model.um.IdleExpectation(model, 0, 100);
+ idle.associatedEvents.push(slice);
+ model.userModel.expectations.push(idle);
+ model.canonicalUrlThatCreatedThisTrace = 'test';
+ });
}
test('optimalEfficiency', function() {
- var idleIR = createIdleIR();
- idleIR.associatedEvents[0].cpuSelfTime = 10;
- assert.equal(1, tr.metrics.sh.EfficiencyMetric.forExpectation(idleIR));
+ var model = createModel();
+ model.userModel.expectations[0].associatedEvents[0].cpuSelfTime = 10;
+ var valueList = new tr.metrics.ValueList();
+ tr.metrics.sh.EfficiencyMetric(valueList, model);
+ assert.equal(1, valueList.valueDicts[0].numeric.value);
});
test('pessimalEfficiency', function() {
- var idleIR = createIdleIR();
- idleIR.associatedEvents[0].cpuSelfTime = 100;
- assert.equal(0, tr.metrics.sh.EfficiencyMetric.forExpectation(idleIR));
+ var model = createModel();
+ model.userModel.expectations[0].associatedEvents[0].cpuSelfTime = 100;
+ var valueList = new tr.metrics.ValueList();
+ tr.metrics.sh.EfficiencyMetric(valueList, model);
+ assert.equal(0, valueList.valueDicts[0].numeric.value);
});
});
</script>

Powered by Google App Engine
This is Rietveld 408576698