| Index: tracing/tracing/extras/v8/runtime_stats_entry_test.html
|
| diff --git a/tracing/tracing/extras/v8/runtime_stats_entry_test.html b/tracing/tracing/extras/v8/runtime_stats_entry_test.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..de819f7781fb0067111d84673412e11ddf4b0abf
|
| --- /dev/null
|
| +++ b/tracing/tracing/extras/v8/runtime_stats_entry_test.html
|
| @@ -0,0 +1,119 @@
|
| +<!DOCTYPE html>
|
| +<!--
|
| +Copyright 2016 The Chromium Authors. All rights reserved.
|
| +Use of this source code is governed by a BSD-style license that can be
|
| +found in the LICENSE file.
|
| +-->
|
| +
|
| +<link rel="import" href="/tracing/core/test_utils.html">
|
| +<link rel="import" href="/tracing/extras/v8/runtime_stats_entry.html">
|
| +<link rel="import" href="/tracing/extras/v8/v8_thread_slice.html">
|
| +
|
| +<script>
|
| +'use strict';
|
| +
|
| +tr.b.unittest.testSuite(function() {
|
| + test('RuntimeStatsEntry', function() {
|
| + var entry = new tr.e.v8.RuntimeStatsEntry("IC_Entry", 5, 1234);
|
| + assert.equal(entry.name, "IC_Entry");
|
| + assert.equal(entry.count, 5);
|
| + assert.equal(entry.time, 1234);
|
| +
|
| + entry.addSample(37, 8766);
|
| + assert.equal(entry.name, "IC_Entry");
|
| + assert.equal(entry.count, 42);
|
| + assert.equal(entry.time, 10000);
|
| +
|
| + entry.addSample(58, 1);
|
| + assert.equal(entry.name, "IC_Entry");
|
| + assert.equal(entry.count, 100);
|
| + assert.equal(entry.time, 10001);
|
| + });
|
| +
|
| + test('RuntimeStatsGroup', function() {
|
| + var group = new tr.e.v8.RuntimeStatsGroup('IC', /.*IC.*/);
|
| + assert.notEqual(group.match("IC_Entry"), undefined);
|
| + assert.notEqual(group.match("CallbackIC_Entry"), undefined);
|
| + assert.notEqual(group.match("EntryIC"), undefined);
|
| + assert.equal(group.match("Callback_Entry"), undefined);
|
| +
|
| + var entry1a = new tr.e.v8.RuntimeStatsEntry("IC_Entry", 5, 1234);
|
| + group.add(entry1a);
|
| + assert.deepEqual(group.values, [entry1a]);
|
| + var entry2 = new tr.e.v8.RuntimeStatsEntry("IC_Entry2", 2, 2048);
|
| + group.add(entry2);
|
| + assert.deepEqual(group.values, [entry1a, entry2]);
|
| + var entry1b = new tr.e.v8.RuntimeStatsEntry("IC_Entry", 37, 8766);
|
| + group.add(entry1b);
|
| + var entry1sum = new tr.e.v8.RuntimeStatsEntry("IC_Entry", 42, 10000);
|
| + assert.deepEqual(group.values, [entry1sum, entry2]);
|
| + });
|
| +
|
| + function checkRuntimeGroup_(group, name, count, time) {
|
| + assert.equal(group.name, name);
|
| + assert.equal(group.count, count);
|
| + assert.equal(group.time, time);
|
| + }
|
| +
|
| + test('RuntimeStatsGroupCollection', function() {
|
| + var slices = [];
|
| + slices.push(tr.c.TestUtils.newSliceEx({
|
| + title: 'V8.Execute',
|
| + start: 0,
|
| + end: 10,
|
| + type: tr.e.v8.V8ThreadSlice,
|
| + cat: 'v8',
|
| + args: {
|
| + 'runtime-call-stats': {
|
| + JS_Execution: [1, 11],
|
| + HandleApiCall: [2, 22],
|
| + CompileFullCode: [3, 33],
|
| + LoadIC_Miss: [4, 44],
|
| + ParseLazy: [5, 55],
|
| + OptimizeCode: [6, 66],
|
| + FunctionCallback: [7, 77],
|
| + AllocateInTargetSpace: [8, 88],
|
| + API_Object_Get: [9, 99]
|
| + }
|
| + }
|
| + }));
|
| + slices.push(tr.c.TestUtils.newSliceEx({
|
| + title: 'V8.newInstance',
|
| + start: 0,
|
| + end: 10,
|
| + type: tr.e.v8.V8ThreadSlice,
|
| + cat: 'v8',
|
| + args: {
|
| + 'runtime-call-stats': {
|
| + JS_Execution: [2, 22],
|
| + HandleApiCall: [3, 33],
|
| + CompileFullCode: [4, 44],
|
| + LoadIC_Miss: [5, 55],
|
| + ParseLazy: [6, 66],
|
| + OptimizeCode: [7, 77],
|
| + FunctionCallback: [8, 88],
|
| + AllocateInTargetSpace: [9, 99],
|
| + API_Object_Get: [1, 11]
|
| + }
|
| + }
|
| + }));
|
| +
|
| + var groupCollection = new tr.e.v8.RuntimeStatsGroupCollection();
|
| + groupCollection.addSlices(slices);
|
| + assert.equal(groupCollection.totalTime, 990);
|
| +
|
| + var groups = groupCollection.runtimeGroups;
|
| + assert.deepEqual(groups.length, 10);
|
| + checkRuntimeGroup_(groups[0], 'Total', 90, 990);
|
| + checkRuntimeGroup_(groups[1], 'IC', 9, 99);
|
| + checkRuntimeGroup_(groups[2], 'Optimize', 13, 143);
|
| + checkRuntimeGroup_(groups[3], 'Compile', 7, 77);
|
| + checkRuntimeGroup_(groups[4], 'Parse', 11, 121);
|
| + checkRuntimeGroup_(groups[5], 'Callback', 15, 165);
|
| + checkRuntimeGroup_(groups[6], 'API', 10, 110);
|
| + checkRuntimeGroup_(groups[7], 'GC', 17, 187);
|
| + checkRuntimeGroup_(groups[8], 'JavaScript', 3, 33);
|
| + checkRuntimeGroup_(groups[9], 'Runtime', 5, 55);
|
| + });
|
| +});
|
| +</script>
|
|
|