forked from gatieme/systrace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
310 lines (310 loc) · 145 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
window.FLATTENED={};window.FLATTENED.base=!0;window.FLATTENED.event_target=!0;window.FLATTENED.measuring_stick=!0;window.FLATTENED.timeline_filter=!0;window.FLATTENED.range=!0;window.FLATTENED.timeline_selection=!0;window.FLATTENED.timeline_viewport=!0;window.FLATTENED.ui=!0;window.FLATTENED["tracks.timeline_track"]=!0;window.FLATTENED["tracks.timeline_container_track"]=!0;window.FLATTENED.fast_rect_renderer=!0;window.FLATTENED.timeline_color_scheme=!0;
window.FLATTENED["tracks.timeline_canvas_based_track"]=!0;window.FLATTENED.sorted_array_utils=!0;window.FLATTENED["tracks.timeline_slice_track"]=!0;window.FLATTENED.timeline_guid=!0;window.FLATTENED.timeline_slice=!0;window.FLATTENED.timeline_slice_group=!0;window.FLATTENED.timeline_async_slice_group=!0;window.FLATTENED.timeline_thread=!0;window.FLATTENED.timeline_counter=!0;window.FLATTENED.timeline_process_base=!0;window.FLATTENED.timeline_process=!0;window.FLATTENED.timeline_kernel=!0;
window.FLATTENED.timeline_cpu=!0;window.FLATTENED.timeline_model=!0;window.FLATTENED["tracks.timeline_cpu_track"]=!0;window.FLATTENED["tracks.timeline_counter_track"]=!0;window.FLATTENED["tracks.timeline_slice_group_track"]=!0;window.FLATTENED["tracks.timeline_async_slice_group_track"]=!0;window.FLATTENED["tracks.timeline_thread_track"]=!0;window.FLATTENED["tracks.timeline_process_track"]=!0;window.FLATTENED["tracks.timeline_model_track"]=!0;window.FLATTENED["tracks.timeline_viewport_track"]=!0;
window.FLATTENED.timeline=!0;window.FLATTENED.timeline_analysis=!0;window.FLATTENED.overlay=!0;window.FLATTENED.timeline_category_filter_dialog=!0;window.FLATTENED.timeline_find_control=!0;window.FLATTENED.trace_event_importer=!0;window.FLATTENED.linux_perf_parser=!0;window.FLATTENED.linux_perf_block_parser=!0;window.FLATTENED.linux_perf_bus_parser=!0;window.FLATTENED.linux_perf_clock_parser=!0;window.FLATTENED.linux_perf_cpufreq_parser=!0;window.FLATTENED.linux_perf_drm_parser=!0;
window.FLATTENED.linux_perf_exynos_parser=!0;window.FLATTENED.linux_perf_gesture_parser=!0;window.FLATTENED.linux_perf_i915_parser=!0;window.FLATTENED.linux_perf_mali_parser=!0;window.FLATTENED.linux_perf_power_parser=!0;window.FLATTENED.linux_perf_sched_parser=!0;window.FLATTENED.linux_perf_workqueue_parser=!0;window.FLATTENED.linux_perf_android_parser=!0;window.FLATTENED.linux_perf_importer=!0;window.FLATTENED.settings=!0;window.FLATTENED.timeline_view=!0;"use strict";var global=this;
this.base=function(){function f(b){"/"==b[b.length-1]&&(b=b.substring(0,b.length-1));r=b}function c(b,a){p[b]||(p[b]=[]);for(var d=p[b],e=!1,g=0;g<d.length;g++)d[g]==a&&(e=!0);e||d.push(a)}function a(b,a){q[b]||(q[b]=[]);for(var d=q[b],e=!1,g=0;g<d.length;g++)d[g]==a&&(e=!0);e||d.push(a)}function b(){if(!m){m=!0;var b=new XMLHttpRequest,d=r+"/deps.js";b.open("GET",d,!1);b.send(null);if(200!=b.status)throw Error("Could not find "+d+". Run calcdeps.py and try again.");base.addModuleStylesheet=a;base.addModuleDependency=
c;try{eval(b.responseText)}catch(e){throw Error("When loading deps, got "+e.stack?e.stack:e);}delete base.addModuleDependency;delete base.addModuleStylesheet}}function d(a,g){var c=g||0;if(window.FLATTENED){if(!window.FLATTENED[a])throw Error("Somehow, module "+a+" didn't get stored in the flattened js file! You may need to rerun build/flatten.py");}else if(b(),"APPENDED"!=s[a]){if("RESOLVING"==s[a])throw Error("Circular dependency betwen modules. Cannot continue!");s[a]="RESOLVING";for(var k=q[a]||
[],h=0;h<k.length;h++)e(k[h]);k=p[a]||[];for(h=0;h<k.length;h++)d(k[h],c+1);c=a.replace(/\./g,"/")+".js";base.doc.write('<script type="text/javascript" src="'+(r+"/"+c)+'">\x3c/script>');s[a]="APPENDED"}}function e(b){if(!window.FLATTENED&&!u[b]){u[b]=!0;b=b.replace(/\./g,"/")+".css";b=r+"/"+b;var a=document.createElement("link");a.setAttribute("rel","stylesheet");a.setAttribute("href",b);base.doc.head.appendChild(a)}}function g(b,a,d,e){var g=new base.Event(a+"Change");g.propertyName=a;g.newValue=
d;g.oldValue=e;b.dispatchEvent(g)}function k(b){return b.replace(/([A-Z])/g,"-$1").toLowerCase()}function h(b,a){switch(a){case t.JS:var d=b+"_";return function(){return this[d]};case t.ATTR:var e=k(b);return function(){return this.getAttribute(e)};case t.BOOL_ATTR:return e=k(b),function(){return this.hasAttribute(e)}}}function j(b,a,d){switch(a){case t.JS:var e=b+"_";return function(a){var c=this[e];a!==c&&(this[e]=a,d&&d.call(this,a,c),g(this,b,a,c))};case t.ATTR:var c=k(b);return function(a){var e=
this[c];a!==e&&(void 0==a?this.removeAttribute(c):this.setAttribute(c,a),d&&d.call(this,a,e),g(this,b,a,e))};case t.BOOL_ATTR:return c=k(b),function(a){var e=this[c];a!==e&&(a?this.setAttribute(c,b):this.removeAttribute(c),d&&d.call(this,a,e),g(this,b,a,e))}}}function l(b,a,d){var e=base.doc.createEvent("Event");e.initEvent(b,!!a,!!d);e.__proto__=global.Event.prototype;return e}var r=".",m=!1,p={},q={},s={},u={},t={JS:"js",ATTR:"attr",BOOL_ATTR:"boolAttr"},v=1;return{set moduleBasePath(b){f(b)},get moduleBasePath(){return r},
require:d,requireStylesheet:e,exportTo:function(b,a){var d;d=b.split(".");for(var e=global,g;d.length&&(g=d.shift());)e=g in e?e[g]:e[g]={};d=e;try{var c=a()}catch(k){console.log("While running exports for ",name,":");console.log(k.stack||k);return}for(var h in c)(e=Object.getOwnPropertyDescriptor(c,h))&&Object.defineProperty(d,h,e)},addSingletonGetter:function(b){b.getInstance=function(){return b.instance_||(b.instance_=new b)}},createUid:function(){return v++},defineProperty:function(b,a,d,e){"function"==
typeof b&&(b=b.prototype);d=d||t.JS;b.__lookupGetter__(a)||b.__defineGetter__(a,h(a,d));b.__lookupSetter__(a)||b.__defineSetter__(a,j(a,d,e))},dispatchPropertyChange:g,dispatchSimpleEvent:function(b,a,d,e){a=new base.Event(a,d,e);return b.dispatchEvent(a)},Event:l,getUid:function(b){return b.hasOwnProperty("uid")?b.uid:b.uid=v++},initialize:function(){if(global.document)l.prototype={__proto__:global.Event.prototype},base.doc=document,base.isMac=/Mac/.test(navigator.platform),base.isWindows=/Win/.test(navigator.platform),
base.isChromeOS=/CrOS/.test(navigator.userAgent),base.isLinux=/Linux/.test(navigator.userAgent),base.isGTK=/GTK/.test(chrome.toolkit),base.isViews=/views/.test(chrome.toolkit),f("/src");else{var b=cr;Object.defineProperty(global,"cr",{get:function(){Object.defineProperty(global,"cr",{value:b});originalBase.initialize();return b},configurable:!0})}},PropertyKind:t}}();base.initialize();
base.exportTo("base",function(){function f(){}f.prototype={addEventListener:function(c,a){this.listeners_||(this.listeners_=Object.create(null));if(c in this.listeners_){var b=this.listeners_[c];0>b.indexOf(a)&&b.push(a)}else this.listeners_[c]=[a]},removeEventListener:function(c,a){if(this.listeners_&&c in this.listeners_){var b=this.listeners_[c],d=b.indexOf(a);0<=d&&(1==b.length?delete this.listeners_[c]:b.splice(d,1))}},dispatchEvent:function(c){if(!this.listeners_)return!0;var a=this;c.__defineGetter__("target",
function(){return a});c.preventDefault=function(){this.returnValue=!1};var b=c.type,d=0;if(b in this.listeners_)for(var b=this.listeners_[b].concat(),e=0,g;g=b[e];e++)d=g.handleEvent?d|!1===g.handleEvent.call(g,c):d|!1===g.call(this,c);return!d&&c.returnValue}};return{EventTarget:f}});
base.exportTo("tracing",function(){function f(){this.iframe_=void 0}f.prototype={__proto__:Object.prototype,measure:function(c){this.iframe_.contentDocument.body.appendChild(c);var a=this.iframe_.contentWindow.getComputedStyle(c),b=parseInt(a.width,10),a=parseInt(a.height,10);this.iframe_.contentDocument.body.removeChild(c);return{width:b,height:a}},attach:function(){var c=document.createElement("iframe");c.style.cssText="width:100%;height:0;border:0;visibility:hidden";document.body.appendChild(c);
this.iframe_=c;this.iframe_.contentDocument.body.style.cssText="padding:0;margin:0;overflow:hidden";for(var c=document.querySelectorAll("link[rel=stylesheet]"),a=0;a<c.length;a++){var b=c[a],d=this.iframe_.contentDocument.createElement("link");d.rel="stylesheet";d.href=b.href;this.iframe_.contentDocument.head.appendChild(d)}},detach:function(){document.body.removeChild(this.iframe_);this.iframe_=void 0}};return{MeasuringStick:f}});"use strict";
base.exportTo("tracing",function(){function f(){}function c(b){this.text_=b}function a(b){this.categories_={};b=b||[];for(var a=0;a<b.length;a++)this.addCategory(b[a])}f.prototype={__proto__:Object.prototype,matchCounter:function(){return!0},matchCpu:function(){return!0},matchProcess:function(){return!0},matchSlice:function(){return!0},matchThread:function(){return!0}};c.prototype={__proto__:f.prototype,matchCounter:function(b){return 0==this.text_.length||void 0===b.name?!1:-1!=b.name.indexOf(this.text_)},
matchSlice:function(b){return 0==this.text_.length||void 0===b.title?!1:-1!=b.title.indexOf(this.text_)}};a.prototype={__proto__:f.prototype,addCategory:function(b){this.categories_[b]=!0},matchCounter:function(b){return!b.category?!0:!this.categories_[b.category]},matchSlice:function(b){return!b.category?!0:!this.categories_[b.category]}};return{filterCounterArray:function(b,a){if(void 0===b)return a;for(var e=[],g=0;g<a.length;++g)b.matchCounter(a[g])&&e.push(a[g]);return e},filterSliceArray:function(b,
a){if(void 0===b)return a;for(var e=[],g=0;g<a.length;++g)b.matchSlice(a[g])&&e.push(a[g]);return e},TimelineFilter:f,TimelineTitleFilter:c,TimelineCategoryFilter:a}});"use strict";"use strict";
base.exportTo("base",function(){function f(){this.isEmpty_=!0;this.max_=this.min_=void 0}f.prototype={__proto__:Object.prototype,reset:function(){this.isEmpty_=!0;this.max_=this.min_=void 0},get isEmpty(){return this.isEmpty_},addRange:function(c){c.isEmpty||(this.addValue(c.min),this.addValue(c.max))},addValue:function(c){this.isEmpty_?(this.min_=this.max_=c,this.isEmpty_=!1):(this.max_=Math.max(this.max_,c),this.min_=Math.min(this.min_,c))},get min(){return this.isEmpty_?void 0:this.min_},get max(){return this.isEmpty_?
void 0:this.max_}};return{Range:f}});"use strict";base.require("range");base.require("event_target");
base.exportTo("tracing",function(){function f(b,a){this.track=b;this.slice=a}function c(b,a,e){this.track=b;this.counter=a;this.sampleIndex=e}function a(){this.bounds_dirty_=!0;this.bounds_=new base.Range;this.length_=0}f.prototype={get selected(){return this.slice.selected},set selected(b){this.slice.selected=b}};c.prototype={get selected(){return!0==this.track.selectedSamples[this.sampleIndex]},set selected(b){this.track.selectedSamples[this.sampleIndex]=b?!0:!1;this.track.invalidate()}};a.prototype=
{__proto__:Object.prototype,get bounds(){if(this.bounds_dirty_){this.bounds_.reset();for(var b=0;b<this.length_;b++){var a=this[b];a.slice&&(this.bounds_.addValue(a.slice.start),this.bounds_.addValue(a.slice.end))}this.bounds_dirty_=!1}return this.bounds_},get duration(){return this.bounds_.isEmpty?0:this.bounds_.max-this.bounds_.min},get length(){return this.length_},clear:function(){for(var b=0;b<this.length_;++b)delete this[b];this.length_=0;this.bounds_dirty_=!0},pushHit:function(b){this.push_(b)},
push_:function(b){this[this.length_++]=b;this.bounds_dirty_=!0;return b},addSlice:function(b,a){return this.push_(new f(b,a))},addCounterSample:function(b,a,e){return this.push_(new c(b,a,e))},subSelection:function(b,d){d=d||1;var e=new a;e.bounds_dirty_=!0;if(0>b||b+d>this.length_)throw Error("Index out of bounds");for(var g=b;g<b+d;g++)e.push_(this[g]);return e},getCounterSampleHitsAsSelection:function(){for(var b=new a,d=0;d<this.length_;d++)this[d]instanceof c&&b.push_(this[d]);return b},getSliceHitsAsSelection:function(){for(var b=
new a,d=0;d<this.length_;d++)this[d]instanceof f&&b.push_(this[d]);return b},getNumSliceHits:function(){for(var b=0,a=0;a<this.length_;a++)this[a]instanceof f&&b++;return b},getNumCounterHits:function(){for(var b=0,a=0;a<this.length_;a++)this[a]instanceof c&&b++;return b},map:function(b){for(var a=0;a<this.length_;a++)b(this[a])},getShiftedSelection:function(b){for(var d=new a,e=0;e<this.length_;e++){var g=this[e];g.track.addItemNearToProvidedHitToSelection(g,b,d)}return 0==d.length?void 0:d}};return{TimelineSelectionSliceHit:f,
TimelineSelectionCounterSampleHit:c,TimelineSelection:a}});"use strict";base.require("event_target");
base.exportTo("tracing",function(){function f(a){this.parentEl_=a;this.scaleX_=1;this.gridTimebase_=this.panX_=0;this.gridStep_=1E3/60;this.hasCalledSetupFunction_=this.gridEnabled_=!1;this.onResizeBoundToThis_=this.onResize_.bind(this);this.checkForAttachInterval_=setInterval(this.checkForAttach_.bind(this),250);this.markers=[]}function c(a,b){this.viewport_=a;this.positionWorld_=b;this.selected_=!1}f.prototype={__proto__:base.EventTarget.prototype,drawUnderContent:function(){},drawOverContent:function(a,
b,d,e){if(this.gridEnabled){var g=this.gridTimebase;for(a.beginPath();g<d;){if(g>=b){var c=this.xWorldToView(g);a.moveTo(c,0);a.lineTo(c,e)}g+=this.gridStep}a.strokeStyle="rgba(255,0,0,0.25)";a.stroke()}for(g=0;g<this.markers.length;++g)this.markers[g].drawLine(a,b,d,e,this)},setWhenPossible:function(a){this.pendingSetFunction_=a},get isAttachedToDocument_(){for(var a=this.parentEl_;a.parentNode;)a=a.parentNode;return a==this.parentEl_.ownerDocument},onResize_:function(){this.dispatchChangeEvent()},
checkForAttach_:function(){if(this.isAttachedToDocument_&&0!=this.clientWidth){this.iframe_||(this.iframe_=document.createElement("iframe"),this.iframe_.style.cssText="position:absolute;width:100%;height:0;border:0;visibility:hidden;",this.parentEl_.appendChild(this.iframe_),this.iframe_.contentWindow.addEventListener("resize",this.onResizeBoundToThis_));var a=this.clientWidth+"x"+this.clientHeight;if(this.pendingSetFunction_){this.lastSize_=a;try{this.pendingSetFunction_()}catch(b){console.log("While running setWhenPossible:",
b)}this.pendingSetFunction_=void 0}window.clearInterval(this.checkForAttachInterval_);this.checkForAttachInterval_=void 0}},dispatchChangeEvent:function(){base.dispatchSimpleEvent(this,"change")},dispatchMarkersChangeEvent_:function(){base.dispatchSimpleEvent(this,"markersChange")},detach:function(){this.checkForAttachInterval_&&(window.clearInterval(this.checkForAttachInterval_),this.checkForAttachInterval_=void 0);this.iframe_&&(this.iframe_.removeEventListener("resize",this.onResizeBoundToThis_),
this.parentEl_.removeChild(this.iframe_))},get scaleX(){return this.scaleX_},set scaleX(a){this.scaleX_!=a&&(this.scaleX_=a,this.dispatchChangeEvent())},get panX(){return this.panX_},set panX(a){this.panX_!=a&&(this.panX_=a,this.dispatchChangeEvent())},setPanAndScale:function(a,b){if(this.scaleX_!=b||this.panX_!=a)this.scaleX_=b,this.panX_=a,this.dispatchChangeEvent()},xWorldToView:function(a){return(a+this.panX_)*this.scaleX_},xWorldVectorToView:function(a){return a*this.scaleX_},xViewToWorld:function(a){return a/
this.scaleX_-this.panX_},xViewVectorToWorld:function(a){return a/this.scaleX_},xPanWorldPosToViewPos:function(a,b,d){if("string"==typeof b)if("left"==b)b=0;else if("center"==b)b=d/2;else if("right"==b)b=d-1;else throw Error("unrecognized string for viewPos. left|center|right");this.panX=b/this.scaleX_-a},xPanWorldBoundsIntoView:function(a,b,d){0>this.xWorldToView(a)?this.xPanWorldPosToViewPos(a,"left",d):this.xWorldToView(b)>d&&this.xPanWorldPosToViewPos(b,"right",d)},xSetWorldBounds:function(a,b,
d){this.setPanAndScale(-a,d/(b-a))},get gridEnabled(){return this.gridEnabled_},set gridEnabled(a){this.gridEnabled_!=a&&(this.gridEnabled_=a&&!0,this.dispatchChangeEvent())},get gridTimebase(){return this.gridTimebase_},set gridTimebase(a){this.gridTimebase_!=a&&(this.gridTimebase_=a,base.dispatchSimpleEvent(this,"change"))},get gridStep(){return this.gridStep_},applyTransformToCanvas:function(a){a.transform(this.scaleX_,0,0,1,this.panX_*this.scaleX_,0)},addMarker:function(a){a=new c(this,a);this.markers.push(a);
this.dispatchChangeEvent();this.dispatchMarkersChangeEvent_();return a},removeMarker:function(a){for(var b=0;b<this.markers.length;++b)if(this.markers[b]===a)return this.markers.splice(b,1),this.dispatchChangeEvent(),this.dispatchMarkersChangeEvent_(),!0},findMarkerNear:function(a,b){for(var d=this.xViewVectorToWorld(b),e=0;e<this.markers.length;++e)if(Math.abs(this.markers[e].positionWorld-a)<=d)return this.markers[e]}};c.prototype={get positionWorld(){return this.positionWorld_},set positionWorld(a){this.positionWorld_=
a;this.viewport_.dispatchChangeEvent()},set selected(a){this.selected_=a;this.viewport_.dispatchChangeEvent()},get selected(){return this.selected_},get color(){return this.selected?"rgb(255,0,0)":"rgb(0,0,0)"},drawTriangle_:function(a,b,d,e,g,c){a.beginPath();var h=this.positionWorld_;h>=b&&h<d&&(b=c.xWorldToView(h),a.moveTo(b,g),a.lineTo(b-3,g/2),a.lineTo(b+3,g/2),a.lineTo(b,g),a.closePath(),a.fillStyle=this.color,a.fill(),g!=e&&(a.beginPath(),a.moveTo(b,g),a.lineTo(b,e),a.closePath(),a.strokeStyle=
this.color,a.stroke()))},drawLine:function(a,b,d,e,g){a.beginPath();var c=this.positionWorld_;c>=b&&c<d&&(b=g.xWorldToView(c),a.moveTo(b,0),a.lineTo(b,e));a.strokeStyle=this.color;a.stroke()}};return{TimelineViewport:f,TimelineViewportMarker:c}});
base.exportTo("base.ui",function(){function f(c,a){return(a&&a.ownerDocument?a.ownerDocument:base.doc).createElement(c)}return{decorate:function(c,a){var b;b="string"==typeof c?base.doc.querySelectorAll(c):[c];for(var d=0,e;e=b[d];d++)e instanceof a||a.decorate(e)},define:function(c){function a(e){var g=b(d,e);a.decorate(g);for(var c in e)g[c]=e[c];return g}var b,d;"function"==typeof c?(b=c,d=""):(b=f,d=c);a.decorate=function(b){b.__proto__=a.prototype;b.decorate()};return a},limitInputWidth:function(c,
a,b){function d(){if(c.scrollWidth>l)c.style.width=l+"px";else{c.style.width=0;var a=c.scrollWidth;c.style.width=a<b?b+"px":a+"px"}}c.style.width="10px";var e=c.ownerDocument.defaultView,g=e.getComputedStyle(c),e=e.getComputedStyle(a),k="rtl"==g.direction,h=c.getBoundingClientRect(),f=a.getBoundingClientRect(),h=k?f.right-h.right:h.left-f.left,g=parseInt(g.borderLeftWidth,10)+parseInt(g.paddingLeft,10)+parseInt(g.paddingRight,10)+parseInt(g.borderRightWidth,10),e=k?parseInt(e.paddingLeft,10):parseInt(e.paddingRight,
10),l=a.clientWidth-h-g-e;c.addEventListener("input",d);d()},toCssPx:function(c){window.isFinite(c)||console.error("Pixel value is not a number: "+c);return Math.round(c)+"px"}}});base.requireStylesheet("tracks.timeline_track");base.require("ui");
base.exportTo("tracks",function(){var f=base.ui.define("div");f.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){},get visible(){return"none"!==this.style.display},set visible(c){this.style.display=c?"":"none"},get numVisibleTracks(){return this.visible?1:0},addControlButtonElements_:function(c){var a=document.createElement("div");a.classList.add("timeline-track-button");a.classList.add("timeline-track-close-button");a.textContent=String.fromCharCode(215);var b=this;a.addEventListener("click",
function(){b.style.display="None"});this.appendChild(a);var d=document.createElement("div");d.classList.add("timeline-track-button");d.classList.add("timeline-track-collapse-button");d.textContent="\u2212";var e=!1;d.addEventListener("click",function(){e=!e;this.collapsedDidChange(e);d.textContent=e?"+":"\u2212"});this.appendChild(d);c||(d.style.display="None")}};return{TimelineTrack:f}});"use strict";base.require("tracks.timeline_track");base.require("timeline_filter");base.require("ui");
base.exportTo("tracks",function(){var f=base.ui.define(tracks.TimelineTrack);f.prototype={__proto__:tracks.TimelineTrack.prototype,decorate:function(){this.categoryFilter_=new tracing.TimelineFilter;this.headingWidth_=void 0;this.tracks_=[]},detach:function(){this.detachAllChildren()},detachAllChildren:function(){for(var c=0;c<this.tracks_.length;c++)this.tracks_[c].detach();this.tracks_=[];this.textContent=""},get viewport(){return this.viewport_},set viewport(c){this.viewport_=c;for(var a=0;a<this.tracks_.length;a++)this.tracks_[a].viewport=
c},get firstCanvas(){for(var c=0;c<this.tracks_.length;c++)if(this.tracks_[c].visible)return this.tracks_[c].firstCanvas},get numVisibleTracks(){return!this.visible?0:this.numVisibleChildTracks},get numVisibleChildTracks(){for(var c=0,a=0;a<this.tracks_.length;++a)c+=this.tracks_[a].numVisibleTracks;return c},get headingWidth(){return this.headingWidth_},set headingWidth(c){this.headingWidth_=c;for(var a=0;a<this.tracks_.length;++a)this.tracks_[a].headingWidth=c},get categoryFilter(){return this.categoryFilter_},
set categoryFilter(c){this.categoryFilter_=c;for(var a=0;a<this.tracks_.length;++a)this.tracks_[a].categoryFilter=c;this.applyCategoryFilter_();this.updateFirstVisibleChildCSS()},applyCategoryFilter_:function(){},addTrack_:function(c){c.headingWidth=this.headingWidth_;c.viewport=this.viewport_;c.categoryFilter=this.categoryFilter;this.tracks_.push(c);this.appendChild(c);return c},updateFirstVisibleChildCSS:function(){for(var c=!0,a=0;a<this.tracks_.length;++a){var b=this.tracks_[a];c&&b.visible?(b.classList.add("first-visible-child"),
c=!1):b.classList.remove("first-visible-child")}},addIntersectingItemsToSelection:function(c,a,b){for(var d=0;d<this.tracks_.length;d++){var e=this.tracks_[d].getBoundingClientRect();a>=e.top&&a<e.bottom&&this.tracks_[d].addIntersectingItemsToSelection(c,a,b)}return!1},addIntersectingItemsInRangeToSelection:function(c,a,b,d,e){for(var g=0;g<this.tracks_.length;g++){var k=this.tracks_[g].getBoundingClientRect(),h=Math.max(b,k.top),k=Math.min(d,k.bottom);h<=k&&this.tracks_[g].addIntersectingItemsInRangeToSelection(c,
a,b,d,e)}},addAllObjectsMatchingFilterToSelection:function(c,a){for(var b=0;b<this.tracks_.length;b++)this.tracks_[b].addAllObjectsMatchingFilterToSelection(c,a)}};return{TimelineContainerTrack:f}});
base.exportTo("tracing",function(){function f(c,a,b,d){this.ctx_=c;this.minRectSize_=a;this.maxMergeDist_=b;this.pallette_=d}f.prototype={y_:0,h_:0,merging_:!1,mergeStartX_:0,mergeCurRight_:0,setYandH:function(c,a){this.flush();this.y_=c;this.h_=a},fillRect:function(c,a,b){var d=c+a;a<this.minRectSize_?(d-this.mergeStartX_>this.maxMergeDist_&&this.flush(),this.merging_?(this.mergeCurRight_=d,this.mergedColorId=Math.max(this.mergedColorId,b)):(this.merging_=!0,this.mergeStartX_=c,this.mergeCurRight_=
d,this.mergedColorId=b)):(this.merging_&&this.flush(),this.ctx_.fillStyle=this.pallette_[b],this.ctx_.fillRect(c,this.y_,a,this.h_))},flush:function(){this.merging_&&(this.ctx_.fillStyle=this.pallette_[this.mergedColorId],this.ctx_.fillRect(this.mergeStartX_,this.y_,this.mergeCurRight_-this.mergeStartX_,this.h_),this.merging_=!1)}};return{FastRectRenderer:f}});"use strict";
base.exportTo("tracing",function(){function f(b){for(var a=0,d=0;d<b.length;++d)a=(a+37*a+11*b.charCodeAt(d))%4294967295;return a}var c=[{r:138,g:113,b:152},{r:175,g:112,b:133},{r:127,g:135,b:225},{r:93,g:81,b:137},{r:116,g:143,b:119},{r:178,g:214,b:122},{r:87,g:109,b:147},{r:119,g:155,b:95},{r:114,g:180,b:160},{r:132,g:85,b:103},{r:157,g:210,b:150},{r:148,g:94,b:86},{r:164,g:108,b:138},{r:139,g:191,b:150},{r:110,g:99,b:145},{r:80,g:129,b:109},{r:125,g:140,b:149},{r:93,g:124,b:132},{r:140,g:85,b:140},
{r:104,g:163,b:162},{r:132,g:141,b:178},{r:131,g:105,b:147},{r:135,g:183,b:98},{r:152,g:134,b:177},{r:141,g:188,b:141},{r:133,g:160,b:210},{r:126,g:186,b:148},{r:112,g:198,b:205},{r:180,g:122,b:195},{r:203,g:144,b:152},{r:182,g:125,b:143},{r:126,g:200,b:148},{r:133,g:160,b:210},{r:240,g:240,b:240}],a=c.length-4,b=c.length,d=c.concat(c.map(function(b){var a;a=240<=b.r&&240<=b.g&&240<=b.b?-0.2:0.45;return{r:Math.min(255,b.r+Math.floor(b.r*a)),g:Math.min(255,b.g+Math.floor(b.g*a)),b:Math.min(255,b.b+
Math.floor(b.b*a))}})).map(function(b){return"rgb("+b.r+","+b.g+","+b.b+")"}),e={};return{getColorPalette:function(){return d},getColorPaletteHighlightIdBoost:function(){return b},getColorIdByName:function(b){if("iowait"==b)return a;if("running"==b)return a+1;if("runnable"==b)return a+2;if("sleeping"==b)return a+3;throw Error("Unrecognized color ")+b;},getStringHash:f,getStringColorId:function(b){if(void 0===e[b]){var d=f(b);e[b]=d%a}return e[b]}}});"use strict";base.requireStylesheet("tracks.timeline_canvas_based_track");
base.require("tracks.timeline_track");base.require("fast_rect_renderer");base.require("timeline_color_scheme");base.require("ui");
base.exportTo("tracks",function(){var f=base.ui.define(tracks.TimelineTrack);f.prototype={__proto__:tracks.TimelineTrack.prototype,decorate:function(){this.className="timeline-canvas-based-track";this.slices_=null;this.headingDiv_=document.createElement("div");this.headingDiv_.className="timeline-canvas-based-track-title";this.appendChild(this.headingDiv_);this.canvasContainer_=document.createElement("div");this.canvasContainer_.className="timeline-canvas-based-track-canvas-container";this.appendChild(this.canvasContainer_);
this.canvas_=document.createElement("canvas");this.canvas_.className="timeline-canvas-based-track-canvas";this.canvasContainer_.appendChild(this.canvas_);this.ctx_=this.canvas_.getContext("2d")},detach:function(){this.viewport_&&(this.viewport_.removeEventListener("change",this.viewportChangeBoundToThis_),this.viewport_.removeEventListener("markersChange",this.viewportMarkersChangeBoundToThis_))},set headingWidth(c){this.headingDiv_.style.width=c},get heading(){return this.headingDiv_.textContent},
set heading(c){this.headingDiv_.textContent=c},set tooltip(c){this.headingDiv_.title=c},get viewport(){return this.viewport_},set viewport(c){if(this.viewport_=c)this.viewport_.removeEventListener("change",this.viewportChangeBoundToThis_),this.viewport_.removeEventListener("markersChange",this.viewportMarkersChangeBoundToThis_);if(this.viewport_=c)this.viewportChangeBoundToThis_=this.viewportChange_.bind(this),this.viewport_.addEventListener("change",this.viewportChangeBoundToThis_),this.viewportMarkersChangeBoundToThis_=
this.viewportMarkersChange_.bind(this),this.viewport_.addEventListener("markersChange",this.viewportMarkersChangeBoundToThis_),this.isAttachedToDocument_&&this.updateCanvasSizeIfNeeded_();this.invalidate()},viewportChange_:function(){this.invalidate()},viewportMarkersChange_:function(){2>this.viewport_.markers.length?this.classList.remove("timeline-viewport-track-with-distance-measurements"):this.classList.add("timeline-viewport-track-with-distance-measurements")},invalidate:function(){this.rafPending_||
(webkitRequestAnimationFrame(function(){this.rafPending_=!1;this.viewport_&&(this.updateCanvasSizeIfNeeded_(),this.redraw())}.bind(this),this),this.rafPending_=!0)},get isAttachedToDocument_(){var c=this.parentNode;if(c){for(;c.parentNode;)c=c.parentNode;return c==this.ownerDocument}},updateCanvasSizeIfNeeded_:function(){var c=window.getComputedStyle(this.canvasContainer_),a=parseInt(c.width)-parseInt(c.paddingLeft)-parseInt(c.paddingRight)-parseInt(c.borderLeftWidth)-parseInt(c.borderRightWidth),
c=parseInt(c.height)-parseInt(c.paddingTop)-parseInt(c.paddingBottom)-parseInt(c.borderTopWidth)-parseInt(c.borderBottomWidth),b=window.devicePixelRatio||1;this.canvas_.width!=a&&(this.canvas_.width=a*b,this.canvas_.style.width=a+"px");this.canvas_.height!=c&&(this.canvas_.height=c*b,this.canvas_.style.height=c+"px")},get firstCanvas(){return this.canvas_}};return{TimelineCanvasBasedTrack:f}});
base.exportTo("tracing",function(){function f(a,b,d){if(0==a.length)return 1;for(var e=0,g=a.length-1,c,h,f=-1;e<=g;)c=Math.floor((e+g)/2),h=b(a[c])-d,0>h?e=c+1:(0<h||(f=c),g=c-1);return-1!=f?f:e}function c(a,b,d,e,g,c){if(0!=a.length&&!(e>g)){var h=f(a,b,e);if(-1!=h&&(0<h&&b(a[h-1])+d(a[h-1])>=e&&c(a[h-1]),h!=a.length))for(d=a.length;h<d&&!(b(a[h])>=g);h++)c(a[h])}}return{findLowIndexInSortedArray:f,findLowIndexInSortedIntervals:function(a,b,d,e){var g=f(a,b,e);return 0==g?e>=b(a[0])&&e<b(a[0]+d(a[0]))?
0:-1:g<=a.length&&e>=b(a[g-1])&&e<b(a[g-1])+d(a[g-1])?g-1:a.length},iterateOverIntersectingIntervals:c,getIntersectingIntervals:function(a,b,d,e,g){var k=[];c(a,b,d,e,g,function(b){k.push(b)});return k}}});"use strict";base.requireStylesheet("tracks.timeline_slice_track");base.require("tracks.timeline_canvas_based_track");base.require("sorted_array_utils");base.require("fast_rect_renderer");base.require("timeline_color_scheme");base.require("ui");
base.exportTo("tracks",function(){function f(){}function c(b,a){this.string=b;this.width=a}var a=tracing.getColorPalette(),b=base.ui.define(tracks.TimelineCanvasBasedTrack);b.prototype={__proto__:tracks.TimelineCanvasBasedTrack.prototype,SHOULD_ELIDE_TEXT:!0,decorate:function(){this.classList.add("timeline-slice-track");this.elidedTitleCache=new f;this.asyncStyle_=!1},decorateHit:function(){},get asyncStyle(){return this.asyncStyle_},set asyncStyle(b){this.asyncStyle_=!!b;this.invalidate()},get slices(){return this.slices_},
set slices(b){this.slices_=b||[];b||(this.visible=!1);this.invalidate()},get height(){return window.getComputedStyle(this).height},set height(b){this.style.height=b;this.invalidate()},labelWidth:function(b){var a=e[b];a||(a=this.ctx_.measureText(b).width,e[b]=a);return a+2},labelWidthWorld:function(b,a){return this.labelWidth(b)*a},redraw:function(){var b=this.ctx_,e=this.canvas_.width,g=this.canvas_.height;b.clearRect(0,0,e,g);var c=this.viewport_,f=c.xViewVectorToWorld(1),m=c.xViewToWorld(0),e=
c.xViewToWorld(e);c.drawUnderContent(b,m,e,g);b.save();c.applyTransformToCanvas(b);this.asyncStyle_&&(b.globalAlpha=0.25);var p=new tracing.FastRectRenderer(b,2*f,2*f,a);p.setYandH(0,g);for(var q=this.slices_,s=tracing.findLowIndexInSortedArray(q,function(b){return b.start+b.duration},m),u=s;u<q.length;++u){var t=q[u],v=t.start;if(v>e)break;var w=Math.max(t.duration,0.001),x=t.selected?t.colorId+d:t.colorId;w<f&&(w=f);0<t.duration?p.fillRect(v,w,x):0.001<f?p.fillRect(v,f,x):(b.fillStyle=a[x],b.beginPath(),
b.moveTo(v-4*f,g),b.lineTo(v,0),b.lineTo(v+4*f,g),b.closePath(),b.fill())}p.flush();b.restore();p=window.devicePixelRatio||1;if(8<g){b.textAlign="center";b.textBaseline="top";b.font=10*p+"px sans-serif";b.strokeStyle="rgb(0,0,0)";b.fillStyle="rgb(0,0,0)";v=20*f;w=this.SHOULD_ELIDE_TEXT;for(u=s;u<q.length;++u){t=q[u];if(t.start>e)break;t.duration>v&&(s=t.title,t.didNotFinish&&(s+=" (Did Not Finish)"),x=this.labelWidth(s),w&&this.labelWidthWorld(s,f)>t.duration&&(x=this.elidedTitleCache.get(this,f,
s,x,t.duration),s=x.string,x=x.width),x*f<t.duration&&(t=c.xWorldToView(t.start+0.5*t.duration),b.fillText(s,t,2.5*p,x)))}}c.drawOverContent(b,m,e,g)},addIntersectingItemsToSelection:function(b,a,d){var e=this.getBoundingClientRect();if(a<e.top||a>=e.bottom)return!1;b=this.viewport_.xViewVectorToWorld(b*devicePixelRatio);b=tracing.findLowIndexInSortedIntervals(this.slices_,function(b){return b.start},function(b){return b.duration},b);return 0<=b&&b<this.slices_.length?(d=d.addSlice(this,this.slices_[b]),
this.decorateHit(d),!0):!1},addIntersectingItemsInRangeToSelection:function(b,a,d,e,g){function c(b){b=g.addSlice(q,b);q.decorateHit(b)}var f=window.devicePixelRatio||1;b=this.viewport_.xViewToWorld(b*f);a=this.viewport_.xViewToWorld(a*f);f=this.getBoundingClientRect();d=Math.max(d,f.top);e=Math.min(e,f.bottom);if(!(d>e)){var q=this;tracing.iterateOverIntersectingIntervals(this.slices_,function(b){return b.start},function(b){return b.duration},b,a,c)}},indexOfSlice_:function(b){for(var a=tracing.findLowIndexInSortedArray(this.slices_,
function(b){return b.start},b.start);a<this.slices_.length&&b.start==this.slices_[a].start&&b.colorId!=this.slices_[a].colorId;)a++;return a<this.slices_.length?a:void 0},addItemNearToProvidedHitToSelection:function(b,a,d){if(!b.slice)return!1;b=this.indexOfSlice_(b.slice);if(void 0===b)return!1;a=b+a;if(0>a||a>=this.slices_.length)return!1;b=d.addSlice(this,this.slices_[a]);this.decorateHit(b);return!0},addAllObjectsMatchingFilterToSelection:function(b,a){for(var d=0;d<this.slices_.length;++d)if(b.matchSlice(this.slices_[d])){var e=
a.addSlice(this,this.slices_[d]);this.decorateHit(e)}}};var d=tracing.getColorPaletteHighlightIdBoost(),e={},g={};f.prototype={get:function(b,a,d,e,f){var m=g[d];m||(m={},g[d]=m);e=m[a];e||(m[a]={},e=m[a]);m=e[f];if(void 0===m){for(m=!1;b.labelWidthWorld(d,a)>f;)d=d.substring(0,0.75*d.length),m=!0;m&&3<d.length&&(d=d.substring(0,d.length-3)+"...");m=new c(d,b.labelWidth(d));e[f]=m}return m}};return{TimelineSliceTrack:b}});"use strict";"use strict";base.exportTo("tracing",function(){var f=1;return{GUID:{allocate:function(){return f++}}}});
"use strict";base.exportTo("tracing",function(){function f(c,a,b,d,e,g){this.category=c||"";this.title=a;this.start=d;this.colorId=b;this.args=e;this.didNotFinish=!1;void 0!==g&&(this.duration=g)}f.prototype={selected:!1,duration:void 0,get end(){return this.start+this.duration}};return{TimelineSlice:f}});"use strict";base.require("range");base.require("timeline_slice");base.require("timeline_color_scheme");base.require("timeline_filter");
base.exportTo("tracing",function(){function f(a){this.sliceConstructor=a||c;this.openPartialSlices_=[];this.slices=[];this.bounds=new base.Range}var c=tracing.TimelineSlice;f.prototype={__proto__:Object.prototype,pushSlice:function(a){this.slices.push(a);return a},pushSlices:function(a){this.slices.push.apply(this.slices,a)},beginSlice:function(a,b,d,e){if(this.openPartialSlices_.length&&d<this.openPartialSlices_[this.openPartialSlices_.length-1].start)throw Error("Slices must be added in increasing timestamp order");
var g=tracing.getStringColorId(b);a=new this.sliceConstructor(a,b,g,d,e?e:{});this.openPartialSlices_.push(a);return a},isTimestampValidForBeginOrEnd:function(a){return!this.openPartialSlices_.length?!0:a>=this.openPartialSlices_[this.openPartialSlices_.length-1].start},get openSliceCount(){return this.openPartialSlices_.length},endSlice:function(a){if(!this.openSliceCount)throw Error("endSlice called without an open slice");var b=this.openPartialSlices_[this.openSliceCount-1];this.openPartialSlices_.splice(this.openSliceCount-
1,1);if(a<b.start)throw Error("Slice "+b.name+" end time is before its start.");b.duration=a-b.start;this.pushSlice(b);return b},autoCloseOpenSlices:function(a){a||(this.updateBounds(),a=this.bounds.max);for(;0<this.openSliceCount;)this.endSlice(a).didNotFinish=!0},shiftTimestampsForward:function(a){for(var b=0;b<this.slices.length;b++){var d=this.slices[b];d.start+=a}for(b=0;b<this.openPartialSlices_.length;b++)d=this.openPartialSlices_[i],d.start+=a},updateBounds:function(){this.bounds.reset();
for(var a=0;a<this.slices.length;a++)this.bounds.addValue(this.slices[a].start),this.bounds.addValue(this.slices[a].end);this.openPartialSlices_.length&&(this.bounds.addValue(this.openPartialSlices_[0].start),this.bounds.addValue(this.openPartialSlices_[this.openPartialSlices_.length-1].start))}};return{TimelineSliceGroup:f}});"use strict";base.require("range");base.require("timeline_slice");
base.exportTo("tracing",function(){function f(b,d,e,g,c){a.call(this,b,d,e,g,c)}function c(){this.slices=[];this.bounds=new base.Range}var a=tracing.TimelineSlice;f.prototype={__proto__:a.prototype,toJSON:function(){for(var b={},a=Object.keys(this),e=0;e<a.length;e++){var g=a[e];"function"!=typeof this[g]&&(b[g]="startThread"==g||"endThread"==g?this[g].guid:this[g])}return b},id:void 0,startThread:void 0,endThread:void 0,subSlices:void 0};c.prototype={__proto__:Object.prototype,push:function(b){this.slices.push(b)},
get length(){return this.slices.length},shiftTimestampsForward:function(b){for(var a=0;a<this.slices.length;a++){var e=this.slices[a];e.start+=b;for(var g=0;g<e.subSlices.length;g++)e.subSlices[g].start+=b}},updateBounds:function(){this.bounds.reset();for(var b=0;b<this.slices.length;b++)this.bounds.addValue(this.slices[b].start),this.bounds.addValue(this.slices[b].end)},computeSubGroups:function(){for(var b={},a=0;a<this.slices.length;++a){var e=this.slices[a],g=e.startThread.guid;b[g]||(b[g]=new c);
b[g].slices.push(e)}var a=[],k;for(k in b)e=b[k],e.updateBounds(),a.push(e);return a}};return{TimelineAsyncSlice:f,TimelineAsyncSliceGroup:c}});"use strict";base.require("range");base.require("timeline_guid");base.require("timeline_slice");base.require("timeline_slice_group");base.require("timeline_async_slice_group");
base.exportTo("tracing",function(){function f(b,d,c,f,j,l){a.call(this,b,d,c,f,j,l);this.subSlices=[]}function c(a,g){b.call(this,f);this.guid_=tracing.GUID.allocate();if(!a)throw Error("Parent must be provided.");this.parent=a;this.tid=g;this.cpuSlices=void 0;this.asyncSlices=new d;this.bounds=new base.Range}var a=tracing.TimelineSlice,b=tracing.TimelineSliceGroup,d=tracing.TimelineAsyncSliceGroup;f.prototype={__proto__:a.prototype};c.prototype={__proto__:b.prototype,get guid(){return this.guid_},
compareTo:function(b){return c.compare(this,b)},toJSON:function(){for(var b={},a=Object.keys(this),d=0;d<a.length;d++){var c=a[d];"function"!=typeof this[c]&&(b[c]="parent"==c?this[c].guid:this[c])}return b},name:void 0,shiftTimestampsForward:function(a){b.prototype.shiftTimestampsForward.call(this,a);if(this.cpuSlices)for(var d=0;d<this.cpuSlices.length;d++)this.cpuSlices[d].start+=a;this.asyncSlices.shiftTimestampsForward(a)},get isEmpty(){return this.slices.length||this.openSliceCount||this.cpuSlices&&
this.cpuSlices.length||this.asyncSlices.length?!1:!0},updateBounds:function(){b.prototype.updateBounds.call(this);this.asyncSlices.updateBounds();this.bounds.addRange(this.asyncSlices.bounds);this.cpuSlices&&this.cpuSlices.length&&(this.bounds.addValue(this.cpuSlices[0].start),this.bounds.addValue(this.cpuSlices[this.cpuSlices.length-1].end))},addCategoriesToDict:function(b){for(var a=0;a<this.slices.length;a++)b[this.slices[a].category]=!0;for(a=0;a<this.asyncSlices.length;a++)b[this.asyncSlices.slices[a].category]=
!0},get userFriendlyName(){return this.parent.userFriendlyName+": "+(this.name||this.tid)},get userFriendlyDetails(){return this.parent.userFriendlyDetails+", tid: "+this.tid+(this.name?", name: "+this.name:"")}};c.compare=function(b,a){var d=b.parent.compareTo(a.parent);return 0!=d?d:b.name&&a.name?(d=b.name.localeCompare(a.name),0==d?b.tid-a.tid:d):b.name?-1:a.name?1:b.tid-a.tid};return{TimelineThreadSlice:f,TimelineThread:c}});"use strict";base.require("timeline_guid");base.require("range");
base.exportTo("tracing",function(){function f(c,a,b,d){this.guid_=tracing.GUID.allocate();this.parent=c;this.id=a;this.category=b||"";this.name=d;this.seriesNames=[];this.seriesColors=[];this.timestamps=[];this.samples=[];this.bounds=new base.Range}f.prototype={__proto__:Object.prototype,get guid(){return this.guid_},toJSON:function(){for(var c={},a=Object.keys(this),b=0;b<a.length;b++){var d=a[b];"function"!=typeof this[d]&&(c[d]="parent"==d?this[d].guid:this[d])}return c},get numSeries(){return this.seriesNames.length},
get numSamples(){return this.timestamps.length},getSampleValue:function(c,a){return this.samples[c*this.numSeries+a]},getSampleStatistics:function(c){c.sort();for(var a=this.numSeries,b=[],d=0;d<a;++d){for(var e=0,g=Number.MAX_VALUE,k=-Number.MAX_VALUE,f=0;f<c.length;f++)var j=c[f],e=e+this.getSampleValue(j,d),g=Math.min(this.getSampleValue(j,d),g),k=Math.max(this.getSampleValue(j,d),k);e/=c.length;f=this.getSampleValue(c[0],d);j=this.getSampleValue(c[c.length-1],d);b.push({min:g,max:k,avg:e,start:f,
end:j})}return b},shiftTimestampsForward:function(c){for(var a=0;a<this.timestamps.length;a++)this.timestamps[a]+=c},updateBounds:function(){if(this.seriesNames.length!=this.seriesColors.length)throw Error("seriesNames.length must match seriesColors.length");if(this.numSeries*this.numSamples!=this.samples.length)throw Error("samples.length must be a multiple of numSamples.");this.totals=[];this.maxTotal=0;this.bounds.reset();if(0!=this.samples.length){this.bounds.addValue(this.timestamps[0]);this.bounds.addValue(this.timestamps[this.timestamps.length-
1]);for(var c=this.numSeries,a=-Infinity,b=0;b<this.timestamps.length;b++){for(var d=0,e=0;e<c;e++)d+=this.samples[b*c+e],this.totals.push(d);d>a&&(a=d)}this.maxTotal=a}}};f.compare=function(c,a){var b=c.parent.compareTo(a);if(0!=b)return b;b=c.name.localeCompare(a.name);return 0==b?c.tid-a.tid:b};return{TimelineCounter:f}});"use strict";base.require("range");base.require("timeline_guid");base.require("timeline_thread");base.require("timeline_counter");
base.exportTo("tracing",function(){function f(){this.guid_=tracing.GUID.allocate();this.threads={};this.counters={};this.bounds=new base.Range}var c=tracing.TimelineThread,a=tracing.TimelineCounter;f.prototype={get guid(){return this.guid_},get numThreads(){var b=0,a;for(a in this.threads)b++;return b},shiftTimestampsForward:function(b){for(var a in this.threads)this.threads[a].shiftTimestampsForward(b);for(var e in this.counters)this.counters[e].shiftTimestampsForward(b)},autoCloseOpenSlices:function(b){for(var a in this.threads)this.threads[a].autoCloseOpenSlices(b)},
updateBounds:function(){this.bounds.reset();for(var b in this.threads)this.threads[b].updateBounds(),this.bounds.addRange(this.threads[b].bounds);for(var a in this.counters)this.counters[a].updateBounds(),this.bounds.addRange(this.counters[a].bounds)},addCategoriesToDict:function(b){for(var a in this.threads)this.threads[a].addCategoriesToDict(b);for(var e in this.counters)b[this.counters[e].category]=!0},findAllThreadsNamed:function(b){var a=[],e;for(e in this.threads){var g=this.threads[e];g.name==
b&&a.push(g)}return a},pruneEmptyContainers:function(){var b={},a;for(a in this.threads){var e=this.threads[a];e.isEmpty||(b[a]=e)}this.threads=b},getOrCreateThread:function(b){this.threads[b]||(this.threads[b]=new c(this,b));return this.threads[b]},getOrCreateCounter:function(b,d){var e=b+"."+d;this.counters[e]||(this.counters[e]=new a(this,e,b,d));return this.counters[e]}};return{TimelineProcessBase:f}});"use strict";base.require("timeline_process_base");
base.exportTo("tracing",function(){function f(c){tracing.TimelineProcessBase.call(this);this.pid=c}f.compare=function(c,a){return c.pid-a.pid};f.prototype={__proto__:tracing.TimelineProcessBase.prototype,compareTo:function(c){return f.compare(this,c)},get userFriendlyName(){return this.pid},get userFriendlyDetails(){return"pid: "+this.pid}};return{TimelineProcess:f}});"use strict";base.require("timeline_process_base");
base.exportTo("tracing",function(){function f(){tracing.TimelineProcessBase.call(this)}f.compare=function(){return 0};f.prototype={__proto__:tracing.TimelineProcessBase.prototype,compareTo:function(c){return f.compare(this,c)},get userFriendlyName(){return"kernel"},get userFriendlyDetails(){return"kernel"}};return{TimelineKernel:f}});"use strict";base.require("range");base.require("timeline_slice");base.require("timeline_counter");
base.exportTo("tracing",function(){function f(a){this.cpuNumber=a;this.slices=[];this.counters={};this.bounds=new base.Range}var c=tracing.TimelineCounter;f.prototype={getOrCreateCounter:function(a,b){var d;d=a.length?a+"."+b:b;this.counters[d]||(this.counters[d]=new c(this,d,a,b));return this.counters[d]},shiftTimestampsForward:function(a){for(var b=0;b<this.slices.length;b++)this.slices[b].start+=a;for(var d in this.counters)this.counters[d].shiftTimestampsForward(a)},updateBounds:function(){this.bounds.reset();
this.slices.length&&(this.bounds.addValue(this.slices[0].start),this.bounds.addValue(this.slices[this.slices.length-1].end));for(var a in this.counters)this.counters[a].updateBounds(),this.bounds.addRange(this.counters[a].bounds)},addCategoriesToDict:function(a){for(var b=0;b<this.slices.length;b++)a[this.slices[b].category]=!0;for(var d in this.counters)a[this.counters[d].category]=!0}};f.compare=function(a,b){return a.cpuNumber-b.cpuNumber};return{TimelineCpu:f}});"use strict";base.require("range");
base.require("event_target");base.require("timeline_process");base.require("timeline_kernel");base.require("timeline_cpu");base.require("timeline_filter");
base.exportTo("tracing",function(){function f(a,d){this.kernel=new b;this.cpus={};this.processes={};this.importErrors=[];this.metadata=[];this.categories=[];this.bounds=new base.Range;a&&this.importTraces([a],d)}function c(){this.importPriority=0}var a=tracing.TimelineProcess,b=tracing.TimelineKernel,d=tracing.TimelineCpu,e=[];f.registerImporter=function(b){e.push(b)};f.prototype={__proto__:base.EventTarget.prototype,get numProcesses(){var b=0,a;for(a in this.processes)b++;return b},getOrCreateCpu:function(b){this.cpus[b]||
(this.cpus[b]=new d(b));return this.cpus[b]},getOrCreateProcess:function(b){this.processes[b]||(this.processes[b]=new a(b));return this.processes[b]},updateCategories_:function(){var b={};this.kernel.addCategoriesToDict(b);for(var a in this.processes)this.processes[a].addCategoriesToDict(b);for(var d in this.cpus)this.cpus[d].addCategoriesToDict(b);this.categories=[];for(var e in b)""!=e&&this.categories.push(e)},updateBounds:function(){this.bounds.reset();this.kernel.updateBounds();this.bounds.addRange(this.kernel.bounds);
for(var b in this.processes)this.processes[b].updateBounds(),this.bounds.addRange(this.processes[b].bounds);for(var a in this.cpus)this.cpus[a].updateBounds(),this.bounds.addRange(this.cpus[a].bounds)},shiftWorldToZero:function(){if(!this.bounds.isEmpty){var b=this.bounds.min;this.kernel.shiftTimestampsForward(-b);for(var a in this.processes)this.processes[a].shiftTimestampsForward(-b);for(var d in this.cpus)this.cpus[d].shiftTimestampsForward(-b);this.updateBounds()}},getAllThreads:function(){var b=
[],a;for(a in this.kernel.threads)b.push(e.threads[a]);for(var d in this.processes){var e=this.processes[d];for(a in e.threads)b.push(e.threads[a])}return b},getAllCpus:function(){var b=[],a;for(a in this.cpus)b.push(this.cpus[a]);return b},getAllProcesses:function(){var b=[],a;for(a in this.processes)b.push(this.processes[a]);return b},getAllCounters:function(){var b=[],a;for(a in this.processes){var d=this.processes[a],e;for(e in d.counters)b.push(d.counters[e])}for(var c in this.cpus){a=this.cpus[c];
for(var f in a.counters)b.push(a.counters[f])}return b},findAllThreadsNamed:function(b){var a=[];a.push.apply(a,this.kernel.findAllThreadsNamed(b));for(var d in this.processes)a.push.apply(a,this.processes[d].findAllThreadsNamed(b));return a},createImporter_:function(b){for(var a,d=0;d<e.length;++d)if(e[d].canImport(b)){a=e[d];break}if(!a)throw Error("Could not find an importer for the provided eventData.");return new a(this,b)},importTraces:function(b,a){void 0===a&&(a=!0);for(var d=[],e=0;e<b.length;++e)d.push(this.createImporter_(b[e]));
d.sort(function(b,a){return b.importPriority-a.importPriority});for(e=0;e<d.length;e++)d[e].importEvents(0<e);this.updateBounds();this.kernel.autoCloseOpenSlices(this.bounds.max);for(var c in this.processes)this.processes[c].autoCloseOpenSlices(this.bounds.max);for(e=0;e<d.length;e++)d[e].finalizeImport();this.kernel.pruneEmptyContainers();for(c in this.processes)this.processes[c].pruneEmptyContainers();this.updateBounds();this.updateCategories_();a&&this.shiftWorldToZero()}};c.canImport=function(b){return b instanceof
Array&&0==b.length?!0:"string"===typeof b||b instanceof String?0==b.length:!1};c.prototype={__proto__:Object.prototype,importEvents:function(){},finalizeImport:function(){}};f.registerImporter(c);return{TimelineModel:f}});"use strict";base.require("tracks.timeline_container_track");base.require("tracks.timeline_slice_track");base.require("timeline_filter");base.require("timeline_model");base.require("ui");
base.exportTo("tracks",function(){var f=base.ui.define(tracks.TimelineContainerTrack);f.prototype={__proto__:tracks.TimelineContainerTrack.prototype,decorate:function(){this.classList.add("timeline-cpu-track")},get cpu(){return this.cpu_},set cpu(c){this.cpu_=c;this.updateChildTracks_()},get tooltip(){return this.tooltip_},set tooltip(c){this.tooltip_=c;this.updateChildTracks_()},get heading(){return this.heading_},set heading(c){this.heading_=c;this.updateChildTracks_()},applyCategoryFilter_:function(){this.categoryFilter.matchCpu(this.cpu_)?
this.updateChildTracks_():this.visible=!1},updateChildTracks_:function(){this.detach();if(this.cpu_){var c=tracing.filterSliceArray(this.categoryFilter_,this.cpu_.slices);if(c.length){var a=new tracks.TimelineSliceTrack;a.slices=c;a.heading=this.heading_;a.tooltip=this.tooltip_;this.addTrack_(a)}for(var b in this.cpu_.counters)c=this.cpu_.counters[b],a=new tracks.TimelineCounterTrack,a.heading="CPU "+this.cpu_.cpuNumber+" "+c.name+":",a.counter=c,this.addTrack_(a)}this.addControlButtonElements_(!1)}};
return{TimelineCpuTrack:f}});"use strict";base.requireStylesheet("tracks.timeline_counter_track");base.require("tracks.timeline_canvas_based_track");base.require("timeline_color_scheme");base.require("ui");
base.exportTo("tracks",function(){var f=tracing.getColorPalette(),c=base.ui.define(tracks.TimelineCanvasBasedTrack);c.prototype={__proto__:tracks.TimelineCanvasBasedTrack.prototype,decorate:function(){this.classList.add("timeline-counter-track");this.addControlButtonElements_(!1);this.selectedSamples_={};this.categoryFilter_=new tracing.TimelineFilter},decorateHit:function(){},get counter(){return this.counter_},set counter(a){this.counter_=a;this.invalidate();this.updateVisibility_()},set categoryFilter(a){this.categoryFilter_=
a;this.updateVisibility_()},get selectedSamples(){return this.selectedSamples_},updateVisibility_:function(){this.visible=this.counter_&&this.categoryFilter_.matchCounter(this.counter_)},redraw:function(){var a=this.counter_,b=this.ctx_,d=this.canvas_.width,e=this.canvas_.height;b.clearRect(0,0,d,e);var g=this.viewport_,c=g.xViewVectorToWorld(1),h=g.xViewToWorld(0),d=g.xViewToWorld(d);g.drawUnderContent(b,h,d,e);var j=g.xViewVectorToWorld(1);b.save();g.applyTransformToCanvas(b);for(var l=a.numSeries,
r=a.numSamples,m=tracing.findLowIndexInSortedArray(a.timestamps,function(b){return b},h),m=0<m-1?m-1:0,p=e/a.maxTotal,q=a.numSeries-1;0<=q;q--){b.fillStyle=f[a.seriesColors[q]];b.beginPath();for(var s=m-1,u=0<=s?a.timestamps[s]-j:-1,t=e,v=!1;;){var w=s+1;if(w>=r){b.lineTo(u,t);b.lineTo(u+8*c,t);b.lineTo(u+8*c,e);break}var x=a.timestamps[w],s=a.totals[w*l+q],y=e-p*s;if(x>d){b.lineTo(x,t);b.lineTo(x,e);break}x-u<j?s=w:(v||(b.moveTo(h,e),v=!0),b.lineTo(x,t),b.lineTo(x,y),s=w,u=x,t=y)}b.closePath();b.fill()}b.fillStyle=
"rgba(255, 0, 0, 1)";for(w in this.selectedSamples_)if(this.selectedSamples_[w]){x=a.timestamps[w];for(q=a.numSeries-1;0<=q;q--)s=a.totals[w*l+q],y=e-p*s,b.fillRect(x-c,y-1,3*c,3)}b.restore();g.drawOverContent(b,h,d,e)},addIntersectingItemsToSelection:function(a,b,d){var e=this.getBoundingClientRect();if(b<e.top||b>=e.bottom)return!1;b=this.viewport_.xViewVectorToWorld(a*devicePixelRatio);e=this.counter_;if(a<this.counter_.timestamps[0])return!1;a=tracing.findLowIndexInSortedArray(e.timestamps,function(b){return b},
b);if(0>a||a>=e.timestamps.length)return!1;0<a&&b>this.counter_.timestamps[a-1]&&a--;this.getBoundingClientRect();d=d.addCounterSample(this,this.counter,a);this.decorateHit(d);return!0},addIntersectingItemsInRangeToSelection:function(a,b,d,e,g){var c=this.getBoundingClientRect();d=Math.max(d,c.top);e=Math.min(e,c.bottom);if(!(d>e)){e=this.counter_;c=window.devicePixelRatio||1;a=this.viewport_.xViewToWorld(a*c);c=this.viewport_.xViewToWorld(b*c);d=tracing.findLowIndexInSortedArray(e.timestamps,function(b){return b},
a);b=tracing.findLowIndexInSortedArray(e.timestamps,function(b){return b},c);0<d&&a>e.timestamps[d-1]&&d--;0<b&&c>e.timestamps[b-1]&&b--;for(a=d;a<=b;a++)a>=e.timestamps.length||(c=g.addCounterSample(this,this.counter,a),this.decorateHit(c))}},addAllObjectsMatchingFilterToSelection:function(){}};return{TimelineCounterTrack:c}});"use strict";base.require("tracks.timeline_container_track");base.require("sorted_array_utils");base.require("ui");
base.exportTo("tracks",function(){var f=base.ui.define(tracks.TimelineContainerTrack);f.prototype={__proto__:tracks.TimelineContainerTrack.prototype,decorate:function(){this.classList.add("timeline-slice-group-track")},get group(){return this.group_},set group(c){this.group_=c;this.updateChildTracks_()},set heading(c){this.tracks_.length&&(this.tracks_[0].heading=c)},set tooltip(c){this.tracks_.length&&(this.tracks_[0].tooltip=c)},set decorateHit(c){this.decorateHit_=c;this.updateChildTracks_()},
applyCategoryFilter_:function(){this.updateChildTracks_()},addSliceTrack_:function(c){var a=new tracks.TimelineSliceTrack;a.slices=c;a.decorateHit=this.decorateHit_;this.addTrack_(a);return a},updateChildTracks_:function(){if(this.group_){var c=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);if(c.length){if(this.visible=!0,!this.areArrayContentsSame_(this.filteredSlices_,c)){this.filteredSlices_=c;this.detach();this.subRows_=this.buildSubRows_(c);for(c=0;c<this.subRows_.length;c++)this.subRows_[c].length&&
this.addSliceTrack_(this.subRows_[c])}}else this.visible=!1}else this.visible=!1},buildSubRows_:function(c){if(!c.length)return[];for(var a=[],b=0;b<c.length;b++)c[b].subSlices&&c[b].subSlices.splice(0,c[b].subSlices.length),a.push(b);a.sort(function(b,a){var d=c[b],e=c[a];return d.start!=e.start?d.start-e.start:a-b});var d=[[]];this.badSlices_=[];for(b=0;b<a.length;b++){for(var e=c[a[b]],g=!1,f=d.length-1;0<=f;f--)if(0!=d[f].length){var h=d[f][d[f].length-1];e.start<h.start&&(this.badSlices_.push(e),
g=!0);if(e.start>=h.start&&e.end<=h.end){for(;d.length<=f+1;)d.push([]);d[f+1].push(e);h.subSlices&&h.subSlices.push(e);g=!0;break}}g||d[0].push(e)}return d},areArrayContentsSame_:function(c,a){if(!c||!a||(!c.length||!a.length)||c.length!=a.length)return!1;for(var b=0;b<c.length;++b)if(c[b]!=a[b])return!1;return!0}};return{TimelineSliceGroupTrack:f}});"use strict";base.require("tracks.timeline_slice_group_track");base.require("ui");
base.exportTo("tracks",function(){var f=base.ui.define(tracks.TimelineSliceGroupTrack);f.prototype={__proto__:tracks.TimelineSliceGroupTrack.prototype,decorate:function(){this.classList.add("timeline-async-slice-group-track")},addSliceTrack_:function(c){c=tracks.TimelineSliceGroupTrack.prototype.addSliceTrack_.call(this,c);c.asyncStyle=!0;return c},buildSubRows_:function(){var c=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);c.sort(function(b,a){return b.start-a.start});for(var a=
[],b=0;b<c.length;b++){for(var d=c[b],e=!1,g=0;g<a.length;g++){var f=a[g];if(d.start>=f[f.length-1].end){e=!0;if(void 0===d.subSlices||1>d.subSlices.length)throw Error("TimelineAsyncEvent missing subSlices: ")+d.name;for(g=0;g<d.subSlices.length;g++)f.push(d.subSlices[g]);break}}if(!e&&(f=[],void 0!==d.subSlices)){for(g=0;g<d.subSlices.length;g++)f.push(d.subSlices[g]);a.push(f)}}return a}};return{TimelineAsyncSliceGroupTrack:f}});"use strict";base.requireStylesheet("tracks.timeline_thread_track");
base.require("tracks.timeline_container_track");base.require("tracks.timeline_slice_track");base.require("tracks.timeline_slice_group_track");base.require("tracks.timeline_async_slice_group_track");base.require("timeline_filter");base.require("ui");
base.exportTo("tracks",function(){var f=base.ui.define(tracks.TimelineContainerTrack);f.prototype={__proto__:tracks.TimelineContainerTrack.prototype,decorate:function(){this.classList.add("timeline-thread-track");this.categoryFilter_=new tracing.TimelineFilter},get thread(){return this.thread_},set thread(c){this.thread_=c;this.updateChildTracks_()},get tooltip(){return this.tooltip_},set tooltip(c){this.tooltip_=c;this.updateChildTracks_()},get heading(){return this.heading_},set heading(c){this.heading_=
c;this.updateChildTracks_()},applyCategoryFilter_:function(){this.updateVisibility_()},updateChildTracks_:function(){this.detach();if(this.thread_){var c=new tracks.TimelineSliceTrack;c.heading="";c.slices=this.thread_.cpuSlices;c.height="4px";c.decorateHit=function(a){a.thread=this.thread_};this.addTrack_(c);c=new tracks.TimelineAsyncSliceGroupTrack;c.categoryFilter=this.categoryFilter;c.decorateHit=function(){};c.group=this.thread_.asyncSlices;this.addTrack_(c);c=new tracks.TimelineSliceGroupTrack;
c.decorateHit=function(a){a.thread=this.thread_};c.group=this.thread_;this.addTrack_(c);this.updateVisibility_()}this.addControlButtonElements_(4<=this.tracks_.length)},updateVisibility_:function(){if(this.categoryFilter.matchThread(this.thread)){for(var c=!1,a=0;a<this.tracks_.length;++a){var b=this.tracks_[a];if(b.visible&&(c=!0,1<=a)){b.heading=this.heading_;b.tooltip=this.tooltip_;break}}this.visible=c}else this.visible=!1},collapsedDidChange:function(c){if(c){c=parseInt(this.tracks_[0].height);
for(var a=0;a<this.tracks_.length;++a)2<c?this.tracks_[a].height=Math.floor(c)+"px":this.tracks_[a].style.display="none",c*=0.5}else for(a=0;a<this.tracks_.length;++a)this.tracks_[a].height=this.tracks_[0].height,this.tracks_[a].style.display=""}};return{TimelineThreadTrack:f}});"use strict";base.require("tracks.timeline_container_track");base.require("tracks.timeline_counter_track");base.require("tracks.timeline_thread_track");base.require("timeline_filter");base.require("ui");
base.exportTo("tracks",function(){var f=base.ui.define(tracks.TimelineContainerTrack);f.prototype={__proto__:tracks.TimelineContainerTrack.prototype,decorate:function(){this.classList.add("timeline-process-track");this.categoryFilter_=new tracing.TimelineFilter},get process(){return this.process_},set process(c){this.process_=c;this.updateChildTracks_()},applyCategoryFilter_:function(){this.visible=this.categoryFilter.matchProcess(this.process)&&!!this.numVisibleChildTracks},updateChildTracks_:function(){this.detach();
if(this.process_){var c=[],a;for(a in this.process.counters)c.push(this.process.counters[a]);c.sort(tracing.TimelineCounter.compare);c.forEach(function(b){var a=new tracks.TimelineCounterTrack;a.heading=b.name+":";a.counter=b;this.addTrack_(a)}.bind(this));c=[];for(a in this.process.threads)c.push(this.process.threads[a]);c.sort(tracing.TimelineThread.compare);c.forEach(function(b){var a=new tracks.TimelineThreadTrack;a.heading=b.userFriendlyName+":";a.tooltip=b.userFriendlyDetails;a.thread=b;this.addTrack_(a)}.bind(this))}}};
return{TimelineProcessTrack:f}});"use strict";base.requireStylesheet("tracks.timeline_model_track");base.require("tracks.timeline_container_track");base.require("tracks.timeline_cpu_track");base.require("tracks.timeline_process_track");base.require("ui");
base.exportTo("tracks",function(){var f=base.ui.define(tracks.TimelineContainerTrack);f.prototype={__proto__:tracks.TimelineContainerTrack.prototype,decorate:function(){this.classList.add("timeline-model-track");this.measuringStick_=new tracing.MeasuringStick;this.measuringStick_.attach()},detach:function(){tracks.TimelineContainerTrack.prototype.detach.call(this);this.measuringStick_.detach()},get model(){return this.model_},set model(c){this.model_=c;this.updateHeadingWidth_();this.updateChildTracks_()},
updateHeadingWidth_:function(){var c=[];this.model.getAllThreads().forEach(function(b){c.push(b.userFriendlyName)});this.model.getAllCounters().forEach(function(b){c.push(b.name)});this.model.getAllCpus().forEach(function(b){c.push("CPU "+b.cpuNumber)});var a=0,b=document.createElement("div");b.style.position="fixed";b.className="timeline-canvas-based-track-title";for(var d=0;d<c.length;d++){b.textContent=c[d]+":__";var e=this.measuringStick_.measure(b).width;300<e&&(e=300);e>a&&(a=e)}this.headingWidth=
a+"px"},updateChildTracks_:function(){this.detachAllChildren();if(this.model_){var c=this.model_.getAllCpus();c.sort(tracing.TimelineCpu.compare);for(var a=0;a<c.length;++a){var b=c[a],d=new tracks.TimelineCpuTrack;d.heading="CPU "+b.cpuNumber+":";d.cpu=b;this.addTrack_(d)}c=this.model_.getAllProcesses();c.sort(tracing.TimelineProcess.compare);for(a=0;a<c.length;++a)b=c[a],d=new tracks.TimelineProcessTrack,d.process=b,this.addTrack_(d)}}};return{TimelineModelTrack:f}});"use strict";base.requireStylesheet("tracks.timeline_viewport_track");
base.require("tracks.timeline_track");base.require("tracks.timeline_canvas_based_track");base.require("ui");
base.exportTo("tracks",function(){var f=base.ui.define(tracks.TimelineCanvasBasedTrack),c=Math.log(10);f.prototype={__proto__:tracks.TimelineCanvasBasedTrack.prototype,decorate:function(){this.classList.add("timeline-viewport-track");this.strings_secs_=[];this.strings_msecs_=[];this.addEventListener("mousedown",this.onMouseDown)},onMouseDown:function(a){0==a.button&&this.placeAndBeginDraggingMarker(a.clientX)},placeAndBeginDraggingMarker:function(a){a=this.viewport_.xViewToWorld(a-this.canvasContainer_.offsetLeft);
var b=this.viewport_.findMarkerNear(a,6),d=!1,e=!1;b||(b=this.viewport_.addMarker(a),d=!0);b.selected=!0;var g=this,c=function(a){a=g.viewport_.xViewToWorld(a.clientX-g.canvasContainer_.offsetLeft);b.positionWorld=a;e=!0},f=function(){b.selected=!1;!e&&!d&&g.viewport_.removeMarker(b);document.removeEventListener("mouseup",f);document.removeEventListener("mousemove",c)};document.addEventListener("mouseup",f);document.addEventListener("mousemove",c)},drawLine_:function(a,b,d,e,g,c){a.beginPath();a.moveTo(b,
d);a.lineTo(e,g);a.closePath();a.strokeStyle=c;a.stroke()},drawArrow_:function(a,b,d,e,g,c,f){this.drawLine_(a,b,d,e,g,f);var j=e-b,l=g-d,r=Math.sqrt(j*j+l*l),m=(r-10)/r;b+=m*j;d+=m*l;l=l/r*c;c*=-(j/r);a.beginPath();a.fillStyle=f;a.moveTo(b+l,d+c);a.lineTo(e,g);a.lineTo(b-l,d-c);a.lineTo(b+l,d+c);a.closePath();a.fill()},redraw:function(){var a=this.ctx_,b=this.canvas_.width,d=this.canvas_.height;a.clearRect(0,0,b,d);var e=this.viewport_;e.xViewVectorToWorld(1);for(var g=e.xViewToWorld(0),f=e.xViewToWorld(b),
h=this.classList.contains("timeline-viewport-track-with-distance-measurements"),j=h?d/2:d,l=0;l<e.markers.length;++l)e.markers[l].drawTriangle_(a,g,f,d,j,e);var l=e.xViewVectorToWorld(150),r,m,p,q;m=Math.pow(10,Math.ceil(Math.log(l)/c));p=[10,5,2,1];for(l=0;l<p.length;++l)if(!(150>e.xWorldVectorToView(m/p[l]))){r=m/p[l-1];break}q=void 0;100>r?(m="ms",p=1,q=this.strings_msecs_):(m="s",p=1E3,q=this.strings_secs_);var s=e.xWorldVectorToView(r/5),l=Math.floor(g/r)*r,d=Math.floor(0.25*d);a.fillStyle="rgb(0, 0, 0)";
a.strokeStyle="rgb(0, 0, 0)";a.textAlign="left";a.textBaseline="top";g=window.devicePixelRatio||1;a.font=9*g+"px sans-serif";for(var u=l;u<f;u+=r){var t=Math.floor(e.xWorldToView(u)),l=Math.floor(1E5*(u/p))/1E5;q[l]||(q[l]=l+" "+m);a.fillText(q[l],t+2*g,0);a.beginPath();a.moveTo(t,0);a.lineTo(t,j);for(l=1;5>l;++l){var v=Math.floor(t+s*l);a.moveTo(v,j-d);a.lineTo(v,j)}a.stroke()}if(h){a.moveTo(0,j);a.lineTo(b,j);a.stroke();b=e.markers.slice();b.sort(function(b,a){return b.positionWorld_-a.positionWorld_});
j+=2;f=j+4;for(l=0;l<b.length-1;l++)q=b[l+1],s=b[l],d=q.positionWorld-s.positionWorld,r=e.xWorldVectorToView(d),h=e.xWorldToView(s.positionWorld+d/2),100>d?(m="ms",p=1):(m="s",p=1E3),p=d/p,m=Math.abs(Math.floor(1E3*p)/1E3)+" "+m,p=a.measureText(m).width,g=e.xViewVectorToWorld(p),p=p+26+10,u=s.positionWorld+d/2-g/2,t=u+g,d=j,g=e.xWorldToView(u),u=e.xWorldToView(t),s=e.xWorldToView(s.positionWorld),q=e.xWorldToView(q.positionWorld),t=!1,p<=r&&(a.fillStyle="rgb(0,0,0)",a.fillText(m,g,d),t=!0),26<=r&&
(t?(m=g-10,p=u+10):p=m=h,this.drawArrow_(a,m,f,s,f,3,"rgb(128,121,121)"),this.drawArrow_(a,p,f,q,f,3,"rgb(128,121,121)"))}},addIntersectingItemsToSelection:function(){},addIntersectingItemsInRangeToSelection:function(){},addAllObjectsMatchingFilterToSelection:function(){}};return{TimelineViewportTrack:f}});"use strict";base.requireStylesheet("timeline");base.require("event_target");base.require("measuring_stick");base.require("timeline_filter");base.require("timeline_selection");base.require("timeline_viewport");
base.require("tracks.timeline_model_track");base.require("tracks.timeline_viewport_track");base.require("ui");
base.exportTo("tracing",function(){var f=tracing.TimelineSelection,c=tracing.TimelineViewport,a=base.ui.define("div");a.prototype={__proto__:HTMLDivElement.prototype,model_:null,decorate:function(){this.classList.add("timeline");this.categoryFilter_=new tracing.TimelineCategoryFilter;this.viewport_=new c(this);this.viewportTrack_=new tracks.TimelineViewportTrack;this.viewportTrack_.viewport=this.viewport_;this.appendChild(this.viewportTrack_);this.modelTrackContainer_=document.createElement("div");
this.modelTrackContainer_.className="timeline-model-track-container";this.appendChild(this.modelTrackContainer_);this.modelTrack_=new tracks.TimelineModelTrack;this.modelTrackContainer_.appendChild(this.modelTrack_);this.dragBox_=this.ownerDocument.createElement("div");this.dragBox_.className="timeline-drag-box";this.appendChild(this.dragBox_);this.hideDragBox_();this.bindEventListener_(document,"keypress",this.onKeypress_,this);this.bindEventListener_(document,"keydown",this.onKeydown_,this);this.bindEventListener_(document,
"keyup",this.onKeyup_,this);this.bindEventListener_(document,"mousemove",this.onMouseMove_,this);this.bindEventListener_(document,"mouseup",this.onMouseUp_,this);this.addEventListener("mousewheel",this.onMouseWheel_);this.addEventListener("mousedown",this.onMouseDown_);this.addEventListener("dblclick",this.onDblClick_);this.lastMouseViewPos_={x:0,y:0};this.maxHeadingWidth_=0;this.selection_=new f},bindEventListener_:function(b,a,e,g){this.boundListeners_||(this.boundListeners_=[]);e=e.bind(g);this.boundListeners_.push({object:b,
event:a,boundFunc:e});b.addEventListener(a,e)},detach:function(){this.modelTrack_.detach();for(var b=0;b<this.boundListeners_.length;b++){var a=this.boundListeners_[b];a.object.removeEventListener(a.event,a.boundFunc)}this.boundListeners_=void 0;this.viewport_.detach()},get viewport(){return this.viewport_},get categoryFilter(){return this.categoryFilter_},set categoryFilter(b){this.categoryFilter_=b;this.modelTrack_.categoryFilter=b},get model(){return this.model_},set model(b){if(!b)throw Error("Model cannot be null");
var a=this.model_!=b;this.model_=b;this.modelTrack_.model=b;this.modelTrack_.viewport=this.viewport_;this.modelTrack_.categoryFilter=this.categoryFilter;this.viewportTrack_.headingWidth=this.modelTrack_.headingWidth;a&&this.viewport_.setWhenPossible(this.setInitialViewport_.bind(this))},get numVisibleTracks(){return this.modelTrack_.numVisibleTracks},setInitialViewport_:function(){var b=0.15*(this.model_.bounds.max-this.model_.bounds.min);this.viewport_.xSetWorldBounds(this.model_.bounds.min-b,this.model_.bounds.max+
b,this.firstCanvas.width)},addAllObjectsMatchingFilterToSelection:function(b,a){this.modelTrack_.addAllObjectsMatchingFilterToSelection(b,a)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},set focusElement(b){this.focusElement_=b},get listenToKeys_(){return!this.viewport_.isAttachedToDocument_||this.activeElement instanceof tracing.TimelineFindControl?!1:!this.focusElement_?!0:0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0},onKeypress_:function(b){var a=
this.viewport_;if(this.firstCanvas&&this.listenToKeys_&&"INPUT"!=document.activeElement.nodeName){var e=this.firstCanvas.clientWidth;switch(b.keyCode){case 119:case 44:this.zoomBy_(1.5);break;case 115:case 111:this.zoomBy_(1/1.5);break;case 103:this.onGridToggle_(!0);break;case 71:this.onGridToggle_(!1);break;case 87:case 60:this.zoomBy_(10);break;case 83:case 79:this.zoomBy_(0.1);break;case 97:a.panX+=a.xViewVectorToWorld(0.1*e);break;case 100:case 101:a.panX-=a.xViewVectorToWorld(0.1*e);break;case 65:a.panX+=
a.xViewVectorToWorld(0.5*e);break;case 68:a.panX-=a.xViewVectorToWorld(0.5*e);break;case 48:case 122:this.setInitialViewport_();break;case 102:this.zoomToSelection_()}}},onMouseWheel_:function(b){if(b.altKey){var a=Math.pow(1.5,b.wheelDeltaY/120);this.zoomBy_(a);b.preventDefault()}},onKeydown_:function(b){if(this.listenToKeys_){var a,e=this.viewport_,g=this.firstCanvas.clientWidth;switch(b.keyCode){case 37:if(a=this.selection.getShiftedSelection(-1))this.setSelectionAndMakeVisible(a),b.preventDefault();
else{if(!this.firstCanvas)return;e.panX+=e.xViewVectorToWorld(0.1*g)}break;case 39:if(a=this.selection.getShiftedSelection(1))this.setSelectionAndMakeVisible(a),b.preventDefault();else{if(!this.firstCanvas)return;e.panX-=e.xViewVectorToWorld(0.1*g)}break;case 9:-1==this.focusElement.tabIndex&&(b.shiftKey?this.selectPrevious_(b):this.selectNext_(b),b.preventDefault())}b.shiftKey&&this.dragBeginEvent_&&(b=b.shiftKey,this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,
this.dragBoxXEnd_,this.dragBoxYEnd_,b))}},onKeyup_:function(b){this.listenToKeys_&&(b.shiftKey||this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_,b.shiftKey))},zoomBy_:function(b){if(this.firstCanvas){var a=this.viewport_,e=this.firstCanvas.clientWidth,g=this.lastMouseViewPos_.x*(window.devicePixelRatio||1),c=a.xViewToWorld(g);a.scaleX*=b;a.xPanWorldPosToViewPos(c,g,e)}},zoomToSelection_:function(){if(this.selection){var b=this.selection.bounds,
a=b.min+0.5*(b.max-b.min),b=0.5*(b.max-b.min),e=0.15*b;this.viewport_.xSetWorldBounds(a-b-e,a+b+e,this.firstCanvas.width)}},get keyHelp(){var b="Qwerty Controls\n w/s : Zoom in/out (with shift: go faster)\n a/d : Pan left/right\n\nDvorak Controls\n ,/o : Zoom in/out (with shift: go faster)\n a/e : Pan left/right\n\nMouse Controls\n drag : Select slices (with "+(0==navigator.platform.indexOf("Mac")?"cmd":"ctrl")+": zoom to slices)\n drag + shift : Select all slices vertically\n\n",
b=this.focusElement.tabIndex?b+" <- : Select previous event on current timeline\n -> : Select next event on current timeline\n":b+"General Navigation\n g/General : Shows grid at the start/end of the selected task\n <-,^TAB : Select previous event on current timeline\n ->, TAB : Select next event on current timeline\n";return b+"\nAlt + Scroll to zoom in/out\nDbl-click to zoom in; Shift dbl-click to zoom out\nf to zoom into selection\nz to reset zoom and pan to initial view\n"},
get selection(){return this.selection_},set selection(b){if(!(b instanceof f))throw Error("Expected TimelineSelection");var a;for(a=0;a<this.selection_.length;a++)this.selection_[a].selected=!1;this.selection_=b;base.dispatchSimpleEvent(this,"selectionChange");for(a=0;a<this.selection_.length;a++)this.selection_[a].selected=!0;this.viewport_.dispatchChangeEvent()},setSelectionAndMakeVisible:function(b,a){if(!(b instanceof f))throw Error("Expected TimelineSelection");this.selection=b;var e=this.selection.bounds,
g=this.viewport_.xWorldVectorToView(e.max-e.min);a&&50>g?(g=e.min+0.5*(e.max-e.min),e=5*(e.max-e.min),this.viewport_.xSetWorldBounds(g-0.5*e,g+0.5*e,this.firstCanvas.width)):this.viewport_.xPanWorldBoundsIntoView(e.min,e.max,this.firstCanvas.width)},get firstCanvas(){if(this.viewportTrack_)return this.viewportTrack_.firstCanvas;if(this.modelTrack_)return this.modelTrack_.firstCanvas},hideDragBox_:function(){this.dragBox_.style.left="-1000px";this.dragBox_.style.top="-1000px";this.dragBox_.style.width=
0;this.dragBox_.style.height=0},setDragBoxPosition_:function(b,a,e,g,c){var f=Math.min(b,e);b=Math.max(b,e);e=this.modelTrack_.getBoundingClientRect();c?(c=e.top,e=e.bottom):(c=Math.min(a,g),e=Math.max(a,g));a=c;g=f+(b-f);c=a+(e-c);var j=this.modelTrackContainer_.getBoundingClientRect();e=j.left;var l=j.top,r=j.right,j=j.bottom,m=parseInt(this.modelTrack_.headingWidth);e+=m;m={};f>r||g<e||a>j||c<l?a=!1:(m.left=Math.max(e,f),m.top=Math.max(l,a),m.right=Math.min(r,g),m.bottom=Math.min(j,c),m.width=
m.right-m.left,m.height=m.bottom-m.top,a=m);this.dragBox_.style.left=a.left+"px";this.dragBox_.style.width=a.width+"px";this.dragBox_.style.top=a.top+"px";this.dragBox_.style.height=a.height+"px";a=window.devicePixelRatio||1;g=this.firstCanvas;f=this.viewport_.xViewToWorld((f-g.offsetLeft)*a);b=this.viewport_.xViewToWorld((b-g.offsetLeft)*a);a=Math.round(100*(b-f))/100;this.dragBox_.textContent=a+"ms";a=new base.Event("selectionChanging");a.loWX=f;a.hiWX=b;this.dispatchEvent(a)},onGridToggle_:function(a){a=
a?this.selection_.bounds.min:this.selection_.bounds.max;var d=Math.ceil((a-this.model_.bounds.min)/this.viewport_.gridStep_);this.viewport_.gridTimebase=a-(d+1)*this.viewport_.gridStep_;this.viewport_.gridEnabled=!0},isChildOfThis_:function(a){if(a!=this){for(;a.parentNode;){if(a==this)return!0;a=a.parentNode}return!1}},onMouseDown_:function(a){if(0===a.button)if(a.shiftKey)this.viewportTrack_.placeAndBeginDraggingMarker(a.clientX);else{var d=this.firstCanvas,e=this.modelTrack_.getBoundingClientRect(),
c=this.firstCanvas.getBoundingClientRect();e&&(a.clientX>=e.left&&a.clientX<e.right&&a.clientY>=e.top&&a.clientY<e.bottom&&a.clientX>=c.left&&a.clientX<c.right)&&(this.viewport_.xViewToWorld(a.clientX-d.offsetLeft),this.dragBeginEvent_=a,a.preventDefault(),document.activeElement&&document.activeElement.blur(),0<=this.focusElement.tabIndex&&this.focusElement.focus())}},onMouseMove_:function(a){if(this.firstCanvas){var d=this.firstCanvas;this.lastMouseViewPos_={x:a.clientX-d.offsetLeft,y:a.clientY-
d.offsetTop};this.dragBeginEvent_&&(this.dragBoxXStart_=this.dragBeginEvent_.clientX,this.dragBoxXEnd_=a.clientX,this.dragBoxYStart_=this.dragBeginEvent_.clientY,this.dragBoxYEnd_=a.clientY,this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_,a.shiftKey))}},onMouseUp_:function(a){if(this.dragBeginEvent_){this.hideDragBox_();var d=this.dragBeginEvent_;this.dragBeginEvent_=null;var e,c=Math.min(d.clientX,a.clientX),k=Math.max(d.clientX,a.clientX);this.modelTrackContainer_.getBoundingClientRect();
a.shiftKey?(d=this.modelTrack_.getBoundingClientRect(),e=d.top,d=d.bottom):(e=Math.min(d.clientY,a.clientY),d=Math.max(d.clientY,a.clientY));var h=this.firstCanvas,c=c-h.offsetLeft,k=k-h.offsetLeft,h=new f;this.modelTrack_.addIntersectingItemsInRangeToSelection(c,k,e,d,h);this.selection=h;((e=0==navigator.platform.indexOf("Mac"))&&a.metaKey||!e&&a.ctrlKey)&&this.zoomToSelection_()}},onDblClick_:function(a){var d=this.modelTrackContainer_.getBoundingClientRect(),e=d.left,d=d.right,c=parseInt(this.modelTrack_.headingWidth);
a.clientX<e+c||a.clientX>d||(e=4,a.shiftKey&&(e=1/e),this.zoomBy_(e),a.preventDefault())}};base.defineProperty(a,"model",base.PropertyKind.JS);return{Timeline:a}});"use strict";base.require("ui");base.requireStylesheet("timeline_analysis");
base.exportTo("tracing",function(){function f(a,d){var e=d.getSliceHitsAsSelection(),c=d.getCounterSampleHitsAsSelection();if(1==e.length){var f=e[0].slice,h=a.appendTable("timeline-analysis-slice-table",2);a.appendTableHeader(h,"Selected slice:");a.appendSummaryRow(h,"Title",f.title);f.category&&a.appendSummaryRow(h,"Category",f.category);a.appendSummaryRowTime(h,"Start",f.start);a.appendSummaryRowTime(h,"Duration",f.duration);f.durationInUserTime&&a.appendSummaryRowTime(h,"Duration (U)",f.durationInUserTime);
var e=0,j;for(j in f.args)e+=1;if(0<e)for(j in a.appendSummaryRow(h,"Args"),f.args)a.appendSummaryRow(h," "+j,f.args[j])}else if(1<e.length){var l=e.bounds.min,r=e.bounds.max;e.map(function(a){return a.slice.title});var h=0,m={};for(j=0;j<e.length;j++)f=e[j].slice,m[f.title]||(m[f.title]={slices:[]},h++),m[f.title].slices.push(f);h=a.appendTable("timeline-analysis-slices-table",3);a.appendTableHeader(h,"Slices:");var f=0,p;for(p in m){var q=m[p],s=0;j=0;var u=Number.MAX_VALUE,t=-Number.MAX_VALUE,
v=Number.MAX_VALUE,w=-Number.MAX_VALUE;for(j=0;j<q.slices.length;j++)s+=q.slices[j].duration,u=Math.min(q.slices[j].start,u),t=Math.max(q.slices[j].start,t),v=Math.min(q.slices[j].duration,v),w=Math.max(q.slices[j].duration,w);f+=s;0==q.slices.length&&(j=0);j=s/q.slices.length;v={min:v,max:w,avg:j,avg_stddev:void 0,frequency:void 0,frequency_stddev:void 0};for(j=w=0;j<q.slices.length;j++)var x=v.avg-q.slices[j].duration,w=w+x*x;v.avg_stddev=Math.sqrt(w/(q.slices.length-1));j=t-u;if(2<q.slices.length&&
0<j){u=q.slices.length-1;v.frequency=1E3*u/j;w=0;for(j=1;j<q.slices.length;j++)x=v.frequency-1E3/(q.slices[j].start-q.slices[j-1].start),w+=x*x;v.frequency_stddev=Math.sqrt(w/(u-1))}a.appendDataRow(h,p,s,q.slices.length,v)}a.appendDataRow(h,"*Totals",f,e.length);a.appendSpacingRow(h);a.appendSummaryRowTime(h,"Selection start",l);a.appendSummaryRowTime(h,"Selection extent",r-l)}if(1==c.length){var h=c[0],e=h.counter,y=h.sampleIndex,c=[];for(j=0;j<e.numSeries;++j)c.push(e.samples[e.numSeries*y+j]);
h=a.appendTable("timeline-analysis-counter-table",2);a.appendTableHeader(h,"Selected counter:");a.appendSummaryRow(h,"Title",e.name);a.appendSummaryRowTime(h,"Timestamp",e.timestamps[y]);for(j=0;j<e.numSeries;j++)a.appendSummaryRow(h,e.seriesNames[j],c[j])}else if(1<c.length){p={};for(j=0;j<c.length;j++)e=c[j].counter,p[e.guid]||(p[e.guid]=[]),p[e.guid].push(c[j]);h=a.appendTable("timeline-analysis-counter-table",7);a.appendTableHeader(h,"Counters:");for(y in p){c=p[y];e=c[0].counter;l=[];for(j=0;j<
c.length;j++)l.push(c[j].sampleIndex);c=e.getSampleStatistics(l);for(j=0;j<c.length;j++)a.appendDataRow(h,e.name+": "+e.seriesNames[j],void 0,void 0,c[j])}}}var c=base.ui.define("div");c.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){},tsRound_:function(a){return Math.round(1E3*a)/1E3},appendElement_:function(a,d,e){d=a.ownerDocument.createElement(d);a.appendChild(d);void 0!=e&&(d.textContent=e);return d},appendText_:function(a,d){a.ownerDocument.createTextNode(d);a.appendChild(textNode);
return textNode},appendTableCell_:function(a,d,e,c){d=this.appendElement_(d,"td",c);d.className=a.className+"-col-"+e;return d},appendTableCellWithTooltip_:function(a,d,e,c,f){if(f)return d=this.appendElement_(d,"td"),d.className=a.className+"-col-"+e,a=this.appendElement_(d,"span",c),a.className="tooltip",a.title=f,d;this.appendTableCell_(a,d,e,c)},appendTable:function(a,d){var e=this.appendElement_(this,"table");e.className=a+" timeline-analysis-table";e.numColumns=d;return e},appendTableHeader:function(a,
d){var e=this.appendElement_(a,"tr");this.appendElement_(e,"th",d).className="timeline-analysis-table-header"},appendSummaryRow:function(a,d,e){var c=this.appendElement_(a,"tr");c.className="timeline-analysis-table-row";this.appendTableCell_(a,c,0,d);if(void 0!==e){this.appendTableCell_(a,c,1,e);for(d=2;d<a.numColumns;d++)this.appendTableCell_(a,c,d,"")}else for(d=1;d<a.numColumns;d++)this.appendTableCell_(a,c,1,"")},appendSpacingRow:function(a){var d=this.appendElement_(a,"tr");d.className="timeline-analysis-table-row";
for(var e=0;e<a.numColumns;e++)this.appendTableCell_(a,d,e," ")},appendSummaryRowTime:function(a,d,e){this.appendSummaryRow(a,d,this.tsRound_(e)+" ms")},appendDataRow:function(a,d,e,c,f){var h=void 0;f&&(h="Min Duration:\t"+this.tsRound_(f.min)+" ms \rMax Duration:\t"+this.tsRound_(f.max)+" ms \rAvg Duration:\t"+this.tsRound_(f.avg)+" ms (\u03c3 = "+this.tsRound_(f.avg_stddev)+")",f.start&&(h+="\rStart Time:\t"+this.tsRound_(f.start)+" ms"),f.end&&(h+="\rEnd Time:\t"+this.tsRound_(f.end)+" ms"),f.frequency&&
f.frequency_stddev&&(h+="\rFrequency:\t"+this.tsRound_(f.frequency)+" occurrences/s (\u03c3 = "+this.tsRound_(f.frequency_stddev)+")"));f=this.appendElement_(a,"tr");f.className="timeline-analysis-table-row";this.appendTableCellWithTooltip_(a,f,0,d,h);void 0!==e?this.appendTableCellWithTooltip_(a,f,1,this.tsRound_(e)+" ms",h):this.appendTableCell_(a,f,1,"");void 0!==c?this.appendTableCellWithTooltip_(a,f,2,String(c)+" occurrences",h):this.appendTableCell_(a,f,2,"")}};var a=base.ui.define("div");a.prototype=
{__proto__:HTMLDivElement.prototype,decorate:function(){this.className="timeline-analysis"},set selection(a){this.textContent="";var d=new c;f(d,a);this.appendChild(d)}};return{TimelineAnalysisView:a,analyzeSelection_:f}});base.requireStylesheet("overlay");base.require("ui");base.require("event_target");
base.exportTo("tracing",function(){var f=base.ui.define("div");f.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("overlay-root");this.visible=!1;this.contentHost=this.ownerDocument.createElement("div");this.contentHost.classList.add("content-host");this.tabCatcher=this.ownerDocument.createElement("span");this.tabCatcher.tabIndex=0;this.appendChild(this.contentHost);this.onKeydownBoundToThis_=this.onKeydown_.bind(this);this.onFocusInBoundToThis_=this.onFocusIn_.bind(this);
this.addEventListener("mousedown",this.onMousedown_.bind(this))},showOverlay:function(a){a.oldParent_=a.parentNode;this.contentHost.appendChild(a);this.contentHost.appendChild(this.tabCatcher);this.ownerDocument.body.classList.add("disabled-by-overlay");this.visible=!0;a.tabIndex=0;var b=a.querySelector("button, input, list, select, a");b||(b=a);b.focus();this.ownerDocument.addEventListener("focusin",this.onFocusInBoundToThis_,!0);a.addEventListener("keydown",this.onKeydownBoundToThis_)},onMousedown_:function(a){a.target==
this&&a.preventDefault()},onFocusIn_:function(a){a.target==this.tabCatcher&&window.setTimeout(this.focusOverlay_.bind(this),0)},focusOverlay_:function(){this.contentHost.firstChild.focus()},onKeydown_:function(a){9==a.keyCode&&(a.shiftKey&&a.target==this.contentHost.firstChild)&&a.preventDefault()},hideOverlay:function(a){this.visible=!1;this.ownerDocument.body.classList.remove("disabled-by-overlay");this.lastFocusOut_=void 0;a.parentNode.removeChild(this.tabCatcher);a.oldParent_?(a.oldParent_.appendChild(a),
delete a.oldParent_):this.contentHost.removeChild(a);a.removeEventListener("keydown",this.onKeydownBoundToThis_);this.ownerDocument.removeEventListener("focusin",this.onFocusInBoundToThis_)}};base.defineProperty(f,"visible",base.PropertyKind.BOOL_ATTR);var c=base.ui.define("div");c.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){if(!this.ownerDocument.querySelector(".overlay-root")){var a=this.ownerDocument.createElement("div");base.ui.decorate(a,f);this.ownerDocument.body.appendChild(a)}this.classList.add("overlay");
this.visible=!1;this.defaultClickShouldClose=!0;this.autoClose=!1;this.additionalCloseKeyCodes=[];this.onKeyDown=this.onKeyDown.bind(this);this.onKeyPress=this.onKeyPress.bind(this);this.onDocumentClick=this.onDocumentClick.bind(this)},onVisibleChanged_:function(){var a=this.ownerDocument.querySelector(".overlay-root");base.dispatchSimpleEvent(this,"visibleChange");this.visible?(a.showOverlay(this),document.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("keypress",this.onKeyPress,
!0),document.addEventListener("click",this.onDocumentClick,!0)):(document.removeEventListener("keydown",this.onKeyDown,!0),document.removeEventListener("keypress",this.onKeyPress,!0),document.removeEventListener("click",this.onDocumentClick,!0),a.hideOverlay(this))},onKeyDown:function(a){this.autoClose&&27==a.keyCode&&(this.visible=!1,a.preventDefault())},onKeyPress:function(a){if(this.autoClose)for(var b=0;b<this.additionalCloseKeyCodes.length;b++)if(a.keyCode==this.additionalCloseKeyCodes[b]){this.visible=
!1;a.preventDefault();break}},onDocumentClick:function(a){if(this.defaultClickShouldClose){for(var b=a.target;null!==b;){if(b===this)return;b=b.parentNode}this.visible=!1;a.preventDefault()}}};base.defineProperty(c,"visible",base.PropertyKind.BOOL_ATTR,c.prototype.onVisibleChanged_);base.defineProperty(c,"defaultClickShouldClose",base.PropertyKind.BOOL_ATTR);return{Overlay:c}});"use strict";base.require("timeline_filter");base.require("overlay");
base.exportTo("tracing",function(){var f=base.ui.define("div");f.prototype={__proto__:tracing.Overlay.prototype,decorate:function(){tracing.Overlay.prototype.decorate.call(this);this.className="timeline-view-category-filter-overlay";this.autoClose=!0;var c=document.createElement("div");c.className="category-filter-dialog";c.textContent="Select active categories:";this.formEl_=document.createElement("form");this.formEl_.className="category-filter-dialog-form";c.appendChild(this.formEl_);this.appendChild(c);
this.addEventListener("visibleChange",this.onVisibleChange_.bind(this))},get model(){return this.model_},set model(c){this.model_=c},get settings(){return this.settings_},set settings(c){this.settings_=c},set settingUpdatedCallback(c){this.settingUpdatedCallback_=c},onVisibleChange_:function(){this.visible&&this.updateForm_()},updateForm_:function(){this.formEl_.innerHTML="";var c=this.model_.categories;c.concat(this.settings_.keys("categories"));for(var a=0;a<c.length;a++){var b=c[a],d=document.createElement("input");
d.type="checkbox";d.id=d.value=b;d.checked="true"==this.settings_.get(b,"true","categories");d.onchange=this.updateSetting_.bind(this);var e=document.createElement("label");e.textContent=b;e.setAttribute("for",b);this.formEl_.appendChild(d);this.formEl_.appendChild(e);this.formEl_.appendChild(document.createElement("br"))}},updateSetting_:function(c){c=c.target;this.settings_.set(c.value,c.checked,"categories");this.settingUpdatedCallback_()}};return{TimelineCategoryFilterDialog:f}});"use strict";
base.require("timeline");base.require("timeline_filter");base.require("overlay");
base.exportTo("tracing",function(){function f(){this.model_=this.timeline_=void 0;this.filterText_="";this.filterHits_=new tracing.TimelineSelection;this.filterHitsDirty_=!0;this.currentHitIndex_=0}var c=base.ui.define("div");c.prototype={__proto__:tracing.Overlay.prototype,decorate:function(){tracing.Overlay.prototype.decorate.call(this);this.className="timeline-find-control";this.hitCountEl_=document.createElement("div");this.hitCountEl_.className="hit-count-label";this.hitCountEl_.textContent=
"1 of 7";var a=document.createElement("div");a.className="timeline-button find-previous";a.textContent="\u2190";a.addEventListener("click",function(){this.controller.findPrevious();this.updateHitCountEl_()}.bind(this));var b=document.createElement("div");b.className="timeline-button find-next";b.textContent="\u2192";b.addEventListener("click",function(){this.controller.findNext();this.updateHitCountEl_()}.bind(this));this.filterEl_=document.createElement("input");this.filterEl_.type="input";this.filterEl_.addEventListener("input",
function(){this.controller.filterText=this.filterEl_.value;this.updateHitCountEl_()}.bind(this));this.filterEl_.addEventListener("keydown",function(a){13==a.keyCode?b.click():27==a.keyCode&&(this.filterEl_.blur(),this.updateHitCountEl_())}.bind(this));this.filterEl_.addEventListener("blur",function(){this.updateHitCountEl_()}.bind(this));this.filterEl_.addEventListener("focus",function(){this.updateHitCountEl_()}.bind(this));this.appendChild(this.filterEl_);this.appendChild(a);this.appendChild(b);
this.appendChild(this.hitCountEl_);this.updateHitCountEl_()},get controller(){return this.controller_},set controller(a){this.controller_=a;this.updateHitCountEl_()},focus:function(){this.filterEl_.selectionStart=0;this.filterEl_.selectionEnd=this.filterEl_.value.length;this.filterEl_.focus()},updateHitCountEl_:function(){if(!this.controller||document.activeElement!=this.filterEl_)this.hitCountEl_.textContent="";else{var a=this.controller.currentHitIndex,b=this.controller.filterHits.length;this.hitCountEl_.textContent=
0==b?"0 of 0":a+1+" of "+b}}};f.prototype={__proto__:Object.prototype,get timeline(){return this.timeline_},set timeline(a){this.timeline_=a;this.filterHitsDirty_=!0},get filterText(){return this.filterText_},set filterText(a){a!=this.filterText_&&(this.filterText_=a,this.filterHitsDirty_=!0,this.findNext())},get filterHits(){if(this.filterHitsDirty_)if(this.filterHitsDirty_=!1,this.timeline_){var a=new tracing.TimelineTitleFilter(this.filterText);this.filterHits_.clear();this.timeline.addAllObjectsMatchingFilterToSelection(a,
this.filterHits_);this.currentHitIndex_=this.filterHits_.length-1}else this.filterHits_.clear(),this.currentHitIndex_=0;return this.filterHits_},get currentHitIndex(){return this.currentHitIndex_},find_:function(a){if(this.timeline){var b=this.filterHits.length;this.currentHitIndex_+=a;0>this.currentHitIndex_&&(this.currentHitIndex_=b-1);this.currentHitIndex_>=b&&(this.currentHitIndex_=0);0>this.currentHitIndex_||this.currentHitIndex_>=b?this.timeline.selection=new tracing.TimelineSelection:(a=0==
this.currentHitIndex_,b=this.filterHits.subSelection(this.currentHitIndex_),this.timeline.setSelectionAndMakeVisible(b,a))}},findNext:function(){this.find_(1)},findPrevious:function(){this.find_(-1)}};return{TimelineFindControl:c,TimelineFindController:f}});base.require("timeline_model");base.require("timeline_color_scheme");
base.exportTo("tracing",function(){function f(c,a){this.importPriority=1;this.model_=c;"string"===typeof a||a instanceof String?("["==a[0]&&(n=a.length,"\n"==a[n-1]&&(a=a.substring(0,n-1),n--,"\r"==a[n-1]&&(a=a.substring(0,n-1),n--)),","==a[n-1]&&(a=a.substring(0,n-1)),"]"!=a[n-1]&&(a+="]")),this.events_=JSON.parse(a)):this.events_=a;if(this.events_.traceEvents){var b=this.events_;this.events_=this.events_.traceEvents;for(fieldName in b)"traceEvents"!=fieldName&&this.model_.metadata.push({name:fieldName,
value:b[fieldName]})}this.allAsyncEvents_=[]}f.canImport=function(c){return"string"===typeof c||c instanceof String?"{"==c[0]||"["==c[0]:c instanceof Array&&c.length&&c[0].ph?!0:c.traceEvents?c.traceEvents instanceof Array&&c.traceEvents[0].ph:!1};f.prototype={__proto__:Object.prototype,processAsyncEvent:function(c,a){var b=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid);this.allAsyncEvents_.push({event:a,thread:b})},processCounterEvent:function(c){var a;a=void 0!==c.id?c.name+"["+
c.id+"]":c.name;a=this.model_.getOrCreateProcess(c.pid).getOrCreateCounter(c.cat,a);if(0==a.numSeries){for(var b in c.args)a.seriesNames.push(b),a.seriesColors.push(tracing.getStringColorId(a.name+"."+b));if(0==a.numSeries){this.model_.importErrors.push("Expected counter "+c.name+" to have at least one argument to use as a value.");delete a.parent.counters[a.name];return}}a.timestamps.push(c.ts/1E3);for(var d=0;d<a.numSeries;d++)b=a.seriesNames[d],void 0===c.args[b]?a.samples.push(0):a.samples.push(c.args[b])},
importEvents:function(){for(var c=this.events_,a=0;a<c.length;a++){var b=c[a];if("B"==b.ph){var d=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid);d.isTimestampValidForBeginOrEnd(b.ts/1E3)?d.beginSlice(b.cat,b.name,b.ts/1E3,b.args):this.model_.importErrors.push("Timestamps are moving backward.")}else if("E"==b.ph)if(d=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),d.isTimestampValidForBeginOrEnd(b.ts/1E3))if(d.openSliceCount){var d=d.endSlice(b.ts/1E3),e;for(e in b.args)void 0!==
d.args[e]&&this.model_.importErrors.push("Both the B and E phases of "+d.name+"provided values for argument "+e+". The value of the E phase event will be used."),d.args[e]=b.args[e]}else this.model_.importErrors.push("E phase event without a matching B phase event.");else this.model_.importErrors.push("Timestamps are moving backward.");else"S"==b.ph?this.processAsyncEvent(a,b):"F"==b.ph?this.processAsyncEvent(a,b):"T"==b.ph?this.processAsyncEvent(a,b):"I"==b.ph?(d=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),
d.beginSlice(b.cat,b.name,b.ts/1E3,b.args),d.endSlice(b.ts/1E3)):"C"==b.ph?this.processCounterEvent(b):"M"==b.ph?"thread_name"==b.name?(d=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),d.name=b.args.name):this.model_.importErrors.push("Unrecognized metadata name: "+b.name):"s"!=b.ph&&"t"!=b.ph&&"f"!=b.ph&&this.model_.importErrors.push("Unrecognized event phase: "+b.ph+"("+b.name+")")}},finalizeImport:function(){this.createAsyncSlices_()},createAsyncSlices_:function(){if(0!=this.allAsyncEvents_.length){this.allAsyncEvents_.sort(function(a,
b){return a.event.ts-b.event.ts});for(var c={},a=this.allAsyncEvents_,b=0;b<a.length;b++){var d=a[b],e=d.event,g=e.name;if(void 0===g)this.model_.importErrors.push("Async events (ph: S, T or F) require an name parameter.");else{var f=e.id;if(void 0===f)this.model_.importErrors.push("Async events (ph: S, T or F) require an id parameter.");else if("S"==e.ph)void 0===c[g]&&(c[g]={}),c[g][f]?this.model_.importErrors.push("At "+e.ts+", a slice of the same id "+f+" was alrady open."):(c[g][f]=[],c[g][f].push(d));
else if(void 0===c[g])this.model_.importErrors.push("At "+e.ts+", no slice named "+g+" was open.");else if(void 0===c[g][f])this.model_.importErrors.push("At "+e.ts+", no slice named "+g+" with id="+f+" was open.");else{var h=c[g][f];h.push(d);if("F"==e.ph){var j=new tracing.TimelineAsyncSlice(h[0].event.cat,g,tracing.getStringColorId(g),h[0].event.ts/1E3);j.duration=e.ts/1E3-h[0].event.ts/1E3;j.startThread=h[0].thread;j.endThread=d.thread;j.id=f;j.args=h[0].event.args;j.subSlices=[];for(d=1;d<h.length;++d){var l=
g;"T"==h[d-1].event.ph&&(l=g+":"+h[d-1].event.args.step);l=new tracing.TimelineAsyncSlice(h[0].event.cat,l,tracing.getStringColorId(g+d),h[d-1].event.ts/1E3);l.duration=h[d].event.ts/1E3-h[d-1].event.ts/1E3;l.startThread=h[d-1].thread;l.endThread=h[d].thread;l.id=f;l.args=h[d-1].event.args;j.subSlices.push(l)}var h=j.subSlices[j.subSlices.length-1],r;for(r in e.args)h.args[r]=e.args[r];j.startThread.asyncSlices.push(j);delete c[g][f]}}}}}}};tracing.TimelineModel.registerImporter(f);return{TraceEventImporter:f}});
base.exportTo("tracing",function(){function f(a){this.importer=a;this.model=a.model}var c=[];f.registerSubtype=function(a){c.push(a)};f.getSubtypeConstructors=function(){return c};f.prototype={__proto__:Object.prototype};return{LinuxPerfParser:f}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("ext4_sync_file_enter",f.prototype.ext4SyncFileEnterEvent.bind(this));a.registerEventHandler("ext4_sync_file_exit",f.prototype.ext4SyncFileExitEvent.bind(this));a.registerEventHandler("block_rq_issue",f.prototype.blockRqIssueEvent.bind(this));a.registerEventHandler("block_rq_complete",f.prototype.blockRqCompleteEvent.bind(this));this.blockSlices={}}var c=tracing.LinuxPerfParser;f.prototype={__proto__:c.prototype,
openBlockSlice:function(a,b,d,e,c,f){b=/(.+)-\d+/.exec(b)[1];d=this.importer.getOrCreateKernelThread(b,d);a=new tracing.TimelineAsyncSlice(a,f,tracing.getStringColorId(f),c);a.startThread=d.thread;this.blockSlices[e]=a},closeBlockSlice:function(a,b,d,e){var c=this.blockSlices[b];if(c){startThread=c.startThread;var f=this.importer.getOrCreateKernelThread(startThread.name,startThread.tid);c.duration=d-c.start;c.args=e;c.endThread=f.thread;c.subSlices=[new tracing.TimelineSlice(a,c.title,c.colorId,c.start,
c.args,c.duration)];f.thread.asyncSlices.push(c);delete this.blockSlices[b]}},ext4SyncFileEnterEvent:function(a,b,d,e,c){a=/dev (\d+,\d+) ino (\d+) parent (\d+) datasync (\d+)/.exec(c[5]);if(!a)return!1;this.openBlockSlice("ext4",c[1],d,a[1]+"-"+a[2],e,1==a[4]?"fdatasync":"fsync");return!0},ext4SyncFileExitEvent:function(a,b,d,e,c){d=/dev (\d+,\d+) ino (\d+) ret (\d+)/.exec(c[5]);if(!d)return!1;a=d[1];b=d[2];d=parseInt(d[3]);this.closeBlockSlice("ext4",a+"-"+b,e,{device:a,inode:b,error:d});return!0},
blockRqIssueEvent:function(a,b,d,e,c){a=/(\d+,\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? \d+ \(.*\) (\d+) \+ (\d+) \[.*\]/.exec(c[5]);if(!a)return!1;b=a[1];var f=parseInt(a[8]),h=parseInt(a[9]),j;switch(a[3]){case "D":j="Discard";break;case "W":j="Write";break;case "R":j="Read";break;case "N":j="None";break;default:j="Unknown"}a[2]&&(j+=" flush");"F"==a[4]&&(j+=" fua");"A"==a[5]&&(j+=" ahead");"S"==a[6]&&(j+=" sync");"M"==a[7]&&(j+=" meta");this.openBlockSlice("block",c[1],d,b+"-"+f+"-"+h,e,j);return!0},blockRqCompleteEvent:function(a,
b,d,e,c){c=/(\d+,\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? \(.*\) (\d+) \+ (\d+) \[(.*)\]/.exec(c[5]);if(!c)return!1;a=c[1];b=parseInt(c[8]);d=parseInt(c[9]);c=parseInt(c[10]);this.closeBlockSlice("block",a+"-"+b+"-"+d,e,{device:a,sector:b,numSectors:d,error:c});return!0}};c.registerSubtype(f);return{LinuxPerfBlockParser:f}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("memory_bus_usage",f.prototype.traceMarkWriteBusEvent.bind(this));this.model_=a.model_;this.ppids_={}}var c=tracing.LinuxPerfParser;f.prototype={__proto__:c.prototype,traceMarkWriteBusEvent:function(a,b,d,e,c){c=/bus=(\S+) rw_bytes=(\d+) r_bytes=(\d+) w_bytes=(\d+) cycles=(\d+) ns=(\d+)/.exec(c[5]);a=c[1];parseInt(c[2]);d=parseInt(c[3]);b=parseInt(c[4]);parseInt(c[5]);c=parseInt(c[6]);d=1E9*d/c/1048576;b=1E9*b/
c/1048576;c=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,"bus "+a+" read");0==c.numSeries&&(c.seriesNames.push("value"),c.seriesColors.push(tracing.getStringColorId(c.name+".value")));c.timestamps.push(e);c.samples.push(d);c=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,"bus "+a+" write");0==c.numSeries&&(c.seriesNames.push("value"),c.seriesColors.push(tracing.getStringColorId(c.name+".value")));c.timestamps.push(e);c.samples.push(b);return!0}};c.registerSubtype(f);return{LinuxPerfBusParser:f}});
base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("clock_set_rate",f.prototype.traceMarkWriteClockEvent.bind(this));this.model_=a.model_;this.ppids_={}}var c=tracing.LinuxPerfParser;f.prototype={__proto__:c.prototype,traceMarkWriteClockEvent:function(a,b,d,e,c){b=/(\S+) state=(\d+) cpu_id=(\d+)/.exec(c[5]);a=b[1];b=parseInt(b[2]);a=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,a);0==a.numSeries&&(a.seriesNames.push("value"),a.seriesColors.push(tracing.getStringColorId(a.name+
".value")));a.timestamps.push(e);a.samples.push(b);return!0}};c.registerSubtype(f);return{LinuxPerfClockParser:f}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("cpufreq_interactive_up",f.prototype.cpufreqUpDownEvent.bind(this));a.registerEventHandler("cpufreq_interactive_down",f.prototype.cpufreqUpDownEvent.bind(this));a.registerEventHandler("cpufreq_interactive_already",f.prototype.cpufreqTargetEvent.bind(this));a.registerEventHandler("cpufreq_interactive_notyet",f.prototype.cpufreqTargetEvent.bind(this));a.registerEventHandler("cpufreq_interactive_target",f.prototype.cpufreqTargetEvent.bind(this));
a.registerEventHandler("cpufreq_interactive_boost",f.prototype.cpufreqBoostUnboostEvent.bind(this));a.registerEventHandler("cpufreq_interactive_unboost",f.prototype.cpufreqBoostUnboostEvent.bind(this))}var c=tracing.LinuxPerfParser;f.prototype={__proto__:c.prototype,cpufreqSlice:function(a,b,d,e){d=this.importer.getOrCreatePseudoThread("cpufreq");d.openSlice=b;a=new tracing.TimelineSlice("",d.openSlice,tracing.getStringColorId(d.openSlice),a,e,0);d.thread.pushSlice(a)},cpufreqBoostSlice:function(a,
b,d){var e=this.importer.getOrCreatePseudoThread("cpufreq_boost");e.openSlice=b;a=new tracing.TimelineSlice("",e.openSlice,tracing.getStringColorId(e.openSlice),a,d,0);e.thread.pushSlice(a)},cpufreqUpDownEvent:function(a,b,d,e,c){c=/cpu=(\d+) targ=(\d+) actual=(\d+)/.exec(c[5]);if(!c)return!1;b=parseInt(c[1]);d=parseInt(c[2]);c=parseInt(c[3]);this.cpufreqSlice(e,a,b,{cpu:b,targ:d,actual:c});return!0},cpufreqTargetEvent:function(a,b,d,e,c){var f=/cpu=(\d+) load=(\d+) cur=(\d+) targ=(\d+)/.exec(c[5]);
if(!f)return!1;b=parseInt(f[1]);d=parseInt(f[2]);c=parseInt(f[3]);f=parseInt(f[4]);this.cpufreqSlice(e,a,b,{cpu:b,load:d,cur:c,targ:f});return!0},cpufreqBoostUnboostEvent:function(a,b,d,e,c){this.cpufreqBoostSlice(e,a,{type:c[5]});return!0}};c.registerSubtype(f);return{LinuxPerfCpufreqParser:f}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("drm_vblank_event",f.prototype.vblankEvent.bind(this))}var c=tracing.LinuxPerfParser;f.prototype={__proto__:c.prototype,drmVblankSlice:function(a,b,d){var e=this.importer.getOrCreatePseudoThread("drm_vblank");e.openSlice=b;a=new tracing.TimelineSlice("",e.openSlice,tracing.getStringColorId(e.openSlice),a,d,0);e.thread.pushSlice(a)},vblankEvent:function(a,b,d,e,c){b=/crtc=(\d+), seq=(\d+)/.exec(c[5]);if(!b)return!1;
a=parseInt(b[1]);b=parseInt(b[2]);this.drmVblankSlice(e,"vblank:"+a,{crtc:a,seq:b});return!0}};c.registerSubtype(f);return{LinuxPerfDrmParser:f}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("exynos_flip_request",f.prototype.flipEvent.bind(this));a.registerEventHandler("exynos_flip_complete",f.prototype.flipEvent.bind(this));a.registerEventHandler("exynos_busfreq_target_int",f.prototype.busfreqTargetIntEvent.bind(this));a.registerEventHandler("exynos_busfreq_target_mif",f.prototype.busfreqTargetMifEvent.bind(this))}var c=tracing.LinuxPerfParser;f.prototype={__proto__:c.prototype,exynosFlipOpenSlice:function(a,
b){var d=this.importer.getOrCreatePseudoThread("exynos_flip");d.openSliceTS=a;d.openSlice="flip:"+b},exynosFlipCloseSlice:function(a,b){var d=this.importer.getOrCreatePseudoThread("exynos_flip");if(d.openSlice){var e=new tracing.TimelineSlice("",d.openSlice,tracing.getStringColorId(d.openSlice),d.openSliceTS,b,a-d.openSliceTS);d.thread.pushSlice(e)}d.openSlice=void 0},flipEvent:function(a,b,d,e,c){b=/pipe=(\d+)/.exec(c[5]);if(!b)return!1;b=parseInt(b[1]);"exynos_flip_request"==a?this.exynosFlipOpenSlice(e,
b):this.exynosFlipCloseSlice(e,{pipe:b});return!0},exynosBusfreqSample:function(a,b,d){a=this.importer.getOrCreateCpuState(0).cpu.getOrCreateCounter("",a);0==a.numSeries&&(a.seriesNames.push("frequency"),a.seriesColors.push(tracing.getStringColorId(a.name+".frequency")));a.timestamps.push(b);a.samples.push(d)},busfreqTargetIntEvent:function(a,b,d,e,c){a=/frequency=(\d+)/.exec(c[5]);if(!a)return!1;this.exynosBusfreqSample("INT Frequency",e,parseInt(a[1]));return!0},busfreqTargetMifEvent:function(a,
b,d,e,c){a=/frequency=(\d+)/.exec(c[5]);if(!a)return!1;this.exynosBusfreqSample("MIF Frequency",e,parseInt(a[1]));return!0}};c.registerSubtype(f);return{LinuxPerfExynosParser:f}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("tracing_mark_write:log",f.prototype.logEvent.bind(this));a.registerEventHandler("tracing_mark_write:SyncInterpret",f.prototype.syncEvent.bind(this));a.registerEventHandler("tracing_mark_write:HandleTimer",f.prototype.timerEvent.bind(this))}var c=tracing.LinuxPerfParser;f.prototype={__proto__:c.prototype,gestureOpenSlice:function(a,b,d){this.importer.getOrCreatePseudoThread("gesture").thread.beginSlice("touchpad_gesture",
a,b,d)},gestureCloseSlice:function(a,b){var d=this.importer.getOrCreatePseudoThread("gesture").thread;if(d.openSliceCount){var e=d.openPartialSlices_[d.openSliceCount-1];e.title!=a?this.importer.importError("Titles do not match. Title is "+e.title+" in openSlice, and is "+a+" in endSlice"):d.endSlice(b)}},logEvent:function(a,b,d,e,c){a=/^\s*(\w+):\s*(\w+)$/.exec(c[2]);switch(a[1]){case "start":this.gestureOpenSlice("GestureLog",e,{name:a[2]});break;case "end":this.gestureCloseSlice("GestureLog",e)}return!0},
syncEvent:function(a,b,d,e,c){a=/^\s*(\w+):\s*(\w+)$/.exec(c[2]);switch(a[1]){case "start":this.gestureOpenSlice("SyncInterpret",e,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("SyncInterpret",e)}return!0},timerEvent:function(a,b,d,e,c){a=/^\s*(\w+):\s*(\w+)$/.exec(c[2]);switch(a[1]){case "start":this.gestureOpenSlice("HandleTimer",e,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("HandleTimer",e)}return!0}};c.registerSubtype(f);return{LinuxPerfGestureParser:f}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("i915_gem_object_create",f.prototype.gemObjectCreateEvent.bind(this));a.registerEventHandler("i915_gem_object_bind",f.prototype.gemObjectBindEvent.bind(this));a.registerEventHandler("i915_gem_object_unbind",f.prototype.gemObjectBindEvent.bind(this));a.registerEventHandler("i915_gem_object_change_domain",f.prototype.gemObjectChangeDomainEvent.bind(this));a.registerEventHandler("i915_gem_object_pread",f.prototype.gemObjectPreadWriteEvent.bind(this));
a.registerEventHandler("i915_gem_object_pwrite",f.prototype.gemObjectPreadWriteEvent.bind(this));a.registerEventHandler("i915_gem_object_fault",f.prototype.gemObjectFaultEvent.bind(this));a.registerEventHandler("i915_gem_object_clflush",f.prototype.gemObjectDestroyEvent.bind(this));a.registerEventHandler("i915_gem_object_destroy",f.prototype.gemObjectDestroyEvent.bind(this));a.registerEventHandler("i915_gem_ring_dispatch",f.prototype.gemRingDispatchEvent.bind(this));a.registerEventHandler("i915_gem_ring_flush",
f.prototype.gemRingFlushEvent.bind(this));a.registerEventHandler("i915_gem_request",f.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_add",f.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_complete",f.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_retire",f.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_wait_begin",f.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_wait_end",
f.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_ring_wait_begin",f.prototype.gemRingWaitEvent.bind(this));a.registerEventHandler("i915_gem_ring_wait_end",f.prototype.gemRingWaitEvent.bind(this));a.registerEventHandler("i915_reg_rw",f.prototype.regRWEvent.bind(this));a.registerEventHandler("i915_flip_request",f.prototype.flipEvent.bind(this));a.registerEventHandler("i915_flip_complete",f.prototype.flipEvent.bind(this))}var c=tracing.LinuxPerfParser;f.prototype={__proto__:c.prototype,
i915FlipOpenSlice:function(a,b,d){var e=this.importer.getOrCreatePseudoThread("i915_flip");e.openSliceTS=a;e.openSlice="flip:"+b+"/"+d},i915FlipCloseSlice:function(a,b){var d=this.importer.getOrCreatePseudoThread("i915_flip");if(d.openSlice){var e=new tracing.TimelineSlice("",d.openSlice,tracing.getStringColorId(d.openSlice),d.openSliceTS,b,a-d.openSliceTS);d.thread.pushSlice(e)}d.openSlice=void 0},i915GemObjectSlice:function(a,b,d,e){var c=this.importer.getOrCreatePseudoThread("i915_gem");c.openSlice=
b+":"+d;a=new tracing.TimelineSlice("",c.openSlice,tracing.getStringColorId(c.openSlice),a,e,0);c.thread.pushSlice(a)},i915GemRingSlice:function(a,b,d,e,c){var f=this.importer.getOrCreatePseudoThread("i915_gem_ring");f.openSlice=b+":"+d+"."+e;a=new tracing.TimelineSlice("",f.openSlice,tracing.getStringColorId(f.openSlice),a,c,0);f.thread.pushSlice(a)},i915RegSlice:function(a,b,d,e){var c=this.importer.getOrCreatePseudoThread("i915_reg");c.openSlice=b+":"+d;a=new tracing.TimelineSlice("",c.openSlice,
tracing.getStringColorId(c.openSlice),a,e,0);c.thread.pushSlice(a)},gemObjectCreateEvent:function(a,b,d,e,c){d=/obj=(\w+), size=(\d+)/.exec(c[5]);if(!d)return!1;b=d[1];d=parseInt(d[2]);this.i915GemObjectSlice(e,a,b,{obj:b,size:d});return!0},gemObjectBindEvent:function(a,b,d,e,c){c=/obj=(\w+), offset=(\w+), size=(\d+)/.exec(c[5]);if(!c)return!1;b=c[1];d=c[2];c=parseInt(c[3]);this.i915ObjectGemSlice(e,a+":"+b,{obj:b,offset:d,size:c});return!0},gemObjectChangeDomainEvent:function(a,b,d,e,c){b=/obj=(\w+), read=(\w+=>\w+), write=(\w+=>\w+)/.exec(c[5]);
if(!b)return!1;d=b[1];this.i915GemObjectSlice(e,a,d,{obj:d,read:b[2],write:b[3]});return!0},gemObjectPreadWriteEvent:function(a,b,d,e,c){c=/obj=(\w+), offset=(\d+), len=(\d+)/.exec(c[5]);if(!c)return!1;b=c[1];d=parseInt(c[2]);c=parseInt(c[3]);this.i915GemObjectSlice(e,a,b,{obj:b,offset:d,len:c});return!0},gemObjectFaultEvent:function(a,b,d,e,c){c=/obj=(\w+), (\w+) index=(\d+)/.exec(c[5]);if(!c)return!1;b=c[1];d=c[2];c=parseInt(c[3]);this.i915GemObjectSlice(e,a,b,{obj:b,type:d,index:c});return!0},
gemObjectDestroyEvent:function(a,b,d,c,f){b=/obj=(\w+)/.exec(f[5]);if(!b)return!1;b=b[1];this.i915GemObjectSlice(c,a,b,{obj:b});return!0},gemRingDispatchEvent:function(a,b,d,c,f){f=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(f[5]);if(!f)return!1;b=parseInt(f[1]);d=parseInt(f[2]);f=parseInt(f[3]);this.i915GemRingSlice(c,a,b,d,{dev:b,ring:d,seqno:f});return!0},gemRingFlushEvent:function(a,b,d,c,f){b=/dev=(\d+), ring=(\w+), invalidate=(\w+), flush=(\w+)/.exec(f[5]);if(!b)return!1;d=parseInt(b[1]);f=parseInt(b[2]);
this.i915GemRingSlice(c,a,d,f,{dev:d,ring:f,invalidate:b[3],flush:b[4]});return!0},gemRequestEvent:function(a,b,d,c,f){f=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(f[5]);if(!f)return!1;b=parseInt(f[1]);d=parseInt(f[2]);f=parseInt(f[3]);this.i915GemRingSlice(c,a,b,d,{dev:b,ring:d,seqno:f});return!0},gemRingWaitEvent:function(a,b,d,c,f){d=/dev=(\d+), ring=(\d+)/.exec(f[5]);if(!d)return!1;b=parseInt(d[1]);d=parseInt(d[2]);this.i915GemRingSlice(c,a,b,d,{dev:b,ring:d});return!0},regRWEvent:function(a,b,
d,c,f){a=/(\w+) reg=(\w+), len=(\d+), val=(\(\w+, \w+\))/.exec(f[5]);if(!a)return!1;b=a[1];d=a[2];this.i915RegSlice(c,b,d,{rw:b,reg:d,len:a[3],data:a[3]});return!0},flipEvent:function(a,b,c,e,f){c=/plane=(\d+), obj=(\w+)/.exec(f[5]);if(!c)return!1;b=parseInt(c[1]);c=c[2];"i915_flip_request"==a?this.i915FlipOpenSlice(e,c,b):this.i915FlipCloseSlice(e,{obj:c,plane:b});return!0}};c.registerSubtype(f);return{LinuxPerfI915Parser:f}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("mali_dvfs_event",f.prototype.dvfsEventEvent.bind(this));a.registerEventHandler("mali_dvfs_set_clock",f.prototype.dvfsSetClockEvent.bind(this));a.registerEventHandler("mali_dvfs_set_voltage",f.prototype.dvfsSetVoltageEvent.bind(this));this.addJMCounter("mali_hwc_MESSAGES_SENT","Messages Sent");this.addJMCounter("mali_hwc_MESSAGES_RECEIVED","Messages Received");this.addJMCycles("mali_hwc_GPU_ACTIVE","GPU Active");
this.addJMCycles("mali_hwc_IRQ_ACTIVE","IRQ Active");for(var b=0;7>b;b++){var d="JS"+b,e="mali_hwc_"+d;this.addJMCounter(e+"_JOBS",d+" Jobs");this.addJMCounter(e+"_TASKS",d+" Tasks");this.addJMCycles(e+"_ACTIVE",d+" Active");this.addJMCycles(e+"_WAIT_READ",d+" Wait Read");this.addJMCycles(e+"_WAIT_ISSUE",d+" Wait Issue");this.addJMCycles(e+"_WAIT_DEPEND",d+" Wait Depend");this.addJMCycles(e+"_WAIT_FINISH",d+" Wait Finish")}this.addTilerCounter("mali_hwc_TRIANGLES","Triangles");this.addTilerCounter("mali_hwc_QUADS",
"Quads");this.addTilerCounter("mali_hwc_POLYGONS","Polygons");this.addTilerCounter("mali_hwc_POINTS","Points");this.addTilerCounter("mali_hwc_LINES","Lines");this.addTilerCounter("mali_hwc_VCACHE_HIT","VCache Hit");this.addTilerCounter("mali_hwc_VCACHE_MISS","VCache Miss");this.addTilerCounter("mali_hwc_FRONT_FACING","Front Facing");this.addTilerCounter("mali_hwc_BACK_FACING","Back Facing");this.addTilerCounter("mali_hwc_PRIM_VISIBLE","Prim Visible");this.addTilerCounter("mali_hwc_PRIM_CULLED","Prim Culled");
this.addTilerCounter("mali_hwc_PRIM_CLIPPED","Prim Clipped");this.addTilerCounter("mali_hwc_WRBUF_HIT","Wrbuf Hit");this.addTilerCounter("mali_hwc_WRBUF_MISS","Wrbuf Miss");this.addTilerCounter("mali_hwc_WRBUF_LINE","Wrbuf Line");this.addTilerCounter("mali_hwc_WRBUF_PARTIAL","Wrbuf Partial");this.addTilerCounter("mali_hwc_WRBUF_STALL","Wrbuf Stall");this.addTilerCycles("mali_hwc_ACTIVE","Tiler Active");this.addTilerCycles("mali_hwc_INDEX_WAIT","Index Wait");this.addTilerCycles("mali_hwc_INDEX_RANGE_WAIT",
"Index Range Wait");this.addTilerCycles("mali_hwc_VERTEX_WAIT","Vertex Wait");this.addTilerCycles("mali_hwc_PCACHE_WAIT","Pcache Wait");this.addTilerCycles("mali_hwc_WRBUF_WAIT","Wrbuf Wait");this.addTilerCycles("mali_hwc_BUS_READ","Bus Read");this.addTilerCycles("mali_hwc_BUS_WRITE","Bus Write");this.addTilerCycles("mali_hwc_TILER_UTLB_STALL","Tiler UTLB Stall");this.addTilerCycles("mali_hwc_TILER_UTLB_HIT","Tiler UTLB Hit");this.addFragCycles("mali_hwc_FRAG_ACTIVE","Active");this.addFragCounter("mali_hwc_FRAG_PRIMATIVES",
"Primitives");this.addFragCounter("mali_hwc_FRAG_PRIMATIVES_DROPPED","Primitives Dropped");this.addFragCycles("mali_hwc_FRAG_CYCLE_DESC","Descriptor Processing");this.addFragCycles("mali_hwc_FRAG_CYCLES_PLR","PLR Processing??");this.addFragCycles("mali_hwc_FRAG_CYCLES_VERT","Vertex Processing");this.addFragCycles("mali_hwc_FRAG_CYCLES_TRISETUP","Triangle Setup");this.addFragCycles("mali_hwc_FRAG_CYCLES_RAST","Rasterization???");this.addFragCounter("mali_hwc_FRAG_THREADS","Threads");this.addFragCounter("mali_hwc_FRAG_DUMMY_THREADS",
"Dummy Threads");this.addFragCounter("mali_hwc_FRAG_QUADS_RAST","Quads Rast");this.addFragCounter("mali_hwc_FRAG_QUADS_EZS_TEST","Quads EZS Test");this.addFragCounter("mali_hwc_FRAG_QUADS_EZS_KILLED","Quads EZS Killed");this.addFragCounter("mali_hwc_FRAG_QUADS_LZS_TEST","Quads LZS Test");this.addFragCounter("mali_hwc_FRAG_QUADS_LZS_KILLED","Quads LZS Killed");this.addFragCycles("mali_hwc_FRAG_CYCLE_NO_TILE","No Tiles");this.addFragCounter("mali_hwc_FRAG_NUM_TILES","Tiles");this.addFragCounter("mali_hwc_FRAG_TRANS_ELIM",
"Transactions Eliminated");this.addComputeCycles("mali_hwc_COMPUTE_ACTIVE","Active");this.addComputeCounter("mali_hwc_COMPUTE_TASKS","Tasks");this.addComputeCounter("mali_hwc_COMPUTE_THREADS","Threads Started");this.addComputeCycles("mali_hwc_COMPUTE_CYCLES_DESC","Waiting for Descriptors");this.addTripipeCycles("mali_hwc_TRIPIPE_ACTIVE","Active");this.addArithCounter("mali_hwc_ARITH_WORDS","Instructions (/Pipes)");this.addArithCycles("mali_hwc_ARITH_CYCLES_REG","Reg scheduling stalls (/Pipes)");this.addArithCycles("mali_hwc_ARITH_CYCLES_L0",
"L0 cache miss stalls (/Pipes)");this.addArithCounter("mali_hwc_ARITH_FRAG_DEPEND","Frag dep check failures (/Pipes)");this.addLSCounter("mali_hwc_LS_WORDS","Instruction Words Completed");this.addLSCounter("mali_hwc_LS_ISSUES","Full Pipeline Issues");this.addLSCounter("mali_hwc_LS_RESTARTS","Restarts (unpairable insts)");this.addLSCounter("mali_hwc_LS_REISSUES_MISS","Pipeline reissue (cache miss/uTLB)");this.addLSCounter("mali_hwc_LS_REISSUES_VD","Pipeline reissue (varying data)");this.addLSCounter("mali_hwc_LS_REISSUE_ATTRIB_MISS",
"Pipeline reissue (attribute cache miss)");this.addLSCounter("mali_hwc_LS_REISSUE_NO_WB","Writeback not used");this.addTexCounter("mali_hwc_TEX_WORDS","Words");this.addTexCounter("mali_hwc_TEX_BUBBLES","Bubbles");this.addTexCounter("mali_hwc_TEX_WORDS_L0","Words L0");this.addTexCounter("mali_hwc_TEX_WORDS_DESC","Words Desc");this.addTexCounter("mali_hwc_TEX_THREADS","Threads");this.addTexCounter("mali_hwc_TEX_RECIRC_FMISS","Recirc due to Full Miss");this.addTexCounter("mali_hwc_TEX_RECIRC_DESC","Recirc due to Desc Miss");
this.addTexCounter("mali_hwc_TEX_RECIRC_MULTI","Recirc due to Multipass");this.addTexCounter("mali_hwc_TEX_RECIRC_PMISS","Recirc due to Partial Cache Miss");this.addTexCounter("mali_hwc_TEX_RECIRC_CONF","Recirc due to Cache Conflict");this.addLSCCounter("mali_hwc_LSC_READ_HITS","Read Hits");this.addLSCCounter("mali_hwc_LSC_READ_MISSES","Read Misses");this.addLSCCounter("mali_hwc_LSC_WRITE_HITS","Write Hits");this.addLSCCounter("mali_hwc_LSC_WRITE_MISSES","Write Misses");this.addLSCCounter("mali_hwc_LSC_ATOMIC_HITS",
"Atomic Hits");this.addLSCCounter("mali_hwc_LSC_ATOMIC_MISSES","Atomic Misses");this.addLSCCounter("mali_hwc_LSC_LINE_FETCHES","Line Fetches");this.addLSCCounter("mali_hwc_LSC_DIRTY_LINE","Dirty Lines");this.addLSCCounter("mali_hwc_LSC_SNOOPS","Snoops");this.addAXICounter("mali_hwc_AXI_TLB_STALL","Address channel stall");this.addAXICounter("mali_hwc_AXI_TLB_MISS","Cache Miss");this.addAXICounter("mali_hwc_AXI_TLB_TRANSACTION","Transactions");this.addAXICounter("mali_hwc_LS_TLB_MISS","LS Cache Miss");
this.addAXICounter("mali_hwc_LS_TLB_HIT","LS Cache Hit");this.addAXICounter("mali_hwc_AXI_BEATS_READ","Read Beats");this.addAXICounter("mali_hwc_AXI_BEATS_WRITE","Write Beats");this.addMMUCounter("mali_hwc_MMU_TABLE_WALK","Page Table Walks");this.addMMUCounter("mali_hwc_MMU_REPLAY_MISS","Cache Miss from Replay Buffer");this.addMMUCounter("mali_hwc_MMU_REPLAY_FULL","Replay Buffer Full");this.addMMUCounter("mali_hwc_MMU_NEW_MISS","Cache Miss on New Request");this.addMMUCounter("mali_hwc_MMU_HIT","Cache Hit");
this.addMMUCycles("mali_hwc_UTLB_STALL","UTLB Stalled");this.addMMUCycles("mali_hwc_UTLB_REPLAY_MISS","UTLB Replay Miss");this.addMMUCycles("mali_hwc_UTLB_REPLAY_FULL","UTLB Replay Full");this.addMMUCycles("mali_hwc_UTLB_NEW_MISS","UTLB New Miss");this.addMMUCycles("mali_hwc_UTLB_HIT","UTLB Hit");this.addL2Counter("mali_hwc_L2_READ_BEATS","Read Beats");this.addL2Counter("mali_hwc_L2_WRITE_BEATS","Write Beats");this.addL2Counter("mali_hwc_L2_ANY_LOOKUP","Any Lookup");this.addL2Counter("mali_hwc_L2_READ_LOOKUP",
"Read Lookup");this.addL2Counter("mali_hwc_L2_SREAD_LOOKUP","Shareable Read Lookup");this.addL2Counter("mali_hwc_L2_READ_REPLAY","Read Replayed");this.addL2Counter("mali_hwc_L2_READ_SNOOP","Read Snoop");this.addL2Counter("mali_hwc_L2_READ_HIT","Read Cache Hit");this.addL2Counter("mali_hwc_L2_CLEAN_MISS","CleanUnique Miss");this.addL2Counter("mali_hwc_L2_WRITE_LOOKUP","Write Lookup");this.addL2Counter("mali_hwc_L2_SWRITE_LOOKUP","Shareable Write Lookup");this.addL2Counter("mali_hwc_L2_WRITE_REPLAY",
"Write Replayed");this.addL2Counter("mali_hwc_L2_WRITE_SNOOP","Write Snoop");this.addL2Counter("mali_hwc_L2_WRITE_HIT","Write Cache Hit");this.addL2Counter("mali_hwc_L2_EXT_READ_FULL","ExtRD with BIU Full");this.addL2Counter("mali_hwc_L2_EXT_READ_HALF","ExtRD with BIU >1/2 Full");this.addL2Counter("mali_hwc_L2_EXT_WRITE_FULL","ExtWR with BIU Full");this.addL2Counter("mali_hwc_L2_EXT_WRITE_HALF","ExtWR with BIU >1/2 Full");this.addL2Counter("mali_hwc_L2_EXT_READ","External Read (ExtRD)");this.addL2Counter("mali_hwc_L2_EXT_READ_LINE",
"ExtRD (linefill)");this.addL2Counter("mali_hwc_L2_EXT_WRITE","External Write (ExtWR)");this.addL2Counter("mali_hwc_L2_EXT_WRITE_LINE","ExtWR (linefill)");this.addL2Counter("mali_hwc_L2_EXT_WRITE_SMALL","ExtWR (burst size <64B)");this.addL2Counter("mali_hwc_L2_EXT_BARRIER","External Barrier");this.addL2Counter("mali_hwc_L2_EXT_AR_STALL","Address Read stalls");this.addL2Counter("mali_hwc_L2_EXT_R_BUF_FULL","Response Buffer full stalls");this.addL2Counter("mali_hwc_L2_EXT_RD_BUF_FULL","Read Data Buffer full stalls");
this.addL2Counter("mali_hwc_L2_EXT_R_RAW","RAW hazard stalls");this.addL2Counter("mali_hwc_L2_EXT_W_STALL","Write Data stalls");this.addL2Counter("mali_hwc_L2_EXT_W_BUF_FULL","Write Data Buffer full");this.addL2Counter("mali_hwc_L2_EXT_R_W_HAZARD","WAW or WAR hazard stalls");this.addL2Counter("mali_hwc_L2_TAG_HAZARD","Tag hazard replays");this.addL2Cycles("mali_hwc_L2_SNOOP_FULL","Snoop buffer full");this.addL2Cycles("mali_hwc_L2_REPLAY_FULL","Replay buffer full");a.registerEventHandler("tracing_mark_write:mali_driver",
f.prototype.maliDDKEvent.bind(this));this.model_=a.model_}var c=tracing.LinuxPerfParser;f.prototype={__proto__:c.prototype,maliDDKOpenSlice:function(a,b,c,e,f){a=this.importer.model_.getOrCreateProcess(a).getOrCreateThread(b);e=/^([\w\d_]*)(?:\(\))?:?\s*(.*)$/.exec(e);a.beginSlice("gpu-driver",e[1],c,{args:e[2],blockinfo:f})},maliDDKCloseSlice:function(a,b,c){a=this.importer.model_.getOrCreateProcess(a).getOrCreateThread(b);a.openSliceCount&&a.endSlice(c)},autoDetectLineRE:function(a){var b=/^\s*\(([\w\-]*)\)\s*(\w+):\s*([\w\\\/\.\-]*@\d*):?\s*(.*)$/;
if(b.test(a))return b;b=/^s*()(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/;return b.test(a)?b:null},lineRE:null,maliDDKEvent:function(a,b,c,e,f){if(null==this.lineRE&&(this.lineRE=this.autoDetectLineRE(f[2]),null==this.lineRE))return!1;a=this.lineRE.exec(f[2]);b=""===a[1]?"mali":a[1];switch(a[2]){case "cros_trace_print_enter":this.maliDDKOpenSlice(c,b,e,a[4],a[3]);break;case "cros_trace_print_exit":this.maliDDKCloseSlice(c,b,e,[],a[3])}return!0},dvfsSample:function(a,b,c,e){e=parseInt(e);a=this.model_.getOrCreateProcess(0).getOrCreateCounter("DVFS",
a);0==a.numSeries&&(a.seriesNames.push(b),a.seriesColors.push(tracing.getStringColorId(a.name)));a.timestamps.push(c);a.samples.push(e)},dvfsEventEvent:function(a,b,c,e,f){a=/utilization=(\d+)/.exec(f[5]);if(!a)return!1;this.dvfsSample("DVFS Utilization","utilization",e,a[1]);return!0},dvfsSetClockEvent:function(a,b,c,e,f){a=/frequency=(\d+)/.exec(f[5]);if(!a)return!1;this.dvfsSample("DVFS Frequency","frequency",e,a[1]);return!0},dvfsSetVoltageEvent:function(a,b,c,e,f){a=/voltage=(\d+)/.exec(f[5]);
if(!a)return!1;this.dvfsSample("DVFS Voltage","voltage",e,a[1]);return!0},hwcSample:function(a,b,c,e,f){f=/val=(\d+)/.exec(f[5]);if(!f)return!1;f=parseInt(f[1]);a=this.model_.getOrCreateProcess(0).getOrCreateCounter(a,b);0==a.numSeries&&(a.seriesNames.push(c),a.seriesColors.push(tracing.getStringColorId(a.name)));a.timestamps.push(e);a.samples.push(f);return!0},jmSample:function(a,b,c,e){return this.hwcSample("mali:jm","JM: "+a,b,c,e)},addJMCounter:function(a,b){this.importer.registerEventHandler(a,
function(a,c,f,k,h){return this.jmSample(b,"count",k,h)}.bind(this))},addJMCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.jmSample(b,"cycles",k,h)}.bind(this))},tilerSample:function(a,b,c,e){return this.hwcSample("mali:tiler","Tiler: "+a,b,c,e)},addTilerCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.tilerSample(b,"count",k,h)}.bind(this))},addTilerCycles:function(a,b){this.importer.registerEventHandler(a,function(a,
c,f,k,h){return this.tilerSample(b,"cycles",k,h)}.bind(this))},fragSample:function(a,b,c,e){return this.hwcSample("mali:fragment","Fragment: "+a,b,c,e)},addFragCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.fragSample(b,"count",k,h)}.bind(this))},addFragCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.fragSample(b,"cycles",k,h)}.bind(this))},computeSample:function(a,b,c,e){return this.hwcSample("mali:compute","Compute: "+
a,b,c,e)},addComputeCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.computeSample(b,"count",k,h)}.bind(this))},addComputeCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.computeSample(b,"cycles",k,h)}.bind(this))},addTripipeCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.hwcSample("mali:shader","Tripipe: "+b,"cycles",k,h)}.bind(this))},arithSample:function(a,b,c,e){return this.hwcSample("mali:arith",
"Arith: "+a,b,c,e)},addArithCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.arithSample(b,"count",k,h)}.bind(this))},addArithCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.arithSample(b,"cycles",k,h)}.bind(this))},addLSCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.hwcSample("mali:ls","LS: "+b,"count",k,h)}.bind(this))},textureSample:function(a,b,c,e){return this.hwcSample("mali:texture",
"Texture: "+a,b,c,e)},addTexCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.textureSample(b,"count",k,h)}.bind(this))},addLSCCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.hwcSample("mali:lsc","LSC: "+b,"count",k,h)}.bind(this))},addAXICounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.hwcSample("mali:axi","AXI: "+b,"count",k,h)}.bind(this))},mmuSample:function(a,b,c,e){return this.hwcSample("mali:mmu",
"MMU: "+a,b,c,e)},addMMUCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.mmuSample(b,"count",k,h)}.bind(this))},addMMUCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.mmuSample(b,"cycles",k,h)}.bind(this))},l2Sample:function(a,b,c,e){return this.hwcSample("mali:l2","L2: "+a,b,c,e)},addL2Counter:function(a,b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.l2Sample(b,"count",k,h)}.bind(this))},addL2Cycles:function(a,
b){this.importer.registerEventHandler(a,function(a,c,f,k,h){return this.l2Sample(b,"cycles",k,h)}.bind(this))}};c.registerSubtype(f);return{LinuxPerfMaliParser:f}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("power_start",f.prototype.powerStartEvent.bind(this));a.registerEventHandler("power_frequency",f.prototype.powerFrequencyEvent.bind(this));a.registerEventHandler("cpu_frequency",f.prototype.cpuFrequencyEvent.bind(this));a.registerEventHandler("cpu_idle",f.prototype.cpuIdleEvent.bind(this))}var c=tracing.LinuxPerfParser;f.prototype={__proto__:c.prototype,cpuStateSlice:function(a,b,c,e){b=this.importer.getOrCreateCpuState(b);
"1"!=c?this.importer.importError("Don't understand power_start events of type "+c):(c=b.cpu.getOrCreateCounter("","C-State"),0==c.numSeries&&(c.seriesNames.push("state"),c.seriesColors.push(tracing.getStringColorId(c.name+".state"))),c.timestamps.push(a),c.samples.push(e))},cpuIdleSlice:function(a,b,c){b=this.importer.getOrCreateCpuState(b).cpu.getOrCreateCounter("","C-State");0==b.numSeries&&(b.seriesNames.push("state"),b.seriesColors.push(tracing.getStringColorId(b.name)));4294967295!=c?b.samples.push(c):
b.samples.push(0);b.timestamps.push(a)},cpuFrequencySlice:function(a,b,c){b=this.importer.getOrCreateCpuState(b).cpu.getOrCreateCounter("","Clock Frequency");0==b.numSeries&&(b.seriesNames.push("state"),b.seriesColors.push(tracing.getStringColorId(b.name+".state")));b.timestamps.push(a);b.samples.push(c)},powerStartEvent:function(a,b,c,e,f){a=/type=(\d+) state=(\d) cpu_id=(\d)+/.exec(f[5]);if(!a)return!1;b=parseInt(a[3]);c=parseInt(a[2]);this.cpuStateSlice(e,b,a[1],c);return!0},powerFrequencyEvent:function(a,
b,c,e,f){b=/type=(\d+) state=(\d+) cpu_id=(\d)+/.exec(f[5]);if(!b)return!1;a=parseInt(b[3]);b=parseInt(b[2]);this.cpuFrequencySlice(e,a,b);return!0},cpuFrequencyEvent:function(a,b,c,e,f){b=/state=(\d+) cpu_id=(\d)+/.exec(f[5]);if(!b)return!1;a=parseInt(b[2]);b=parseInt(b[1]);this.cpuFrequencySlice(e,a,b);return!0},cpuIdleEvent:function(a,b,c,e,f){b=/state=(\d+) cpu_id=(\d)+/.exec(f[5]);if(!b)return!1;a=parseInt(b[2]);b=parseInt(b[1]);this.cpuIdleSlice(e,a,b);return!0}};c.registerSubtype(f);return{LinuxPerfPowerParser:f}});
base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("sched_switch",f.prototype.schedSwitchEvent.bind(this));a.registerEventHandler("sched_wakeup",f.prototype.schedWakeupEvent.bind(this))}var c=tracing.LinuxPerfParser;TestExports={};var a=RegExp("prev_comm=(.+) prev_pid=(\\d+) prev_prio=(\\d+) prev_state=(\\S\\+?|\\S\\|\\S) ==> next_comm=(.+) next_pid=(\\d+) next_prio=(\\d+)");TestExports.schedSwitchRE=a;var b=/comm=(.+) pid=(\d+) prio=(\d+) success=(\d+) target_cpu=(\d+)/;TestExports.schedWakeupRE=
b;f.prototype={__proto__:c.prototype,schedSwitchEvent:function(b,c,f,k,h){var j=a.exec(h[5]);if(!j)return!1;b=j[4];f=j[5];h=parseInt(j[6]);j=parseInt(j[7]);this.importer.getOrCreateCpuState(c).switchRunningLinuxPid(this.importer,b,k,h,f,j);return!0},schedWakeupEvent:function(a,c,f,k,h){c=b.exec(h[5]);if(!c)return!1;a=c[1];f=parseInt(c[2]);c=parseInt(c[3]);this.importer.markPidRunnable(k,f,a,c);return!0}};c.registerSubtype(f);return{LinuxPerfSchedParser:f,_LinuxPerfSchedParserTestExports:TestExports}});
base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(a){c.call(this,a);a.registerEventHandler("workqueue_execute_start",f.prototype.executeStartEvent.bind(this));a.registerEventHandler("workqueue_execute_end",f.prototype.executeEndEvent.bind(this))}var c=tracing.LinuxPerfParser,a=/work struct (.+): function (\S+)/,b=/work struct (.+)/;f.prototype={__proto__:c.prototype,executeStartEvent:function(b,c,f,k,h){b=a.exec(h[5]);if(!b)return!1;h=this.importer.getOrCreateKernelThread(h[1]);h.openSliceTS=k;h.openSlice=
b[2];return!0},executeEndEvent:function(a,c,f,k,h){if(!b.exec(h[5]))return!1;a=this.importer.getOrCreateKernelThread(h[1]);a.openSlice&&(k=new tracing.TimelineSlice("",a.openSlice,tracing.getStringColorId(a.openSlice),a.openSliceTS,{},k-a.openSliceTS),a.thread.pushSlice(k));a.openSlice=void 0;return!0}};c.registerSubtype(f);return{LinuxPerfWorkqueueParser:f}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function f(b){a.call(this,b);b.registerEventHandler("tracing_mark_write:android",f.prototype.traceMarkWriteAndroidEvent.bind(this));b.registerEventHandler("0:android",f.prototype.traceMarkWriteAndroidEvent.bind(this));this.model_=b.model_;this.ppids_={}}function c(a){var c={};if(a){a=a.split(";");for(var e=0;e<a.length;++e){var f=a[e].split("=");f[0]&&(c[f[0]]=f[1])}}return c}var a=tracing.LinuxPerfParser;f.prototype={__proto__:a.prototype,traceMarkWriteAndroidEvent:function(a,
d,e,f,k,h){a=k[2].split("|");switch(a[0]){case "B":d=parseInt(a[1]);var j=a[2];k=this.model_.getOrCreateProcess(d).getOrCreateThread(e);k.name=h;if(!k.isTimestampValidForBeginOrEnd(f))return this.model_.importErrors.push("Timestamps are moving backward."),!1;this.ppids_[e]=d;k.beginSlice(null,j,f,c(a[3]));break;case "E":d=this.ppids_[e];if(void 0===d)break;k=this.model_.getOrCreateProcess(d).getOrCreateThread(e);if(!k.openSliceCount)break;f=k.endSlice(f);e=c(a[3]);for(j in e)void 0!==f.args[j]&&this.model_.importErrors.push("Both the B and E events of "+
f.name+"provided values for argument "+j+". The value of the E event will be used."),f.args[j]=e[j];break;case "C":d=parseInt(a[1]);j=a[2];e=parseInt(a[3]);j=this.model_.getOrCreateProcess(d).getOrCreateCounter(null,j);0==j.numSeries&&(j.seriesNames.push("value"),j.seriesColors.push(tracing.getStringColorId(j.name+".value")));j.timestamps.push(f);j.samples.push(e);break;default:return!1}return!0}};a.registerSubtype(f);return{LinuxPerfAndroidParser:f}});"use strict";base.require("timeline_model");
base.require("timeline_color_scheme");base.require("linux_perf_block_parser");base.require("linux_perf_bus_parser");base.require("linux_perf_clock_parser");base.require("linux_perf_cpufreq_parser");base.require("linux_perf_drm_parser");base.require("linux_perf_exynos_parser");base.require("linux_perf_gesture_parser");base.require("linux_perf_i915_parser");base.require("linux_perf_mali_parser");base.require("linux_perf_power_parser");base.require("linux_perf_sched_parser");base.require("linux_perf_workqueue_parser");
base.require("linux_perf_android_parser");
base.exportTo("tracing",function(){function f(a){this.cpu=a}function c(a,b){this.importPriority=2;this.model_=a;this.events_=b;this.clockSyncRecords_=[];this.cpuStates_={};this.kernelThreadStates_={};this.buildMapFromLinuxPidsToTimelineThreads();this.lineNumberBase=0;this.lineNumber=-1;this.pseudoThreadCounter=1;this.parsers_=[];this.eventHandlers_={}}function a(a){return b.test(a)?b:d.test(a)?d:null}f.prototype={__proto__:Object.prototype,switchRunningLinuxPid:function(a,b,c,d,f,l){if(void 0!==this.lastActivePid&&
0!=this.lastActivePid){var r=c-this.lastActiveTs;a=(a=a.threadsByLinuxPid[this.lastActivePid])?a.userFriendlyName:this.lastActiveComm;b=new tracing.TimelineSlice("",a,tracing.getStringColorId(a),this.lastActiveTs,{comm:this.lastActiveComm,tid:this.lastActivePid,prio:this.lastActivePrio,stateWhenDescheduled:b},r);this.cpu.slices.push(b)}this.lastActiveTs=c;this.lastActivePid=d;this.lastActiveComm=f;this.lastActivePrio=l}};TestExports={};var b=/^\s*(.+?)\s+\[(\d+)\]\s+[dX.][N.][Hhs.][0-9a-f.]\s+(\d+\.\d+):\s+(\S+):\s(.*)$/;
TestExports.lineREWithIRQInfo=b;var d=/^\s*(.+?)\s+\[(\d+)\]\s*(\d+\.\d+):\s+(\S+):\s(.*)$/;TestExports.lineRE=d;TestExports.traceEventClockSyncRE=/trace_event_clock_sync: parent_ts=(\d+\.?\d*)/;TestExports.autoDetectLineRE=a;c.canImport=function(b){if(!("string"===typeof b||b instanceof String))return!1;if(c._extractEventsFromSystraceHTML(b,!1).ok||/^# tracer:/.test(b))return!0;var d=/^(.+)\n/.exec(b);d&&(b=d[1]);return a(b)?!0:!1};c._extractEventsFromSystraceHTML=function(a,b){function c(a){for(;r<
l.length;r++)if(a.test(l[r]))return!0;return!1}function d(a,b){return-1===a.indexOf(b,a.length-b.length)?a:a.substring(a,a.length-b.length)}var f={ok:!1};void 0===b&&(b=!0);if(!1==/^<!DOCTYPE HTML>/.test(a))return f;var l=a.split("\n"),r=1;if(!c(/^ <script>$/)||!c(/^ var linuxPerfData = "\\$/))return f;var m=r+1;if(!c(/^ <\/script>$/))return f;var p=r;if(!c(/^<\/body>$/)||!c(/^<\/html>$/))return f;var q=l.slice(m,p),p=[];if(b)for(var s=0;s<q.length;s++){var u=q[s],u=d(u,"\\n\\");p.push(u)}else p=
[q[q.length-1]];q=p[p.length-1];s=d(q,'\\n";');if(s==q)return f;p[p.length-1]=s;return{ok:!0,lines:b?p:void 0,events_begin_at_line:m}};c.prototype={__proto__:Object.prototype,get model(){return this.model_},buildMapFromLinuxPidsToTimelineThreads:function(){this.threadsByLinuxPid={};this.model_.getAllThreads().forEach(function(a){this.threadsByLinuxPid[a.tid]=a}.bind(this))},getOrCreateCpuState:function(a){if(!this.cpuStates_[a]){var b=this.model_.getOrCreateCpu(a);this.cpuStates_[a]=new f(b)}return this.cpuStates_[a]},
getOrCreateKernelThread:function(a,b,c){this.kernelThreadStates_[a]||(void 0==b&&(b=/.+-(\d+)/.exec(a)[1],b=parseInt(b,10)),void 0==c&&(c=b),c=this.model_.getOrCreateProcess(b).getOrCreateThread(c),c.name=a,this.kernelThreadStates_[a]={pid:b,thread:c,openSlice:void 0,openSliceTS:void 0},this.threadsByLinuxPid[b]=c);return this.kernelThreadStates_[a]},getOrCreatePseudoThread:function(a){var b=this.kernelThreadStates_[a];b||(b=this.getOrCreateKernelThread(a,0,this.pseudoThreadCounter),this.pseudoThreadCounter++);
return b},importEvents:function(a){this.createParsers();this.importCpuData();this.alignClocks(a)&&(this.buildMapFromLinuxPidsToTimelineThreads(),this.buildPerThreadCpuSlicesFromCpuState())},finalizeImport:function(){},buildPerThreadCpuSlicesFromCpuState:function(){for(var a in this.cpuStates_)for(var b=this.cpuStates_[a].cpu,c=0;c<b.slices.length;c++){var d=b.slices[c],f=this.threadsByLinuxPid[d.args.tid];f&&(f.tempCpuSlices||(f.tempCpuSlices=[]),f.tempCpuSlices.push(d))}var l=tracing.getColorIdByName("running"),
r=tracing.getColorIdByName("runnable"),m=tracing.getColorIdByName("sleeping"),p=tracing.getColorIdByName("iowait");this.model_.getAllThreads().forEach(function(a){if(a.tempCpuSlices){var b=a.tempCpuSlices;delete a.tempCpuSlices;b.sort(function(a,b){return a.start-b.start});var c=[];if(b.length){var d=b[0];c.push(new tracing.TimelineSlice("","Running",l,d.start,{},d.duration))}for(d=1;d<b.length;d++){var e=b[d-1],f=b[d],g=f.start-e.end;if("S"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("",
"Sleeping",m,e.end,{},g));else if("R"==e.args.stateWhenDescheduled||"R+"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Runnable",r,e.end,{},g));else if("D"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Uninterruptible Sleep",p,e.end,{},g));else if("T"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","__TASK_STOPPED",p,e.end,{},g));else if("t"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","debug",p,e.end,{},g));else if("Z"==
e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Zombie",p,e.end,{},g));else if("X"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Exit Dead",p,e.end,{},g));else if("x"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Task Dead",p,e.end,{},g));else if("W"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","WakeKill",p,e.end,{},g));else if("D|W"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Uninterruptable Sleep | WakeKill",
p,e.end,{},g));else throw Error("Unrecognized state: ")+e.args.stateWhenDescheduled;c.push(new tracing.TimelineSlice("","Running",l,f.start,{},f.duration))}a.cpuSlices=c}})},alignClocks:function(a){if(0==this.clockSyncRecords_.length){if(!a)return!0;this.abortImport();return!1}a=this.clockSyncRecords_[0];if(0==a.parentTS||a.parentTS==a.perfTS)return!0;a=a.parentTS-a.perfTS;for(var b in this.cpuStates_){for(var c=this.cpuStates_[b].cpu,d=0;d<c.slices.length;d++){var f=c.slices[d];f.start+=a;f.duration=
f.duration}for(var l in c.counters){d=c.counters[l];for(f=0;f<d.timestamps.length;f++)d.timestamps[f]+=a}}for(var r in this.kernelThreadStates_)this.kernelThreadStates_[r].thread.shiftTimestampsForward(a);return!0},abortImport:function(){if(this.pushedEventsToThreads)throw Error("Cannot abort, have alrady pushedCpuDataToThreads.");for(var a in this.cpuStates_)delete this.model_.cpus[a];for(var b in this.kernelThreadStates_){a=this.kernelThreadStates_[b].thread;var c=a.parent;delete c.threads[a.tid];
delete this.model_.processes[c.pid]}this.model_.importErrors.push("Cannot import kernel trace without a clock sync.")},createParsers:function(){for(var a=tracing.LinuxPerfParser.getSubtypeConstructors(),b=0;b<a.length;++b)this.parsers_.push(new a[b](this));this.registerEventHandler("tracing_mark_write:trace_event_clock_sync",c.prototype.traceClockSyncEvent.bind(this));this.registerEventHandler("tracing_mark_write",c.prototype.traceMarkingWriteEvent.bind(this));this.registerEventHandler("0:trace_event_clock_sync",
c.prototype.traceClockSyncEvent.bind(this));this.registerEventHandler("0",c.prototype.traceMarkingWriteEvent.bind(this))},registerEventHandler:function(a,b){this.eventHandlers_[a]=b},markPidRunnable:function(){},importError:function(a){this.model_.importErrors.push("Line "+(this.lineNumberBase+this.lineNumber+1)+": "+a)},traceClockSyncEvent:function(a,b,c,d,f){a=/parent_ts=(\d+\.?\d*)/.exec(f[2]);if(!a)return!1;this.clockSyncRecords_.push({perfTS:d,parentTS:1E3*a[1]});return!0},traceMarkingWriteEvent:function(a,
b,c,d,f,l){var r=/^\s*(\w+):\s*(.*)$/.exec(f[5]);if(!r)if(l=f[5].substring(0,2),"B|"==l||"E"==l||"E|"==l||"C|"==l)r=[f[5],"android",f[5]];else return!1;a=a+":"+r[1];l=/(.+)-\d+/.exec(f[1])[1];f=this.eventHandlers_[a];return!f?(this.importError("Unknown trace_marking_write event "+a),!0):f(a,b,c,d,r,l)},importCpuData:function(){var b=c._extractEventsFromSystraceHTML(this.events_,!0);b.ok?(this.lineNumberBase=b.events_begin_at_line,this.lines_=b.lines):(this.lineNumberBase=0,this.lines_=this.events_.split("\n"));
b=null;for(this.lineNumber=0;this.lineNumber<this.lines_.length;++this.lineNumber){var d=this.lines_[this.lineNumber];if(!(0==d.length||/^#/.test(d))){if(null==b&&(b=a(d),null==b)){this.importError("Cannot parse line: "+d);continue}var f=b.exec(d);if(f){var h=parseInt(/.+-(\d+)/.exec(f[1])[1]),j=parseInt(f[2]),l=1E3*parseFloat(f[3]),r=f[4],m=this.eventHandlers_[r];m?m(r,j,h,l,f)||this.importError("Malformed "+r+" event ("+d+")"):this.importError("Unknown event "+r+" ("+d+")")}else this.importError("Unrecognized line: "+
d)}}}};tracing.TimelineModel.registerImporter(c);return{LinuxPerfImporter:c,_LinuxPerfImporterTestExports:TestExports}});"use strict";
base.exportTo("base",function(){function f(){this.storage_=a?a:"G_testRunner"in global?new c:localStorage}function c(){}var a=void 0;f.setAlternativeStorageInstance=function(b){a=b};f.prototype={get:function(a,c,e){a=this.namespace_(a,e);a=this.storage_.getItem(a);return void 0===a?c:String(a)},set:function(a,c,e){this.storage_.setItem(this.namespace_(a,e),String(c))},keys:function(a){var c=[];a=a||"";for(var e=0;e<this.storage_.length;e++){var f=this.storage_.key(e);this.isnamespaced_(f,a)&&c.push(this.unnamespace_(f,
a))}return c},isnamespaced_:function(a,c){return 0==a.indexOf(this.normalize_(c))},namespace_:function(a,c){return this.normalize_(c)+a},unnamespace_:function(a,c){return a.replace(this.normalize_(c),"")},normalize_:function(a){return f.NAMESPACE+(a?a+".":"")}};f.NAMESPACE="trace-viewer";c.prototype={__proto__:Object.prototype,getItem:function(a){return this[a]},setItem:function(a,c){this[a]=c},key:function(a){return Object.keys(this).sort()[a]},get length(){return Object.keys(this).length}};return{Settings:f}});
"use strict";base.requireStylesheet("timeline_view");base.require("timeline");base.require("timeline_analysis");base.require("timeline_category_filter_dialog");base.require("timeline_filter");base.require("timeline_find_control");base.require("overlay");base.require("trace_event_importer");base.require("linux_perf_importer");base.require("settings");
base.exportTo("tracing",function(){var f=base.ui.define("div");f.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("timeline-view");this.titleEl_=document.createElement("div");this.titleEl_.textContent="Tracing: ";this.titleEl_.className="title";this.controlDiv_=document.createElement("div");this.controlDiv_.className="control";this.leftControlsEl_=document.createElement("div");this.leftControlsEl_.className="controls";this.rightControlsEl_=document.createElement("div");
this.rightControlsEl_.className="controls";var a=document.createElement("div");a.className="spacer";this.timelineContainer_=document.createElement("div");this.timelineContainer_.className="timeline-container";var b=document.createElement("div");b.className="analysis-container";this.analysisEl_=new tracing.TimelineAnalysisView;this.dragEl_=new c;this.dragEl_.target=b;this.findCtl_=new tracing.TimelineFindControl;this.findCtl_.controller=new tracing.TimelineFindController;this.importErrorsButton_=this.createImportErrorsButton_();
this.categoryFilterButton_=this.createCategoryFilterButton_();this.categoryFilterButton_.callback=this.updateCategoryFilterFromSettings_.bind(this);this.metadataButton_=this.createMetadataButton_();this.rightControls.appendChild(this.importErrorsButton_);this.rightControls.appendChild(this.categoryFilterButton_);this.rightControls.appendChild(this.metadataButton_);this.rightControls.appendChild(this.findCtl_);this.controlDiv_.appendChild(this.titleEl_);this.controlDiv_.appendChild(this.leftControlsEl_);
this.controlDiv_.appendChild(a);this.controlDiv_.appendChild(this.rightControlsEl_);this.appendChild(this.controlDiv_);this.appendChild(this.timelineContainer_);this.appendChild(this.dragEl_);b.appendChild(this.analysisEl_);this.appendChild(b);this.rightControls.appendChild(this.createHelpButton_());this.onSelectionChangedBoundToThis_=this.onSelectionChanged_.bind(this);document.addEventListener("keypress",this.onKeypress_.bind(this),!0)},createImportErrorsButton_:function(){function a(){c.style.display=
k.model&&k.model.importErrors.length?"":"none"}var b=new tracing.Overlay;b.classList.add("timeline-view-import-errors-overlay");b.autoClose=!0;var c=document.createElement("div");c.className="timeline-button timeline-view-import-errors-button timeline-view-info-button";c.textContent="Import errors!";var e=document.createElement("div");e.className="info-button-text import-errors-dialog-text";var f=document.createElement("div");f.className="info-button-containerimport-errors-dialog";f.textContent="Errors occurred during import:";
f.appendChild(e);b.appendChild(f);var k=this;c.addEventListener("click",function(){b.visible=!0;e.textContent=k.model.importErrors.join("\n")}.bind(this));a();k.addEventListener("modelChange",a);return c},createCategoryFilterButton_:function(){function a(){c.style.display=e.model?"":"none"}var b,c=document.createElement("div");c.className="timeline-button timeline-view-info-button";c.textContent="Categories";c.__defineSetter__("callback",function(a){b=a});var e=this;a();e.addEventListener("modelChange",
a);c.addEventListener("click",function(){var a=new tracing.TimelineCategoryFilterDialog;a.model=e.model;a.settings=e.settings;a.settingUpdatedCallback=b;a.visible=!0}.bind(this));return c},createHelpButton_:function(){var a=new tracing.Overlay;a.classList.add("timeline-view-help-overlay");a.autoClose=!0;a.additionalCloseKeyCodes.push(63);var b=document.createElement("div");b.className="timeline-button timeline-view-help-button";b.textContent="?";var c=document.createElement("div");c.style.whiteSpace=
"pre";c.style.fontFamily="monospace";a.appendChild(c);b.addEventListener("click",function(b){a.visible=!0;c.textContent=this.timeline_?this.timeline_.keyHelp:"No content loaded. For interesting help, load something.";b.stopPropagation();return!1}.bind(this));return b},createMetadataButton_:function(){function a(){c.style.display=k.model&&k.model.metadata.length?"":"none"}var b=new tracing.Overlay;b.classList.add("timeline-view-metadata-overlay");b.autoClose=!0;var c=document.createElement("div");
c.className="timeline-button timeline-view-metadata-button timeline-view-info-button";c.textContent="Metadata";var e=document.createElement("div");e.className="info-button-text metadata-dialog-text";var f=document.createElement("div");f.className="info-button-container metadata-dialog";f.textContent="Metadata Info:";f.appendChild(e);b.appendChild(f);var k=this;c.addEventListener("click",function(){b.visible=!0;var a=[],c=k.model,d;for(d in c.metadata)a.push(JSON.stringify(c.metadata[d].name)+": "+
JSON.stringify(c.metadata[d].value,void 0," "));e.textContent=a.join("\n")}.bind(this));a();k.addEventListener("modelChange",a);return c},get leftControls(){return this.leftControlsEl_},get rightControls(){return this.rightControlsEl_},get title(){return this.titleEl_.textContent.substring(this.titleEl_.textContent.length-2)},set title(a){this.titleEl_.textContent=a+":"},set traceData(a){this.model=new tracing.TimelineModel(a)},get model(){if(this.timeline_)return this.timeline_.model},set model(a){var b=
a!=this.model,c=a&&!a.bounds.isEmpty;b&&(this.timelineContainer_.textContent="",this.timeline_&&(this.timeline_.removeEventListener("selectionChange",this.onSelectionChangedBoundToThis_),this.timeline_.detach(),this.timeline_=void 0,this.findCtl_.controller.timeline=void 0));c&&!this.timeline_&&(this.timeline_=new tracing.Timeline,this.timeline_.focusElement=this.focusElement_?this.focusElement_:this.parentElement,this.timelineContainer_.appendChild(this.timeline_),this.findCtl_.controller.timeline=
this.timeline_,this.timeline_.addEventListener("selectionChange",this.onSelectionChangedBoundToThis_),this.updateCategoryFilterFromSettings_());c&&(this.timeline_.model=a);base.dispatchSimpleEvent(this,"modelChange");if(b)this.onSelectionChanged_()},get timeline(){return this.timeline_},get settings(){this.settings_||(this.settings_=new base.Settings);return this.settings_},set focusElement(a){this.focusElement_=a;this.timeline_&&(this.timeline_.focusElement=a)},get focusElement(){return this.focusElement_?
this.focusElement_:this.parentElement},get isAttachedToDocument_(){for(var a=this;a.parentNode;)a=a.parentNode;return a==this.ownerDocument},get listenToKeys_(){if(this.isAttachedToDocument_)return!this.focusElement_?!0:0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0},onKeypress_:function(a){this.listenToKeys_&&(47==event.keyCode?(this.findCtl_.focus(),event.preventDefault()):63==a.keyCode&&(this.querySelector(".timeline-view-help-button").click(),a.preventDefault()))},
beginFind:function(){if(!this.findInProgress_){this.findInProgress_=!0;var a=tracing.TimelineFindControl();a.controller=new tracing.TimelineFindController;a.controller.timeline=this.timeline;a.visible=!0;a.addEventListener("close",function(){this.findInProgress_=!1}.bind(this));a.addEventListener("findNext",function(){});a.addEventListener("findPrevious",function(){})}},onSelectionChanged_:function(){var a=this.timelineContainer_.scrollTop,b=this.timeline_?this.timeline_.selection:new tracing.TimelineSelection;
this.analysisEl_.selection=b;this.timelineContainer_.scrollTop=a},updateCategoryFilterFromSettings_:function(){if(this.timeline_){for(var a=this.settings.keys("categories"),b=[],c=0;c<a.length;c++)"false"==this.settings.get(a[c],"true","categories")&&b.push(a[c]);this.timeline_.categoryFilter=new tracing.TimelineCategoryFilter(b)}}};var c=base.ui.define("div");c.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="timeline-drag-handle";this.lastMousePosY=0;this.dragAnalysis=
this.dragAnalysis.bind(this);this.onMouseUp=this.onMouseUp.bind(this);this.addEventListener("mousedown",this.onMouseDown)},dragAnalysis:function(a){var b=this.lastMousePosY-a.clientY;this.target.style.height||(this.target.style.height=window.getComputedStyle(this.target).height);this.target.style.height=parseInt(this.target.style.height)+b+"px";this.lastMousePosY=a.clientY},onMouseDown:function(a){this.lastMousePosY=a.clientY;document.addEventListener("mousemove",this.dragAnalysis);document.addEventListener("mouseup",
this.onMouseUp);a.stopPropagation();return!1},onMouseUp:function(){document.removeEventListener("mousemove",this.dragAnalysis);document.removeEventListener("mouseup",this.onMouseUp)}};return{TimelineView:f}});