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

Side by Side Diff: tracing/tracing/value/diagnostics/iteration_info.html

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright 2016 The Chromium Authors. All rights reserved. 3 Copyright 2016 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/base/utils.html">
8 <link rel="import" href="/tracing/value/diagnostics/diagnostic.html"> 9 <link rel="import" href="/tracing/value/diagnostics/diagnostic.html">
9 10
10 <script> 11 <script>
11 'use strict'; 12 'use strict';
12 13
13 tr.exportTo('tr.v.d', function() { 14 tr.exportTo('tr.v.d', function() {
14 /** 15 /**
15 * @constructor 16 * @constructor
16 * @param {!Object} info 17 * @param {!Object} info
17 * @param {string} info.benchmarkName 18 * @param {string} info.benchmarkName
18 * @param {undefined|string} info.label 19 * @param {undefined|string} info.label
19 * @param {undefined|!Object} info.storyGroupingKeys 20 * @param {undefined|!Object} info.storyGroupingKeys
20 * @param {undefined|string} info.storyDisplayName 21 * @param {undefined|string} info.storyDisplayName
21 * @param {string} info.storyUrl 22 * @param {string} info.storyUrl
22 * @param {number} info.storyRepeatCounter 23 * @param {number} info.storyRepeatCounter
23 * @param {number} info.storysetRepeatCounter 24 * @param {number} info.storysetRepeatCounter
24 * @param {number} info.benchmarkStartMs Milliseconds since Unix epoch. 25 * @param {number} info.benchmarkStartMs Milliseconds since Unix epoch.
25 */ 26 */
26 function IterationInfo(info) { 27 function IterationInfo(info) {
27 this.benchmarkName_ = info.benchmarkName; 28 this.benchmarkName_ = info.benchmarkName;
28 this.benchmarkStart_ = new Date(info.benchmarkStartMs); 29 this.benchmarkStart_ = new Date(info.benchmarkStartMs);
29 this.label_ = info.label; 30 this.label_ = info.label;
30 this.storyDisplayName_ = info.storyDisplayName; 31 this.storyDisplayName_ = info.storyDisplayName;
31 this.storyGroupingKeys_ = info.storyGroupingKeys; 32 this.storyGroupingKeys_ = info.storyGroupingKeys;
32 this.storyRepeatCounter_ = info.storyRepeatCounter; 33 this.storyRepeatCounter_ = info.storyRepeatCounter;
33 this.storyUrl_ = info.storyUrl; 34 this.storyUrl_ = info.storyUrl;
34 this.storysetRepeatCounter_ = info.storysetRepeatCounter; 35 this.storysetRepeatCounter_ = info.storysetRepeatCounter;
35 } 36 }
36 37
38 // Diagnostics generally do not need a constant name or getFromValue().
39 // IterationInfo is a special kind of Diagnostic that is produced by
40 // telemetry, which shepherds whole flocks of traces at once, and needs a
41 // system to identify and find traces by these attributes.
42
43 // Values produced by telemetry all have a single IterationInfo at this key in
44 // their DiagnosticMap.
45 IterationInfo.NAME = 'iteration';
46
47 /**
48 * @param {!tr.v.Value} value
49 * @return {(undefined|!IterationInfo)}
50 */
51 IterationInfo.getFromValue = function(value) {
52 return value.diagnostics.get(IterationInfo.NAME);
53 };
54
37 IterationInfo.prototype = { 55 IterationInfo.prototype = {
38 __proto__: tr.v.d.Diagnostic.prototype, 56 __proto__: tr.v.d.Diagnostic.prototype,
39 57
58 addToValue: function(value) {
59 value.diagnostics.add(IterationInfo.NAME, this);
60 },
61
40 asDictInto_: function(d) { 62 asDictInto_: function(d) {
41 d.benchmarkName = this.benchmarkName; 63 d.benchmarkName = this.benchmarkName;
42 d.benchmarkStartMs = this.benchmarkStart.getTime(); 64 d.benchmarkStartMs = this.benchmarkStart.getTime();
43 d.label = this.label; 65 d.label = this.label;
44 d.storyDisplayName = this.storyDisplayName; 66 d.storyDisplayName = this.storyDisplayName;
45 d.storyGroupingKeys = this.storyGroupingKeys; 67 d.storyGroupingKeys = this.storyGroupingKeys;
46 d.storyRepeatCounter = this.storyRepeatCounter; 68 d.storyRepeatCounter = this.storyRepeatCounter;
47 d.storyUrl = this.storyUrl; 69 d.storyUrl = this.storyUrl;
48 d.storysetRepeatCounter = this.storysetRepeatCounter; 70 d.storysetRepeatCounter = this.storysetRepeatCounter;
49 }, 71 },
50 72
51 get displayLabel() { 73 get displayLabel() {
52 if (this.label) 74 if (this.label)
53 return this.label; 75 return this.label;
54 return this.benchmarkName + ' ' + this.benchmarkStartMs; 76 return this.benchmarkName + ' ' + this.benchmarkStartString;
55 }, 77 },
56 78
57 get benchmarkName() { 79 get benchmarkName() {
58 return this.benchmarkName_; 80 return this.benchmarkName_;
59 }, 81 },
60 82
61 get label() { 83 get label() {
62 return this.label_; 84 return this.label_;
63 }, 85 },
64 86
65 get storyGroupingKeys() { 87 get storyGroupingKeys() {
66 return this.storyGroupingKeys_; 88 return this.storyGroupingKeys_;
67 }, 89 },
68 90
69 get storyDisplayName() { 91 get storyDisplayName() {
70 return this.storyDisplayName_; 92 return this.storyDisplayName_;
71 }, 93 },
72 94
73 get storyUrl() { 95 get storyUrl() {
74 return this.storyUrl_; 96 return this.storyUrl_;
75 }, 97 },
76 98
77 get storyRepeatCounter() { 99 get storyRepeatCounter() {
78 return this.storyRepeatCounter_; 100 return this.storyRepeatCounter_;
79 }, 101 },
80 102
103 get storyRepeatCounterLabel() {
104 return 'story repeat ' + this.storyRepeatCounter;
105 },
106
81 get storysetRepeatCounter() { 107 get storysetRepeatCounter() {
82 return this.storysetRepeatCounter_; 108 return this.storysetRepeatCounter_;
83 }, 109 },
84 110
111 get storysetRepeatCounterLabel() {
112 return 'storyset repeat ' + this.storysetRepeatCounter;
113 },
114
85 get benchmarkStart() { 115 get benchmarkStart() {
86 return this.benchmarkStart_; 116 return this.benchmarkStart_;
117 },
118
119 get benchmarkStartString() {
120 return tr.b.formatDate(this.benchmarkStart);
87 } 121 }
88 }; 122 };
89 123
90 IterationInfo.fromDict = function(d) { 124 IterationInfo.fromDict = function(d) {
91 return new IterationInfo(d); 125 return new IterationInfo(d);
92 }; 126 };
93 127
94 tr.v.d.Diagnostic.register(IterationInfo, { 128 tr.v.d.Diagnostic.register(IterationInfo, {
95 elementName: 'tr-v-ui-generic-diagnostic-span' 129 elementName: 'tr-v-ui-iteration-info-span'
96 }); 130 });
97 131
98 return { 132 return {
99 IterationInfo: IterationInfo 133 IterationInfo: IterationInfo
100 }; 134 };
101 }); 135 });
102 </script> 136 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/value/diagnostics/diagnostic_map.html ('k') | tracing/tracing/value/diagnostics/related_event_set.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698