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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <!--
3 Copyright 2015 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
6 -->
7 <link rel="import" href="/perf_insights/mre/function_handle.html">
8 <link rel="import" href="/tracing/base/iteration_helpers.html">
9 <link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
10 <link rel="import" href="/tracing/model/ir_coverage.html">
11 <link rel="import" href="/tracing/model/user_model/user_expectation.html">
12 <link rel="import" href="/tracing/value/unit.html">
13
14 <script>
15 'use strict';
16
17
18 tr.exportTo('pi.m', function() {
19 function v8CallStatsDump(result, model) {
20 var v8_runtime_map = {};
21 var totalCount = 0;
22 var totalTime = 0;
23 // TODO(fmeawad): filter events until TTI only.
24 for (var event of model.getDescendantEvents()) {
25 if (!(event instanceof tr.model.ThreadSlice))
26 continue;
27 var v8_runtime = event.args['runtime-call-stat'];
28 if (v8_runtime !== undefined) {
29 try {
30 var v8_runtime_object = JSON.parse(v8_runtime);
31 for (var runtime_call in v8_runtime_object) {
32 // exclude "END" and malformed entries.
33 if (v8_runtime_object[runtime_call].length == 2) {
34 if (v8_runtime_map[runtime_call] === undefined) {
35 v8_runtime_map[runtime_call] = {count: 0, time: 0};
36 }
37 v8_runtime_map[runtime_call].count++;
38 var runtime_time = v8_runtime_object[runtime_call][1] / 1000;
39 v8_runtime_map[runtime_call].time += runtime_time;
40 totalCount++;
41 totalTime += runtime_time;
42 }
43 }
44 } catch (e) {
45 console.warn(e);
46 }
47 }
48 }
49 for (var i in v8_runtime_map) {
50 result.addPair(i, {time: Number(v8_runtime_map[i].time).toFixed(2),
51 count: v8_runtime_map[i].count});
52 }
53 result.addPair('Total', {time: Number(totalTime).toFixed(2),
54 count: totalCount});
55 }
56
57 pi.FunctionRegistry.register(v8CallStatsDump);
58
59 // Exporting for tests.
60 return {
61 v8CallStatsDump: v8CallStatsDump
62 };
63 });
64
65 </script>
OLDNEW
« 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