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

Unified Diff: trace_processor/experimental/mappers/v8_callstats_dump.html

Issue 2251873002: [Mapper] Experimental Mapper to Extract call stats dump from traces (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Created 4 years, 4 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: trace_processor/experimental/mappers/v8_callstats_dump.html
diff --git a/trace_processor/experimental/mappers/v8_callstats_dump.html b/trace_processor/experimental/mappers/v8_callstats_dump.html
new file mode 100644
index 0000000000000000000000000000000000000000..cdd4aeb62b8f8ac35327574f8e20e8621c2451f6
--- /dev/null
+++ b/trace_processor/experimental/mappers/v8_callstats_dump.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<!--
+Copyright 2015 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="/perf_insights/mre/function_handle.html">
+<link rel="import" href="/tracing/base/iteration_helpers.html">
+<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
+<link rel="import" href="/tracing/model/ir_coverage.html">
+<link rel="import" href="/tracing/model/user_model/user_expectation.html">
+<link rel="import" href="/tracing/value/unit.html">
+
+<script>
+'use strict';
+
+
+tr.exportTo('pi.m', function() {
+ function v8CallStatsDump(result, model) {
+ var v8_runtime_map = {};
+ var totalCount = 0;
+ var totalTime = 0;
+ // TODO(fmeawad): filter events until TTI only.
+ for (var event of model.getDescendantEvents()) {
+ if (!(event instanceof tr.model.ThreadSlice))
+ continue;
+ var v8_runtime = event.args['runtime-call-stat'];
+ if (v8_runtime !== undefined) {
+ try {
+ var v8_runtime_object = JSON.parse(v8_runtime);
+ for (var runtime_call in v8_runtime_object) {
+ // exclude "END" and malformed entries.
+ if (v8_runtime_object[runtime_call].length == 2) {
+ if (v8_runtime_map[runtime_call] === undefined) {
+ v8_runtime_map[runtime_call] = {count: 0, time: 0};
+ }
+ v8_runtime_map[runtime_call].count++;
+ var runtime_time = v8_runtime_object[runtime_call][1] / 1000;
+ v8_runtime_map[runtime_call].time += runtime_time;
+ totalCount++;
+ totalTime += runtime_time;
+ }
+ }
+ } catch (e) {
+ console.warn(e);
+ }
+ }
+ }
+ for (var i in v8_runtime_map) {
+ result.addPair(i, {time: Number(v8_runtime_map[i].time).toFixed(2),
+ count: v8_runtime_map[i].count});
+ }
+ result.addPair('Total', {time: Number(totalTime).toFixed(2),
+ count: totalCount});
+ }
+
+ pi.FunctionRegistry.register(v8CallStatsDump);
+
+ // Exporting for tests.
+ return {
+ v8CallStatsDump: v8CallStatsDump
+ };
+});
+
+</script>
« 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