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

Unified Diff: tracing/tracing/extras/v8/runtime_stats_entry.html

Issue 2436193002: Reland of [V8][Metric] Initial implementation of the RuntimeStatsMetric (Closed)
Patch Set: ValueSet --> HistogramSet Created 4 years, 2 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 | « tracing/trace_viewer.gypi ('k') | tracing/tracing/extras/v8/runtime_stats_entry_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/extras/v8/runtime_stats_entry.html
diff --git a/tracing/tracing/extras/v8/runtime_stats_entry.html b/tracing/tracing/extras/v8/runtime_stats_entry.html
new file mode 100644
index 0000000000000000000000000000000000000000..6a80fff16160836be15bd609516a6ab387f6f0bc
--- /dev/null
+++ b/tracing/tracing/extras/v8/runtime_stats_entry.html
@@ -0,0 +1,125 @@
+<!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/extras/v8/v8_thread_slice.html">
+
+<script>
+'use strict';
+
+tr.exportTo('tr.e.v8', function() {
+ class RuntimeStatsEntry {
+ /**
+ * @param time is in microseconds.
+ */
+ constructor(name, count, time) {
+ this.name_ = name;
+ this.count_ = count;
+ this.time_ = time;
+ }
+
+ get name() {
+ return this.name_;
+ }
+
+ get count() {
+ return this.count_;
+ }
+
+ get time() {
+ return this.time_;
+ }
+
+ addSample(count, time) {
+ this.count_ += count;
+ this.time_ += time;
+ }
+ }
+
+ class RuntimeStatsGroup extends RuntimeStatsEntry {
+ constructor(name, matchRegex) {
+ super(name, 0, 0);
+ this.regex_ = matchRegex;
+ this.entries_ = new Map();
+ }
+
+ match(name) {
+ return this.regex_ && name.match(this.regex_);
+ }
+
+ add(entry) {
+ var value = this.entries_.get(entry.name);
+ if (value !== undefined) {
+ value.addSample(entry.count, entry.time);
+ } else {
+ this.entries_.set(entry.name, entry);
+ }
+ this.count_ += entry.count;
+ this.time_ += entry.time;
+ }
+
+ get values() {
+ return Array.from(this.entries_.values());
+ }
+ }
+
+ class RuntimeStatsGroupCollection {
+ constructor() {
+ this.groups_ = new Array(
+ new RuntimeStatsGroup('Total'),
+ new RuntimeStatsGroup('IC', /.*IC.*/),
+ new RuntimeStatsGroup('Optimize',
+ /StackGuard|.*Optimize.*|.*Deoptimize.*|Recompile.*/),
+ new RuntimeStatsGroup('Compile', /.*Compile.*/),
+ new RuntimeStatsGroup('Parse', /.*Parse.*/),
+ new RuntimeStatsGroup('Callback', /.*Callback$/),
+ new RuntimeStatsGroup('API', /.*API.*/),
+ new RuntimeStatsGroup('GC', /GC|AllocateInTargetSpace/),
+ new RuntimeStatsGroup('JavaScript', /JS_Execution/),
+ new RuntimeStatsGroup('Runtime', /.*/)
+ );
+ }
+
+ addSlices(slices) {
+ for (var slice of slices) {
+ if (!(slice instanceof tr.e.v8.V8ThreadSlice)) return;
+ try {
+ var runtimeCallStats = JSON.parse(slice.runtimeCallStats);
+ } catch (e) {
+ var runtimeCallStats = slice.runtimeCallStats;
+ }
+ if (runtimeCallStats === undefined) continue;
+ tr.b.iterItems(runtimeCallStats, (name, stat) => {
+ // Skip the 'Total' group
+ for (var i = 1; i < this.groups_.length; ++i) {
+ if (this.groups_[i].match(name)) {
+ if (stat.length !== 2) break;
+ var entry = new RuntimeStatsEntry(name, stat[0], stat[1]);
+ this.groups_[0].addSample(stat[0], stat[1]);
+ this.groups_[i].add(entry);
+ break;
+ }
+ }
+ });
+ }
+ }
+
+ get totalTime() {
+ return this.groups_[0].time;
+ }
+
+ get runtimeGroups() {
+ return this.groups_;
+ }
+ }
+
+ return {
+ RuntimeStatsEntry: RuntimeStatsEntry,
+ RuntimeStatsGroup: RuntimeStatsGroup,
+ RuntimeStatsGroupCollection: RuntimeStatsGroupCollection
+ };
+});
+</script>
« no previous file with comments | « tracing/trace_viewer.gypi ('k') | tracing/tracing/extras/v8/runtime_stats_entry_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698