blob: 8c65b2fab9e319354d432887efebab6076cc7440 [file] [log] [blame]
window.FLATTENED={};window.FLATTENED[".usr.local.google.home.konkers.android-jb-mr1.external.chromium-trace.trace-viewer.src.base"]=!0;window.FLATTENED.event_target=!0;window.FLATTENED.measuring_stick=!0;window.FLATTENED.timeline_filter=!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_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=!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_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[".usr.local.google.home.konkers.android-jb-mr1.external.chromium-trace.trace-viewer.src.timeline_view"]=!0;"use strict";var global=this;
this.base=function(){function e(a){"/"==a[a.length-1]&&(a=a.substring(0,a.length-1));q=a}function c(a,b){p[a]||(p[a]=[]);for(var d=p[a],f=!1,g=0;g<d.length;g++)d[g]==b&&(f=!0);f||d.push(b)}function a(a,b){s[a]||(s[a]=[]);for(var d=s[a],f=!1,g=0;g<d.length;g++)d[g]==b&&(f=!0);f||d.push(b)}function b(){if(!m){m=!0;var b=new XMLHttpRequest;b.open("GET",q+"/deps.js",!1);b.send(null);if(200!=b.status)throw Error("Could not find "+deps+". Run calcdeps.py and try again.");base.addModuleStylesheet=a;base.addModuleDependency=
c;try{eval(b.responseText)}catch(d){throw Error("When loading deps, got "+d.stack?d.stack:d);}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 flattened!");}else if(b(),"APPENDED"!=t[a]){if("RESOLVING"==t[a])throw Error("Circular dependency betwen modules. Cannot continue!");t[a]="RESOLVING";for(var l=s[a]||[],h=0;h<l.length;h++)f(l[h]);l=p[a]||[];for(h=0;h<l.length;h++)d(l[h],
c+1);c=a.replace(/\./g,"/")+".js";base.doc.write('<script type="text/javascript" src="'+(q+"/"+c)+'"><\/script>');t[a]="APPENDED"}}function f(a){if(!window.FLATTENED&&!u[a]){u[a]=!0;var a=a.replace(/\./g,"/")+".css",a=q+"/"+a,b=document.createElement("link");b.setAttribute("rel","stylesheet");b.setAttribute("href",a);base.doc.head.appendChild(b)}}function g(a,b,d,f){var g=new base.Event(b+"Change");g.propertyName=b;g.newValue=d;g.oldValue=f;a.dispatchEvent(g)}function l(a){return a.replace(/([A-Z])/g,
"-$1").toLowerCase()}function h(a,b){switch(b){case r.JS:var d=a+"_";return function(){return this[d]};case r.ATTR:var f=l(a);return function(){return this.getAttribute(f)};case r.BOOL_ATTR:return f=l(a),function(){return this.hasAttribute(f)}}}function j(a,b,d){switch(b){case r.JS:var f=a+"_";return function(b){var c=this[f];b!==c&&(this[f]=b,d&&d.call(this,b,c),g(this,a,b,c))};case r.ATTR:var c=l(a);return function(b){var f=this[c];b!==f&&(void 0==b?this.removeAttribute(c):this.setAttribute(c,b),
d&&d.call(this,b,f),g(this,a,b,f))};case r.BOOL_ATTR:return c=l(a),function(b){var f=this[c];b!==f&&(b?this.setAttribute(c,a):this.removeAttribute(c),d&&d.call(this,b,f),g(this,a,b,f))}}}function k(a,b,d){var f=base.doc.createEvent("Event");f.initEvent(a,!!b,!!d);f.__proto__=global.Event.prototype;return f}var q=".",m=!1,p={},s={},t={},u={},r={JS:"js",ATTR:"attr",BOOL_ATTR:"boolAttr"},w=1;return{set moduleBasePath(a){e(a)},get moduleBasePath(){return q},require:d,requireStylesheet:f,exportTo:function(a,
b){var d;d=a.split(".");for(var f=global,g;d.length&&(g=d.shift());)f=g in f?f[g]:f[g]={};d=f;try{var c=b()}catch(l){console.log("While running exports for ",name,":");console.log(l.stack||l);return}for(var h in c)(f=Object.getOwnPropertyDescriptor(c,h))&&Object.defineProperty(d,h,f)},addSingletonGetter:function(a){a.getInstance=function(){return a.instance_||(a.instance_=new a)}},createUid:function(){return w++},defineProperty:function(a,b,d,f){"function"==typeof a&&(a=a.prototype);d=d||r.JS;a.__lookupGetter__(b)||
a.__defineGetter__(b,h(b,d));a.__lookupSetter__(b)||a.__defineSetter__(b,j(b,d,f))},dispatchPropertyChange:g,dispatchSimpleEvent:function(a,b,d,f){b=new base.Event(b,d,f);return a.dispatchEvent(b)},Event:k,getUid:function(a){return a.hasOwnProperty("uid")?a.uid:a.uid=w++},initialize:function(){if(global.document)k.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),e("/src");else{var a=cr;Object.defineProperty(global,"cr",{get:function(){Object.defineProperty(global,"cr",{value:a});originalBase.initialize();return a},configurable:!0})}},PropertyKind:r}}();base.initialize();
base.exportTo("base",function(){function e(){}e.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(),f=0,g;g=b[f];f++)d=g.handleEvent?d|!1===g.handleEvent.call(g,c):d|!1===g.call(this,c);return!d&&c.returnValue}};return{EventTarget:e}});
base.exportTo("tracing",function(){function e(){this.iframe_=void 0}e.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:e}});"use strict";
base.exportTo("tracing",function(){function e(){}function c(a){this.text_=a}function a(a){this.categories_={};for(var a=a||[],d=0;d<a.length;d++)this.addCategory(a[d])}e.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__:e.prototype,matchSlice:function(a){return 0==this.text_.length||void 0===a.title?!1:-1!=a.title.indexOf(this.text_)}};
a.prototype={__proto__:e.prototype,addCategory:function(a){this.categories_[a]=!0},matchSlice:function(a){return!a.category?!0:!this.categories_[a.category]}};return{filterSliceArray:function(a,d){if(void 0===a)return d;for(var f=[],g=0;g<d.length;++g)a.matchSlice(d[g])&&f.push(d[g]);return f},TimelineFilter:e,TimelineTitleFilter:c,TimelineCategoryFilter:a}});"use strict";base.require("event_target");
base.exportTo("tracing",function(){function e(a,d){this.track=a;this.slice=d}function c(a,d,f){this.track=a;this.counter=d;this.sampleIndex=f}function a(){this.range_dirty_=!0;this.range_={};this.length_=0}e.prototype={get selected(){return this.slice.selected},set selected(a){this.slice.selected=a}};c.prototype={get selected(){return!0==this.track.selectedSamples[this.sampleIndex]},set selected(a){this.track.selectedSamples[this.sampleIndex]=a?!0:!1;this.track.invalidate()}};a.prototype={__proto__:Object.prototype,
get range(){if(this.range_dirty_){for(var a=Infinity,d=-a,f=0;f<this.length_;f++){var g=this[f];g.slice&&(a=Math.min(a,g.slice.start),d=Math.max(d,g.slice.end))}this.range_={min:a,max:d};this.range_dirty_=!1}return this.range_},get duration(){return this.range.max-this.range.min},get length(){return this.length_},clear:function(){for(var a=0;a<this.length_;++a)delete this[a];this.length_=0;this.range_dirty_=!0},push_:function(a){this[this.length_++]=a;this.range_dirty_=!0;return a},addSlice:function(a,
d){return this.push_(new e(a,d))},addCounterSample:function(a,d,f){return this.push_(new c(a,d,f))},subSelection:function(b,d){var d=d||1,f=new a;f.range_dirty_=!0;if(0>b||b+d>this.length_)throw Error("Index out of bounds");for(var g=b;g<b+d;g++)f.push_(this[g]);return f},getCounterSampleHits:function(){for(var b=new a,d=0;d<this.length_;d++)this[d]instanceof c&&b.push_(this[d]);return b},getSliceHits:function(){for(var b=new a,d=0;d<this.length_;d++)this[d]instanceof e&&b.push_(this[d]);return b},
map:function(a){for(var d=0;d<this.length_;d++)a(this[d])},getShiftedSelection:function(b){for(var d=new a,f=0;f<this.length_;f++){var g=this[f];g.track.addItemNearToProvidedHitToSelection(g,b,d)}return 0==d.length?void 0:d}};return{TimelineSelectionSliceHit:e,TimelineSelectionCounterSampleHit:c,TimelineSelection:a}});"use strict";base.require("event_target");
base.exportTo("tracing",function(){function e(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}e.prototype={__proto__:base.EventTarget.prototype,drawUnderContent:function(){},drawOverContent:function(a,
b,d,f){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,f)}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,f,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},xPanWorldRangeIntoView:function(a,b,d){0>this.xWorldToView(a)?this.xPanWorldPosToViewPos(a,"left",d):this.xWorldToView(b)>d&&this.xPanWorldPosToViewPos(b,"right",d)},xSetWorldRange: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),f=0;f<this.markers.length;++f)if(Math.abs(this.markers[f].positionWorld-a)<=d)return this.markers[f]}};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,f,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!=f&&(a.beginPath(),a.moveTo(b,g),a.lineTo(b,f),a.closePath(),a.strokeStyle=
this.color,a.stroke()))},drawLine:function(a,b,d,f,g){a.beginPath();var c=this.positionWorld_;c>=b&&c<d&&(b=g.xWorldToView(c),a.moveTo(b,0),a.lineTo(b,f));a.strokeStyle=this.color;a.stroke()}};return{TimelineViewport:e,TimelineViewportMarker:c}});
base.exportTo("base.ui",function(){function e(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,f;f=b[d];d++)f instanceof a||a.decorate(f)},define:function(c){function a(f){var g=b(d,f);a.decorate(g);for(var c in f)g[c]=f[c];return g}var b,d;"function"==typeof c?(b=c,d=""):(b=e,d=c);a.decorate=function(b){b.__proto__=a.prototype;b.decorate()};return a},limitInputWidth:function(c,
a,b){function d(){if(c.scrollWidth>k)c.style.width=k+"px";else{c.style.width=0;var a=c.scrollWidth;c.style.width=a<b?b+"px":a+"px"}}c.style.width="10px";var f=c.ownerDocument.defaultView,g=f.getComputedStyle(c),f=f.getComputedStyle(a),l="rtl"==g.direction,h=c.getBoundingClientRect(),e=a.getBoundingClientRect(),h=l?e.right-h.right:h.left-e.left,g=parseInt(g.borderLeftWidth,10)+parseInt(g.paddingLeft,10)+parseInt(g.paddingRight,10)+parseInt(g.borderRightWidth,10),f=l?parseInt(f.paddingLeft,10):parseInt(f.paddingRight,
10),k=a.clientWidth-h-g-f;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 e=base.ui.define("div");e.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 f=!1;d.addEventListener("click",function(){f=!f;this.collapsedDidChange(f);d.textContent=f?"+":"\u2212"});this.appendChild(d);c||(d.style.display="None")}};return{TimelineTrack:e}});"use strict";base.require("tracks.timeline_track");base.require("timeline_filter");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineTrack);e.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 f=this.tracks_[d].getBoundingClientRect();a>=f.top&&a<f.bottom&&this.tracks_[d].addIntersectingItemsToSelection(c,a,b)}return!1},addIntersectingItemsInRangeToSelection:function(c,a,b,d,f){for(var g=0;g<this.tracks_.length;g++){var l=this.tracks_[g].getBoundingClientRect(),h=Math.max(b,l.top),l=Math.min(d,l.bottom);h<=l&&this.tracks_[g].addIntersectingItemsInRangeToSelection(c,
a,b,d,f)}},addAllObjectsMatchingFilterToSelection:function(c,a){for(var b=0;b<this.tracks_.length;b++)this.tracks_[b].addAllObjectsMatchingFilterToSelection(c,a)}};return{TimelineContainerTrack:e}});
base.exportTo("tracing",function(){function e(c,a,b,d){this.ctx_=c;this.minRectSize_=a;this.maxMergeDist_=b;this.pallette_=d}e.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:e}});"use strict";
base.exportTo("tracing",function(){function e(a){for(var b=0,d=0;d<a.length;++d)b=(b+37*b+11*a.charCodeAt(d))%4294967295;return b}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(a){var b;b=240<=a.r&&240<=a.g&&240<=a.b?-0.2:0.45;return{r:Math.min(255,a.r+Math.floor(a.r*b)),g:Math.min(255,a.g+Math.floor(a.g*b)),b:Math.min(255,a.b+
Math.floor(a.b*b))}})).map(function(a){return"rgb("+a.r+","+a.g+","+a.b+")"}),f={};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:e,getStringColorId:function(b){if(void 0===f[b]){var d=e(b);f[b]=d%a}return f[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 e=base.ui.define(tracks.TimelineTrack);e.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:e}});
base.exportTo("tracing",function(){function e(a,b,d){if(0==a.length)return 1;for(var f=0,g=a.length-1,c,h,e=-1;f<=g;)c=Math.floor((f+g)/2),h=b(a[c])-d,0>h?f=c+1:(0<h||(e=c),g=c-1);return-1!=e?e:f}function c(a,b,d,f,g,c){if(0!=a.length&&!(f>g)){var h=e(a,b,f);if(-1!=h&&(0<h&&b(a[h-1])+d(a[h-1])>=f&&c(a[h-1]),h!=a.length))for(d=a.length;h<d&&!(b(a[h])>=g);h++)c(a[h])}}return{findLowIndexInSortedArray:e,findLowIndexInSortedIntervals:function(a,b,d,f){var g=e(a,b,f);return 0==g?f>=b(a[0])&&f<b(a[0]+d(a[0]))?
0:-1:g<=a.length&&f>=b(a[g-1])&&f<b(a[g-1])+d(a[g-1])?g-1:a.length},iterateOverIntersectingIntervals:c,getIntersectingIntervals:function(a,b,d,f,g){var l=[];c(a,b,d,f,g,function(a){l.push(a)});return l}}});"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 e(){}function c(a,b){this.string=a;this.width=b}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 e;this.asyncStyle_=!1},decorateHit:function(){},get asyncStyle(){return this.asyncStyle_},set asyncStyle(a){this.asyncStyle_=!!a;this.invalidate()},get slices(){return this.slices_},
set slices(a){this.slices_=a||[];a||(this.visible=!1);this.invalidate()},get height(){return window.getComputedStyle(this).height},set height(a){this.style.height=a;this.invalidate()},labelWidth:function(a){var b=f[a];b||(b=this.ctx_.measureText(a).width,f[a]=b);return b+2},labelWidthWorld:function(a,b){return this.labelWidth(a)*b},redraw:function(){var b=this.ctx_,f=this.canvas_.width,g=this.canvas_.height;b.clearRect(0,0,f,g);var c=this.viewport_,e=c.xViewVectorToWorld(1),m=c.xViewToWorld(0),f=
c.xViewToWorld(f);c.drawUnderContent(b,m,f,g);b.save();c.applyTransformToCanvas(b);this.asyncStyle_&&(b.globalAlpha=0.25);var p=new tracing.FastRectRenderer(b,2*e,2*e,a);p.setYandH(0,g);for(var s=this.slices_,t=tracing.findLowIndexInSortedArray(s,function(a){return a.start+a.duration},m),u=t;u<s.length;++u){var r=s[u],w=r.start;if(w>f)break;var x=Math.max(r.duration,0.001),v=r.selected?r.colorId+d:r.colorId;x<e&&(x=e);0<r.duration?p.fillRect(w,x,v):0.001<e?p.fillRect(w,e,v):(b.fillStyle=a[v],b.beginPath(),
b.moveTo(w-4*e,g),b.lineTo(w,0),b.lineTo(w+4*e,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)";w=20*e;x=this.SHOULD_ELIDE_TEXT;for(u=t;u<s.length;++u){r=s[u];if(r.start>f)break;r.duration>w&&(t=r.title,r.didNotFinish&&(t+=" (Did Not Finish)"),v=this.labelWidth(t),x&&this.labelWidthWorld(t,e)>r.duration&&(v=this.elidedTitleCache.get(this,e,
t,v,r.duration),t=v.string,v=v.width),v*e<r.duration&&(r=c.xWorldToView(r.start+0.5*r.duration),b.fillText(t,r,2.5*p,v)))}}c.drawOverContent(b,m,f,g)},addIntersectingItemsToSelection:function(a,b,d){var f=this.getBoundingClientRect();if(b<f.top||b>=f.bottom)return!1;a=this.viewport_.xViewVectorToWorld(a*devicePixelRatio);a=tracing.findLowIndexInSortedIntervals(this.slices_,function(a){return a.start},function(a){return a.duration},a);return 0<=a&&a<this.slices_.length?(d=d.addSlice(this,this.slices_[a]),
this.decorateHit(d),!0):!1},addIntersectingItemsInRangeToSelection:function(a,b,d,f,g){function c(a){a=g.addSlice(s,a);s.decorateHit(a)}var e=window.devicePixelRatio||1,a=this.viewport_.xViewToWorld(a*e),b=this.viewport_.xViewToWorld(b*e),e=this.getBoundingClientRect(),d=Math.max(d,e.top),f=Math.min(f,e.bottom);if(!(d>f)){var s=this;tracing.iterateOverIntersectingIntervals(this.slices_,function(a){return a.start},function(a){return a.duration},a,b,c)}},indexOfSlice_:function(a){for(var b=tracing.findLowIndexInSortedArray(this.slices_,
function(a){return a.start},a.start);b<this.slices_.length&&a.start==this.slices_[b].start&&a.colorId!=this.slices_[b].colorId;)b++;return b<this.slices_.length?b:void 0},addItemNearToProvidedHitToSelection:function(a,b,d){if(!a.slice)return!1;a=this.indexOfSlice_(a.slice);if(void 0===a)return!1;b=a+b;if(0>b||b>=this.slices_.length)return!1;a=d.addSlice(this,this.slices_[b]);this.decorateHit(a);return!0},addAllObjectsMatchingFilterToSelection:function(a,b){for(var d=0;d<this.slices_.length;++d)if(a.matchSlice(this.slices_[d])){var f=
b.addSlice(this,this.slices_[d]);this.decorateHit(f)}}};var d=tracing.getColorPaletteHighlightIdBoost(),f={},g={};e.prototype={get:function(a,b,d,f,e){var m=g[d];m||(m={},g[d]=m);f=m[b];f||(m[b]={},f=m[b]);m=f[e];if(void 0===m){for(m=!1;a.labelWidthWorld(d,b)>e;)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,a.labelWidth(d));f[e]=m}return m}};return{TimelineSliceTrack:b}});"use strict";
base.exportTo("tracing",function(){function e(c,a,b,d,f,g){this.category=c||"";this.title=a;this.start=d;this.colorId=b;this.args=f;this.didNotFinish=!1;void 0!==g&&(this.duration=g)}e.prototype={selected:!1,duration:void 0,get end(){return this.start+this.duration}};return{TimelineSlice:e}});"use strict";base.require("timeline_slice");base.require("timeline_color_scheme");base.require("timeline_filter");
base.exportTo("tracing",function(){function e(a){this.sliceConstructor=a||c;this.openPartialSlices_=[];this.slices=[]}var c=tracing.TimelineSlice;e.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,f){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,f?f:{});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.maxTimestamp);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(){var a=[];if(this.slices.length){for(var b=
Number.MAX_VALUE,d=-Number.MAX_VALUE,f=0;f<this.slices.length;f++)this.slices[f].start<b&&(b=this.slices[f].start),this.slices[f].end>d&&(d=this.slices[f].end);a.push(b);a.push(d)}this.openPartialSlices_.length&&(a.push(this.openPartialSlices_[0].start),a.push(this.openPartialSlices_[this.openPartialSlices_.length-1].start));a.length?(this.minTimestamp=Math.min.apply(Math,a),this.maxTimestamp=Math.max.apply(Math,a)):this.maxTimestamp=this.minTimestamp=void 0}};return{TimelineSliceGroup:e}});"use strict";
base.require("timeline_slice");
base.exportTo("tracing",function(){function e(b,d,f,g,c){a.call(this,b,d,f,g,c)}function c(a){this.name=a;this.slices=[]}var a=tracing.TimelineSlice;e.prototype={__proto__:a.prototype,toJSON:function(){for(var a={},d=Object.keys(this),f=0;f<d.length;f++){var g=d[f];"function"!=typeof this[g]&&(a[g]="startThread"==g||"endThread"==g?this[g].ptid:this[g])}return a},id:void 0,startThread:void 0,endThread:void 0,subSlices:void 0};c.prototype={__proto__:Object.prototype,push:function(a){this.slices.push(a)},get length(){return this.slices.length},
shiftTimestampsForward:function(a){for(var d=0;d<this.slices.length;d++){var f=this.slices[d];f.start+=a;for(var g=0;g<f.subSlices.length;g++)f.subSlices[g].start+=a}},updateBounds:function(){if(this.slices.length){for(var a=Number.MAX_VALUE,d=-Number.MAX_VALUE,f=0;f<this.slices.length;f++)this.slices[f].start<a&&(a=this.slices[f].start),this.slices[f].end>d&&(d=this.slices[f].end);this.minTimestamp=a;this.maxTimestamp=d}else this.maxTimestamp=this.minTimestamp=void 0},computeSubGroups:function(){for(var a=
{},d=0;d<this.slices.length;++d){var f=this.slices[d],g=f.startThread.ptid;a[g]||(a[g]=new c(this.name));a[g].slices.push(f)}var d=[],l;for(l in a)f=a[l],f.updateBounds(),d.push(f);return d}};return{TimelineAsyncSlice:e,TimelineAsyncSliceGroup:c}});"use strict";base.require("timeline_slice");base.require("timeline_slice_group");base.require("timeline_async_slice_group");
base.exportTo("tracing",function(){function e(b,d,f,c,e,q){a.call(this,b,d,f,c,e,q);this.subSlices=[]}function c(a,f){b.call(this,e);if(!a)throw Error("Parent must be provided.");this.pid=a.pid;this.tid=f;this.cpuSlices=void 0;this.asyncSlices=new d(this.ptid)}var a=tracing.TimelineSlice,b=tracing.TimelineSliceGroup,d=tracing.TimelineAsyncSliceGroup;e.prototype={__proto__:a.prototype};var f={};c.getPTIDFromPidAndTid=function(a,b){f[a]||(f[a]={});f[a][b]||(f[a][b]=a+":"+b);return f[a][b]};c.prototype=
{__proto__:b.prototype,name:void 0,get ptid(){return c.getPTIDFromPidAndTid(this.tid,this.pid)},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);var a=
[];void 0!==this.minTimestamp&&a.push(this.minTimestamp,this.maxTimestamp);this.asyncSlices.slices.length&&(this.asyncSlices.updateBounds(),a.push(this.asyncSlices.minTimestamp),a.push(this.asyncSlices.maxTimestamp));this.cpuSlices&&this.cpuSlices.length&&(a.push(this.cpuSlices[0].start),a.push(this.cpuSlices[this.cpuSlices.length-1].end));a.length?(this.minTimestamp=Math.min.apply(Math,a),this.maxTimestamp=Math.max.apply(Math,a)):this.maxTimestamp=this.minTimestamp=void 0},get userFriendlyName(){return this.pid+
": "+(this.name||this.tid)},get userFriendlyDetails(){return"pid: "+this.pid+", tid: "+this.tid+(this.name?", name: "+this.name:"")}};c.compare=function(a,b){if(a.pid!=b.pid)return a.pid-b.pid;if(a.name&&b.name){var d=a.name.localeCompare(b.name);return 0==d?a.tid-b.tid:d}return a.name?-1:b.name?1:a.tid-b.tid};return{TimelineThreadSlice:e,TimelineThread:c}});"use strict";
base.exportTo("tracing",function(){function e(a,b,d,f){null==a?this.parent_id=null:void 0!=a.pid?this.parent_id=a.pid:void 0!=a.cpuNumber&&(this.parent_id=a.cpuNumber);this.id=b;this.category=d||"";this.name=f;this.seriesNames=[];this.seriesColors=[];this.timestamps=[];this.samples=[];this.guid_=c++}var c=1;e.prototype={__proto__:Object.prototype,get guid(){return this.guid_},get numSeries(){return this.seriesNames.length},get numSamples(){return this.timestamps.length},getSampleValue:function(a,
b){return this.samples[a*this.numSeries+b]},getSampleStatistics:function(a){a.sort();for(var b=this.numSeries,d=[],f=0;f<b;++f){for(var g=0,c=Number.MAX_VALUE,e=-Number.MAX_VALUE,j=0;j<a.length;j++)var k=a[j],g=g+this.getSampleValue(k,f),c=Math.min(this.getSampleValue(k,f),c),e=Math.max(this.getSampleValue(k,f),e);g/=a.length;j=this.getSampleValue(a[0],f);k=this.getSampleValue(a[a.length-1],f);d.push({min:c,max:e,avg:g,start:j,end:k})}return d},shiftTimestampsForward:function(a){for(var b=0;b<this.timestamps.length;b++)this.timestamps[b]+=
a},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=[];if(0==this.samples.length)this.maxTimestamp=this.minTimestamp=void 0,this.maxTotal=0;else{this.minTimestamp=this.timestamps[0];this.maxTimestamp=this.timestamps[this.timestamps.length-1];for(var a=this.numSeries,b=-Infinity,
d=0;d<this.timestamps.length;d++){for(var f=0,g=0;g<a;g++)f+=this.samples[d*a+g],this.totals.push(f);f>b&&(b=f)}this.maxTotal=b}}};e.compare=function(a,b){if(a.parent_id!=b.parent_id)return a.parent_id-b.parent_id;var d=a.name.localeCompare(b.name);return 0==d?a.tid-b.tid:d};return{TimelineCounter:e}});"use strict";base.require("timeline_thread");base.require("timeline_counter");
base.exportTo("tracing",function(){function e(a){this.pid=a;this.threads={};this.counters={}}var c=tracing.TimelineThread,a=tracing.TimelineCounter;e.prototype={get numThreads(){var a=0,d;for(d in this.threads)a++;return a},shiftTimestampsForward:function(a){for(var d in this.threads)this.threads[d].shiftTimestampsForward(a);for(var f in this.counters)this.counters[f].shiftTimestampsForward(a)},getOrCreateThread:function(a){this.threads[a]||(this.threads[a]=new c(this,a));return this.threads[a]},
getOrCreateCounter:function(b,d){var f=b+"."+d;this.counters[f]||(this.counters[f]=new a(this,f,b,d));return this.counters[f]}};e.compare=function(a,d){return a.pid-d.pid};return{TimelineProcess:e}});"use strict";base.require("timeline_slice");base.require("timeline_counter");
base.exportTo("tracing",function(){function e(a){this.cpuNumber=a;this.slices=[];this.counters={}}var c=tracing.TimelineCounter;e.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.slices.length?(this.minTimestamp=
this.slices[0].start,this.maxTimestamp=this.slices[this.slices.length-1].end):this.maxTimestamp=this.minTimestamp=void 0}};e.compare=function(a,b){return a.cpuNumber-b.cpuNumber};return{TimelineCpu:e}});"use strict";base.require("event_target");base.require("timeline_process");base.require("timeline_cpu");base.require("timeline_filter");
base.exportTo("tracing",function(){function e(a,b){this.cpus={};this.processes={};this.importErrors=[];this.metadata=[];this.categories=[];a&&this.importTraces([a],b)}function c(){this.importPriority=0}var a=tracing.TimelineProcess,b=tracing.TimelineCpu,d=[];e.registerImporter=function(a){d.push(a)};c.canImport=function(a){return a instanceof Array&&0==a.length?!0:"string"===typeof a||a instanceof String?0==a.length:!1};c.prototype={__proto__:Object.prototype,importEvents:function(){},finalizeImport:function(){}};
e.registerImporter(c);e.prototype={__proto__:base.EventTarget.prototype,get numProcesses(){var a=0,b;for(b in this.processes)a++;return a},getOrCreateCpu:function(a){this.cpus[a]||(this.cpus[a]=new b(a));return this.cpus[a]},getOrCreateProcess:function(b){this.processes[b]||(this.processes[b]=new a(b));return this.processes[b]},autoCloseOpenSlices_:function(){this.updateBounds();var a=this.maxTimestamp,b;for(b in this.processes){var d=this.processes[b],c;for(c in d.threads)d.threads[c].autoCloseOpenSlices(a)}},
updateCategories_:function(){for(var a in this.processes){var b=this.processes[a],d;for(d in b.threads)for(var c=b.threads[d].slices,e=0;e<c.length;e++){var k=c[e].category;k&&-1==this.categories.indexOf(k)&&this.categories.push(k)}}for(var q in this.cpus){c=this.cpus[q].slices;for(e=0;e<c.length;e++)(k=c[e].category)&&-1==this.categories.indexOf(k)&&this.categories.push(k)}},pruneEmptyThreads_:function(){for(var a in this.processes){var b=this.processes[a],d={},c;for(c in b.threads){var e=b.threads[c];
e.isEmpty||(d[c]=e)}b.threads=d}},updateBounds:function(){for(var a=Infinity,b=-a,d=!1,c=this.getAllThreads(),e=0;e<c.length;e++){var k=c[e];k.updateBounds();void 0!=k.minTimestamp&&void 0!=k.maxTimestamp&&(a=Math.min(a,k.minTimestamp),b=Math.max(b,k.maxTimestamp),d=!0)}c=this.getAllCounters();for(e=0;e<c.length;e++)k=c[e],k.updateBounds(),void 0!=k.minTimestamp&&void 0!=k.maxTimestamp&&(d=!0,a=Math.min(a,k.minTimestamp),b=Math.max(b,k.maxTimestamp));for(var q in this.cpus)e=this.cpus[q],e.updateBounds(),
void 0!=e.minTimestamp&&void 0!=e.maxTimestamp&&(d=!0,a=Math.min(a,e.minTimestamp),b=Math.max(b,e.maxTimestamp));d?(this.minTimestamp=a,this.maxTimestamp=b):this.minTimestamp=this.maxTimestamp=void 0},shiftWorldToZero:function(){if(void 0!==this.minTimestamp){var a=this.minTimestamp,b;for(b in this.processes)this.processes[b].shiftTimestampsForward(-a);for(var d in this.cpus)this.cpus[d].shiftTimestampsForward(-a);this.updateBounds()}},getAllThreads:function(){var a=[],b;for(b in this.processes){var d=
this.processes[b],c;for(c in d.threads)a.push(d.threads[c])}return a},getAllCpus:function(){var a=[],b;for(b in this.cpus)a.push(this.cpus[b]);return a},getAllProcesses:function(){var a=[],b;for(b in this.processes)a.push(this.processes[b]);return a},getAllCounters:function(){var a=[],b;for(b in this.processes){var d=this.processes[b],c;for(c in d.counters)a.push(d.counters[c])}for(var e in this.cpus){b=this.cpus[e];for(var k in b.counters)a.push(b.counters[k])}return a},findAllThreadsNamed:function(a){for(var b=
[],d=this.getAllThreads(),c=0;c<d.length;c++){var e=d[c];e.name==a&&b.push(e)}return b},createImporter_:function(a){for(var b,c=0;c<d.length;++c)if(d[c].canImport(a)){b=d[c];break}if(!b)throw Error("Could not find an importer for the provided eventData.");return new b(this,a)},importTraces:function(a,b){void 0===b&&(b=!0);for(var d=[],c=0;c<a.length;++c)d.push(this.createImporter_(a[c]));d.sort(function(a,b){return a.importPriority-b.importPriority});for(c=0;c<d.length;c++)d[c].importEvents(0<c);
this.autoCloseOpenSlices_();for(c=0;c<d.length;c++)d[c].finalizeImport();this.pruneEmptyThreads_();this.updateBounds();this.updateCategories_();b&&this.shiftWorldToZero()}};return{TimelineModel:e}});"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 e=base.ui.define(tracks.TimelineContainerTrack);e.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:e}});"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 e=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,f=this.canvas_.height;b.clearRect(0,0,d,f);var c=this.viewport_,l=c.xViewVectorToWorld(1),h=c.xViewToWorld(0),d=c.xViewToWorld(d);c.drawUnderContent(b,h,d,f);var j=c.xViewVectorToWorld(1);b.save();c.applyTransformToCanvas(b);for(var k=a.numSeries,
q=a.numSamples,m=tracing.findLowIndexInSortedArray(a.timestamps,function(a){return a},h),m=0<m-1?m-1:0,p=f/a.maxTotal,s=a.numSeries-1;0<=s;s--){b.fillStyle=e[a.seriesColors[s]];b.beginPath();for(var t=m-1,u=0<=t?a.timestamps[t]-j:-1,r=f,w=!1;;){var x=t+1;if(x>=q){b.lineTo(u,r);b.lineTo(u+8*l,r);b.lineTo(u+8*l,f);break}var v=a.timestamps[x],t=a.totals[x*k+s],y=f-p*t;if(v>d){b.lineTo(v,r);b.lineTo(v,f);break}v-u<j?t=x:(w||(b.moveTo(h,f),w=!0),b.lineTo(v,r),b.lineTo(v,y),t=x,u=v,r=y)}b.closePath();b.fill()}b.fillStyle=
"rgba(255, 0, 0, 1)";for(x in this.selectedSamples_)if(this.selectedSamples_[x]){v=a.timestamps[x];for(s=a.numSeries-1;0<=s;s--)t=a.totals[x*k+s],y=f-p*t,b.fillRect(v-l,y-1,3*l,3)}b.restore();c.drawOverContent(b,h,d,f)},addIntersectingItemsToSelection:function(a,b,d){var f=this.getBoundingClientRect();if(b<f.top||b>=f.bottom)return!1;b=this.viewport_.xViewVectorToWorld(a*devicePixelRatio);f=this.counter_;if(a<this.counter_.timestamps[0])return!1;a=tracing.findLowIndexInSortedArray(f.timestamps,function(a){return a},
b);if(0>a||a>=f.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,f,c){var e=this.getBoundingClientRect(),d=Math.max(d,e.top),f=Math.min(f,e.bottom);if(!(d>f)){f=this.counter_;e=window.devicePixelRatio||1;a=this.viewport_.xViewToWorld(a*e);e=this.viewport_.xViewToWorld(b*e);d=tracing.findLowIndexInSortedArray(f.timestamps,function(a){return a},
a);b=tracing.findLowIndexInSortedArray(f.timestamps,function(a){return a},e);0<d&&a>f.timestamps[d-1]&&d--;0<b&&e>f.timestamps[b-1]&&b--;for(a=d;a<=b;a++)a>=f.timestamps.length||(e=c.addCounterSample(this,this.counter,a),this.decorateHit(e))}},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 e=base.ui.define(tracks.TimelineContainerTrack);e.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(a,b){var d=c[a],f=c[b];return d.start!=f.start?d.start-f.start:b-a});var d=[[]];this.badSlices_=[];for(b=0;b<a.length;b++){for(var f=c[a[b]],g=!1,e=d.length-1;0<=e;e--)if(0!=d[e].length){var h=d[e][d[e].length-1];f.start<h.start&&(this.badSlices_.push(f),
g=!0);if(f.start>=h.start&&f.end<=h.end){for(;d.length<=e+1;)d.push([]);d[e+1].push(f);h.subSlices&&h.subSlices.push(f);g=!0;break}}g||d[0].push(f)}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:e}});"use strict";base.require("tracks.timeline_slice_group_track");base.require("ui");
base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineSliceGroupTrack);e.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(a,b){return a.start-b.start});for(var a=
[],b=0;b<c.length;b++){for(var d=c[b],f=!1,g=0;g<a.length;g++){var e=a[g];if(d.start>=e[e.length-1].end){f=!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++)e.push(d.subSlices[g]);break}}if(!f&&(e=[],void 0!==d.subSlices)){for(g=0;g<d.subSlices.length;g++)e.push(d.subSlices[g]);a.push(e)}}return a}};return{TimelineAsyncSliceGroupTrack:e}});"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 e=base.ui.define(tracks.TimelineContainerTrack);e.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)for(var c=parseInt(this.tracks_[0].height),
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:e}});"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 e=base.ui.define(tracks.TimelineContainerTrack);e.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(a){var d=new tracks.TimelineCounterTrack;d.heading=a.name+":";d.counter=a;this.addTrack_(d)}.bind(this));c=[];for(a in this.process.threads)c.push(this.process.threads[a]);c.sort(tracing.TimelineThread.compare);c.forEach(function(a){var d=new tracks.TimelineThreadTrack;d.heading=a.userFriendlyName+":";d.tooltip=a.userFriendlyDetails;d.thread=a;this.addTrack_(d)}.bind(this))}}};
return{TimelineProcessTrack:e}});"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 e=base.ui.define(tracks.TimelineContainerTrack);e.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(a){c.push(a.userFriendlyName)});this.model.getAllCounters().forEach(function(a){c.push(a.name)});this.model.getAllCpus().forEach(function(a){c.push("CPU "+a.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 f=this.measuringStick_.measure(b).width;300<f&&(f=300);f>a&&(a=f)}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:e}});"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 e=base.ui.define(tracks.TimelineCanvasBasedTrack),c=Math.log(10);e.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){var a=this.viewport_.xViewToWorld(a-this.canvasContainer_.offsetLeft),
b=this.viewport_.findMarkerNear(a,6),d=!1,f=!1;b||(b=this.viewport_.addMarker(a),d=!0);b.selected=!0;var c=this,e=function(a){a=c.viewport_.xViewToWorld(a.clientX-c.canvasContainer_.offsetLeft);b.positionWorld=a;f=!0},h=function(){b.selected=!1;!f&&!d&&c.viewport_.removeMarker(b);document.removeEventListener("mouseup",h);document.removeEventListener("mousemove",e)};document.addEventListener("mouseup",h);document.addEventListener("mousemove",e)},drawLine_:function(a,b,d,f,c,e){a.beginPath();a.moveTo(b,
d);a.lineTo(f,c);a.closePath();a.strokeStyle=e;a.stroke()},drawArrow_:function(a,b,d,f,c,e,h){this.drawLine_(a,b,d,f,c,h);var j=f-b,k=c-d,q=Math.sqrt(j*j+k*k),m=(q-10)/q,b=b+m*j,d=d+m*k,k=k/q*e,e=-(j/q)*e;a.beginPath();a.fillStyle=h;a.moveTo(b+k,d+e);a.lineTo(f,c);a.lineTo(b-k,d-e);a.lineTo(b+k,d+e);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 f=this.viewport_;f.xViewVectorToWorld(1);for(var g=f.xViewToWorld(0),e=f.xViewToWorld(b),
h=this.classList.contains("timeline-viewport-track-with-distance-measurements"),j=h?d/2:d,k=0;k<f.markers.length;++k)f.markers[k].drawTriangle_(a,g,e,d,j,f);var k=f.xViewVectorToWorld(150),q,m,p,s;m=Math.pow(10,Math.ceil(Math.log(k)/c));p=[10,5,2,1];for(k=0;k<p.length;++k)if(!(150>f.xWorldVectorToView(m/p[k]))){q=m/p[k-1];break}s=void 0;100>q?(m="ms",p=1,s=this.strings_msecs_):(m="s",p=1E3,s=this.strings_secs_);var t=f.xWorldVectorToView(q/5),k=Math.floor(g/q)*q,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=k;u<e;u+=q){var r=Math.floor(f.xWorldToView(u)),k=Math.floor(1E5*(u/p))/1E5;s[k]||(s[k]=k+" "+m);a.fillText(s[k],r+2*g,0);a.beginPath();a.moveTo(r,0);a.lineTo(r,j);for(k=1;5>k;++k){var w=Math.floor(r+t*k);a.moveTo(w,j-d);a.lineTo(w,j)}a.stroke()}if(h){a.moveTo(0,j);a.lineTo(b,j);a.stroke();b=f.markers.slice();b.sort(function(a,b){return a.positionWorld_-b.positionWorld_});
j+=2;e=j+4;for(k=0;k<b.length-1;k++)s=b[k+1],t=b[k],d=s.positionWorld-t.positionWorld,q=f.xWorldVectorToView(d),h=f.xWorldToView(t.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=f.xViewVectorToWorld(p),p=p+26+10,u=t.positionWorld+d/2-g/2,r=u+g,d=j,g=f.xWorldToView(u),u=f.xWorldToView(r),t=f.xWorldToView(t.positionWorld),s=f.xWorldToView(s.positionWorld),r=!1,p<=q&&(a.fillStyle="rgb(0,0,0)",a.fillText(m,g,d),r=!0),26<=q&&
(r?(m=g-10,p=u+10):p=m=h,this.drawArrow_(a,m,e,t,e,3,"rgb(128,121,121)"),this.drawArrow_(a,p,e,s,e,3,"rgb(128,121,121)"))}},addIntersectingItemsToSelection:function(){},addIntersectingItemsInRangeToSelection:function(){},addAllObjectsMatchingFilterToSelection:function(){}};return{TimelineViewportTrack:e}});"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 e=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 e},bindEventListener_:function(a,d,f,c){this.boundListeners_||(this.boundListeners_=[]);f=f.bind(c);this.boundListeners_.push({object:a,
event:d,boundFunc:f});a.addEventListener(d,f)},detach:function(){this.modelTrack_.detach();for(var a=0;a<this.boundListeners_.length;a++){var d=this.boundListeners_[a];d.object.removeEventListener(d.event,d.boundFunc)}this.boundListeners_=void 0;this.viewport_.detach()},get viewport(){return this.viewport_},get categoryFilter(){return this.categoryFilter_},set categoryFilter(a){this.categoryFilter_=a;this.modelTrack_.categoryFilter=a},get model(){return this.model_},set model(a){if(!a)throw Error("Model cannot be null");
var d=this.model_!=a;this.model_=a;this.modelTrack_.model=a;this.modelTrack_.viewport=this.viewport_;this.modelTrack_.categoryFilter=this.categoryFilter;this.viewportTrack_.headingWidth=this.modelTrack_.headingWidth;d&&this.viewport_.setWhenPossible(this.setInitialViewport_.bind(this))},get numVisibleTracks(){return this.modelTrack_.numVisibleTracks},setInitialViewport_:function(){var a=0.15*(this.model_.maxTimestamp-this.model_.minTimestamp);this.viewport_.xSetWorldRange(this.model_.minTimestamp-
a,this.model_.maxTimestamp+a,this.firstCanvas.width)},addAllObjectsMatchingFilterToSelection:function(a,d){this.modelTrack_.addAllObjectsMatchingFilterToSelection(a,d)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},set focusElement(a){this.focusElement_=a},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(a){var d=this.viewport_;if(this.firstCanvas&&this.listenToKeys_&&"INPUT"!=document.activeElement.nodeName){var f=this.firstCanvas.clientWidth;switch(a.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:d.panX+=d.xViewVectorToWorld(0.1*f);break;case 100:case 101:d.panX-=d.xViewVectorToWorld(0.1*
f);break;case 65:d.panX+=d.xViewVectorToWorld(0.5*f);break;case 68:d.panX-=d.xViewVectorToWorld(0.5*f);break;case 48:case 122:this.setInitialViewport_();break;case 102:this.zoomToSelection_()}}},onMouseWheel_:function(a){if(a.altKey){var d=Math.pow(1.5,a.wheelDeltaY/120);this.zoomBy_(d);a.preventDefault()}},onKeydown_:function(a){if(this.listenToKeys_){var d,f=this.viewport_,c=this.firstCanvas.clientWidth;switch(a.keyCode){case 37:if(d=this.selection.getShiftedSelection(-1))this.setSelectionAndMakeVisible(d),
a.preventDefault();else{if(!this.firstCanvas)return;f.panX+=f.xViewVectorToWorld(0.1*c)}break;case 39:if(d=this.selection.getShiftedSelection(1))this.setSelectionAndMakeVisible(d),a.preventDefault();else{if(!this.firstCanvas)return;f.panX-=f.xViewVectorToWorld(0.1*c)}break;case 9:-1==this.focusElement.tabIndex&&(a.shiftKey?this.selectPrevious_(a):this.selectNext_(a),a.preventDefault())}a.shiftKey&&this.dragBeginEvent_&&(a=a.shiftKey,this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,
this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_,a))}},onKeyup_:function(a){this.listenToKeys_&&(a.shiftKey||this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_,a.shiftKey))},zoomBy_:function(a){if(this.firstCanvas){var d=this.viewport_,f=this.firstCanvas.clientWidth,c=this.lastMouseViewPos_.x,e=d.xViewToWorld(c);d.scaleX*=a;d.xPanWorldPosToViewPos(e,c,f)}},zoomToSelection_:function(){if(this.selection){var a=this.selection.range,
d=a.min+0.5*(a.max-a.min),a=0.5*(a.max-a.min),f=0.15*a;this.viewport_.xSetWorldRange(d-a-f,d+a+f,this.firstCanvas.width)}},get keyHelp(){var a="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",
a=this.focusElement.tabIndex?a+" <- : Select previous event on current timeline\n -> : Select next event on current timeline\n":a+"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 a+"\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(a){if(!(a instanceof e))throw Error("Expected TimelineSelection");var d;for(d=0;d<this.selection_.length;d++)this.selection_[d].selected=!1;this.selection_=a;base.dispatchSimpleEvent(this,"selectionChange");for(d=0;d<this.selection_.length;d++)this.selection_[d].selected=!0;this.viewport_.dispatchChangeEvent()},setSelectionAndMakeVisible:function(a,d){if(!(a instanceof e))throw Error("Expected TimelineSelection");this.selection=a;var f=this.selection.range,
c=this.viewport_.xWorldVectorToView(f.max-f.min);d&&50>c?(c=f.min+0.5*(f.max-f.min),f=5*(f.max-f.min),this.viewport_.xSetWorldRange(c-0.5*f,c+0.5*f,this.firstCanvas.width)):this.viewport_.xPanWorldRangeIntoView(f.min,f.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(a,d,f,c,e){var h=Math.min(a,f),a=Math.max(a,f),f=this.modelTrack_.getBoundingClientRect();e?(e=f.top,f=f.bottom):(e=Math.min(d,c),f=Math.max(d,c));var d=e,c=h+(a-h),e=d+(f-e),j=this.modelTrackContainer_.getBoundingClientRect(),f=j.left,k=j.top,q=j.right,j=j.bottom,m=parseInt(this.modelTrack_.headingWidth),f=f+m;m={};h>q||c<f||d>j||e<k?d=!1:(m.left=Math.max(f,h),m.top=Math.max(k,d),m.right=Math.min(q,c),m.bottom=Math.min(j,e),m.width=m.right-
m.left,m.height=m.bottom-m.top,d=m);this.dragBox_.style.left=d.left+"px";this.dragBox_.style.width=d.width+"px";this.dragBox_.style.top=d.top+"px";this.dragBox_.style.height=d.height+"px";d=this.firstCanvas;h=this.viewport_.xViewToWorld(h-d.offsetLeft);a=this.viewport_.xViewToWorld(a-d.offsetLeft);d=Math.round(100*(a-h))/100;this.dragBox_.textContent=d+"ms";d=new base.Event("selectionChanging");d.loWX=h;d.hiWX=a;this.dispatchEvent(d)},onGridToggle_:function(a){var a=a?this.selection_.range.min:this.selection_.range.max,
d=Math.ceil((a-this.model_.minTimestamp)/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,f=this.modelTrack_.getBoundingClientRect(),c=this.firstCanvas.getBoundingClientRect();f&&(a.clientX>=
f.left&&a.clientX<f.right&&a.clientY>=f.top&&a.clientY<f.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 f,c=Math.min(d.clientX,a.clientX),l=Math.max(d.clientX,a.clientX);this.modelTrackContainer_.getBoundingClientRect();a.shiftKey?(d=this.modelTrack_.getBoundingClientRect(),
f=d.top,d=d.bottom):(f=Math.min(d.clientY,a.clientY),d=Math.max(d.clientY,a.clientY));var h=this.firstCanvas,c=c-h.offsetLeft,l=l-h.offsetLeft,h=new e;this.modelTrack_.addIntersectingItemsInRangeToSelection(c,l,f,d,h);this.selection=h;((f=0==navigator.platform.indexOf("Mac"))&&a.metaKey||!f&&a.ctrlKey)&&this.zoomToSelection_()}},onDblClick_:function(a){var d=4;a.shiftKey&&(d=1/d);this.zoomBy_(d);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 e(a,d){var f=d.getSliceHits(),c=d.getCounterSampleHits();if(1==f.length){var e=f[0].slice,h=a.appendTable("timeline-analysis-slice-table",2);a.appendTableHeader(h,"Selected slice:");a.appendSummaryRow(h,"Title",e.title);e.category&&a.appendSummaryRow(h,"Category",e.category);a.appendSummaryRowTime(h,"Start",e.start);a.appendSummaryRowTime(h,"Duration",e.duration);e.durationInUserTime&&a.appendSummaryRowTime(h,"Duration (U)",e.durationInUserTime);var f=0,
j;for(j in e.args)f+=1;if(0<f)for(j in a.appendSummaryRow(h,"Args"),e.args)a.appendSummaryRow(h," "+j,e.args[j])}else if(1<f.length){var k=f.range.min,q=f.range.max;f.map(function(a){return a.slice.title});var h=0,m={};for(j=0;j<f.length;j++)e=f[j].slice,m[e.title]||(m[e.title]={slices:[]},h++),m[e.title].slices.push(e);h=a.appendTable("timeline-analysis-slices-table",3);a.appendTableHeader(h,"Slices:");var e=0,p;for(p in m){var s=m[p],t=0;j=0;var u=Number.MAX_VALUE,r=-Number.MAX_VALUE,w=Number.MAX_VALUE,
x=-Number.MAX_VALUE;for(j=0;j<s.slices.length;j++)t+=s.slices[j].duration,u=Math.min(s.slices[j].start,u),r=Math.max(s.slices[j].start,r),w=Math.min(s.slices[j].duration,w),x=Math.max(s.slices[j].duration,x);e+=t;0==s.slices.length&&(j=0);j=t/s.slices.length;w={min:w,max:x,avg:j,frequency:void 0,frequency_stddev:void 0};j=r-u;if(2<s.slices.length&&0<j){u=s.slices.length-1;w.frequency=1E3*u/j;r=0;for(j=1;j<s.slices.length;j++)x=w.frequency-1E3/(s.slices[j].start-s.slices[j-1].start),r+=x*x;w.frequency_stddev=
Math.sqrt(r/(u-1))}a.appendDataRow(h,p,t,s.slices.length,w)}a.appendDataRow(h,"*Totals",e,f.length);a.appendSpacingRow(h);a.appendSummaryRowTime(h,"Selection start",k);a.appendSummaryRowTime(h,"Selection extent",q-k)}if(1==c.length){var h=c[0],f=h.counter,v=h.sampleIndex,c=[];for(j=0;j<f.numSeries;++j)c.push(f.samples[f.numSeries*v+j]);h=a.appendTable("timeline-analysis-counter-table",2);a.appendTableHeader(h,"Selected counter:");a.appendSummaryRow(h,"Title",f.name);a.appendSummaryRowTime(h,"Timestamp",
f.timestamps[v]);for(j=0;j<f.numSeries;j++)a.appendSummaryRow(h,f.seriesNames[j],c[j])}else if(1<c.length){p={};for(j=0;j<c.length;j++)f=c[j].counter,p[f.guid]||(p[f.guid]=[]),p[f.guid].push(c[j]);h=a.appendTable("timeline-analysis-counter-table",7);a.appendTableHeader(h,"Counters:");for(v in p){c=p[v];f=c[0].counter;k=[];for(j=0;j<c.length;j++)k.push(c[j].sampleIndex);c=f.getSampleStatistics(k);for(j=0;j<c.length;j++)a.appendDataRow(h,f.name+": "+f.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,f){d=a.ownerDocument.createElement(d);a.appendChild(d);void 0!=f&&(d.textContent=f);return d},appendText_:function(a,d){a.ownerDocument.createTextNode(d);a.appendChild(textNode);return textNode},appendTableCell_:function(a,d,f,c){d=this.appendElement_(d,"td",c);d.className=a.className+"-col-"+f;return d},appendTableCellWithTooltip_:function(a,d,f,c,e){if(e)return d=
this.appendElement_(d,"td"),d.className=a.className+"-col-"+f,a=this.appendElement_(d,"span",c),a.className="tooltip",a.title=e,d;this.appendTableCell_(a,d,f,c)},appendTable:function(a,d){var f=this.appendElement_(this,"table");f.className=a+" timeline-analysis-table";f.numColumns=d;return f},appendTableHeader:function(a,d){var f=this.appendElement_(a,"tr");this.appendElement_(f,"th",d).className="timeline-analysis-table-header"},appendSummaryRow:function(a,d,f){var c=this.appendElement_(a,"tr");
c.className="timeline-analysis-table-row";this.appendTableCell_(a,c,0,d);if(void 0!==f){this.appendTableCell_(a,c,1,f);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 f=0;f<a.numColumns;f++)this.appendTableCell_(a,d,f," ")},appendSummaryRowTime:function(a,d,f){this.appendSummaryRow(a,d,this.tsRound_(f)+" ms")},
appendDataRow:function(a,d,f,c,e){var h=void 0;e&&(h="Min Duration:\t"+this.tsRound_(e.min)+" ms \rMax Duration:\t"+this.tsRound_(e.max)+" ms \rAvg Duration:\t"+this.tsRound_(e.avg)+" ms",e.start&&(h+="\rStart Time:\t"+this.tsRound_(e.start)+" ms"),e.end&&(h+="\rEnd Time:\t"+this.tsRound_(e.end)+" ms"),e.frequency&&e.frequency_stddev&&(h+="\rFrequency:\t"+this.tsRound_(e.frequency)+" occurrences/s (\u03c3 = "+this.tsRound_(e.frequency_stddev)+")"));e=this.appendElement_(a,"tr");e.className="timeline-analysis-table-row";
this.appendTableCellWithTooltip_(a,e,0,d,h);void 0!==f?this.appendTableCellWithTooltip_(a,e,1,this.tsRound_(f)+" ms",h):this.appendTableCell_(a,e,1,"");void 0!==c?this.appendTableCellWithTooltip_(a,e,2,String(c)+" occurrences",h):this.appendTableCell_(a,e,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;e(d,a);this.appendChild(d)}};return{TimelineAnalysisView:a,
analyzeSelection_:e}});base.requireStylesheet("overlay");base.require("ui");base.require("event_target");
base.exportTo("tracing",function(){var e=base.ui.define("div");e.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(e,"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,e);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 e=base.ui.define("div");e.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 f=document.createElement("label");f.textContent=b;f.setAttribute("for",b);this.formEl_.appendChild(d);this.formEl_.appendChild(f);this.formEl_.appendChild(document.createElement("br"))}},updateSetting_:function(c){c=c.target;this.settings_.set(c.value,c.checked,"categories");this.settingUpdatedCallback_()}};return{TimelineCategoryFilterDialog:e}});"use strict";
base.require("timeline");base.require("timeline_filter");base.require("overlay");
base.exportTo("tracing",function(){function e(){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}}};e.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:e}});base.require("timeline_model");base.require("timeline_color_scheme");
base.exportTo("tracing",function(){function e(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)for(fieldName in this.events_=this.events_.traceEvents,this.events_)"traceEvents"!=fieldName&&this.model_.metadata.push({name:fieldName,value:this.events_[fieldName]});
this.allAsyncEvents_=[]}e.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};e.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),f;for(f in b.args)void 0!==d.args[f]&&this.model_.importErrors.push("Both the B and E phases of "+
d.name+"provided values for argument "+f+". The value of the E phase event will be used."),d.args[f]=b.args[f]}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],f=d.event,g=f.name;if(void 0===g)this.model_.importErrors.push("Async events (ph: S, T or F) require an name parameter.");else{var e=f.id;if(void 0===e)this.model_.importErrors.push("Async events (ph: S, T or F) require an id parameter.");else if("S"==f.ph)void 0===c[g]&&(c[g]={}),c[g][e]?this.model_.importErrors.push("At "+f.ts+", a slice of the same id "+e+" was alrady open."):(c[g][e]=[],c[g][e].push(d));
else if(void 0===c[g])this.model_.importErrors.push("At "+f.ts+", no slice named "+g+" was open.");else if(void 0===c[g][e])this.model_.importErrors.push("At "+f.ts+", no slice named "+g+" with id="+e+" was open.");else{var h=c[g][e];h.push(d);if("F"==f.ph){var j=new tracing.TimelineAsyncSlice(h[0].event.cat,g,tracing.getStringColorId(g),h[0].event.ts/1E3);j.duration=f.ts/1E3-h[0].event.ts/1E3;j.startThread=h[0].thread;j.endThread=d.thread;j.id=e;j.args=h[0].event.args;j.subSlices=[];for(d=1;d<h.length;++d){var k=
g;"T"==h[d-1].event.ph&&(k=g+":"+h[d-1].event.args.step);k=new tracing.TimelineAsyncSlice(h[0].event.cat,k,tracing.getStringColorId(g+d),h[d-1].event.ts/1E3);k.duration=h[d].event.ts/1E3-h[d-1].event.ts/1E3;k.startThread=h[d-1].thread;k.endThread=h[d].thread;k.id=e;k.args=h[d-1].event.args;j.subSlices.push(k)}var h=j.subSlices[j.subSlices.length-1],q;for(q in f.args)h.args[q]=f.args[q];j.startThread.asyncSlices.push(j);delete c[g][e]}}}}}}};tracing.TimelineModel.registerImporter(e);return{TraceEventImporter:e}});
base.exportTo("tracing",function(){function e(a){this.importer=a}var c=[];e.registerSubtype=function(a){c.push(a)};e.getSubtypeConstructors=function(){return c};e.prototype={__proto__:Object.prototype};return{LinuxPerfParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("memory_bus_usage",e.prototype.traceMarkWriteBusEvent.bind(this));this.model_=a.model_;this.ppids_={}}var c=tracing.LinuxPerfParser;e.prototype={__proto__:c.prototype,traceMarkWriteBusEvent:function(a,b,d,f,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(f);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(f);c.samples.push(b);return!0}};c.registerSubtype(e);return{LinuxPerfBusParser:e}});
base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("clock_set_rate",e.prototype.traceMarkWriteClockEvent.bind(this));this.model_=a.model_;this.ppids_={}}var c=tracing.LinuxPerfParser;e.prototype={__proto__:c.prototype,traceMarkWriteClockEvent:function(a,b,d,c,e){b=/(\S+) state=(\d+) cpu_id=(\d+)/.exec(e[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(c);a.samples.push(b);return!0}};c.registerSubtype(e);return{LinuxPerfClockParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("cpufreq_interactive_up",e.prototype.cpufreqUpDownEvent.bind(this));a.registerEventHandler("cpufreq_interactive_down",e.prototype.cpufreqUpDownEvent.bind(this));a.registerEventHandler("cpufreq_interactive_already",e.prototype.cpufreqTargetEvent.bind(this));a.registerEventHandler("cpufreq_interactive_notyet",e.prototype.cpufreqTargetEvent.bind(this));a.registerEventHandler("cpufreq_interactive_target",e.prototype.cpufreqTargetEvent.bind(this));
a.registerEventHandler("cpufreq_interactive_boost",e.prototype.cpufreqBoostUnboostEvent.bind(this));a.registerEventHandler("cpufreq_interactive_unboost",e.prototype.cpufreqBoostUnboostEvent.bind(this))}var c=tracing.LinuxPerfParser;e.prototype={__proto__:c.prototype,cpufreqSlice:function(a,b,d,c){d=this.importer.getOrCreatePseudoThread("cpufreq");d.openSlice=b;a=new tracing.TimelineSlice("",d.openSlice,tracing.getStringColorId(d.openSlice),a,c,0);d.thread.pushSlice(a)},cpufreqBoostSlice:function(a,
b,d){var c=this.importer.getOrCreatePseudoThread("cpufreq_boost");c.openSlice=b;a=new tracing.TimelineSlice("",c.openSlice,tracing.getStringColorId(c.openSlice),a,d,0);c.thread.pushSlice(a)},cpufreqUpDownEvent:function(a,b,d,c,e){e=/cpu=(\d+) targ=(\d+) actual=(\d+)/.exec(e[5]);if(!e)return!1;b=parseInt(e[1]);d=parseInt(e[2]);e=parseInt(e[3]);this.cpufreqSlice(c,a,b,{cpu:b,targ:d,actual:e});return!0},cpufreqTargetEvent:function(a,b,d,c,e){var l=/cpu=(\d+) load=(\d+) cur=(\d+) targ=(\d+)/.exec(e[5]);
if(!l)return!1;b=parseInt(l[1]);d=parseInt(l[2]);e=parseInt(l[3]);l=parseInt(l[4]);this.cpufreqSlice(c,a,b,{cpu:b,load:d,cur:e,targ:l});return!0},cpufreqBoostUnboostEvent:function(a,b,d,c,e){this.cpufreqBoostSlice(c,a,{type:e[5]});return!0}};c.registerSubtype(e);return{LinuxPerfCpufreqParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("drm_vblank_event",e.prototype.vblankEvent.bind(this))}var c=tracing.LinuxPerfParser;e.prototype={__proto__:c.prototype,drmVblankSlice:function(a,b,d){var c=this.importer.getOrCreatePseudoThread("drm_vblank");c.openSlice=b;a=new tracing.TimelineSlice("",c.openSlice,tracing.getStringColorId(c.openSlice),a,d,0);c.thread.pushSlice(a)},vblankEvent:function(a,b,d,c,e){b=/crtc=(\d+), seq=(\d+)/.exec(e[5]);if(!b)return!1;
a=parseInt(b[1]);b=parseInt(b[2]);this.drmVblankSlice(c,"vblank:"+a,{crtc:a,seq:b});return!0}};c.registerSubtype(e);return{LinuxPerfDrmParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("exynos_flip_request",e.prototype.flipEvent.bind(this));a.registerEventHandler("exynos_flip_complete",e.prototype.flipEvent.bind(this));a.registerEventHandler("exynos_busfreq_target_int",e.prototype.busfreqTargetIntEvent.bind(this));a.registerEventHandler("exynos_busfreq_target_mif",e.prototype.busfreqTargetMifEvent.bind(this))}var c=tracing.LinuxPerfParser;e.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 c=new tracing.TimelineSlice("",d.openSlice,tracing.getStringColorId(d.openSlice),d.openSliceTS,b,a-d.openSliceTS);d.thread.pushSlice(c)}d.openSlice=void 0},flipEvent:function(a,b,d,c,e){b=/pipe=(\d+)/.exec(e[5]);if(!b)return!1;b=parseInt(b[1]);"exynos_flip_request"==a?this.exynosFlipOpenSlice(c,
b):this.exynosFlipCloseSlice(c,{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,c,e){a=/frequency=(\d+)/.exec(e[5]);if(!a)return!1;this.exynosBusfreqSample("INT Frequency",c,parseInt(a[1]));return!0},busfreqTargetMifEvent:function(a,
b,d,c,e){a=/frequency=(\d+)/.exec(e[5]);if(!a)return!1;this.exynosBusfreqSample("MIF Frequency",c,parseInt(a[1]));return!0}};c.registerSubtype(e);return{LinuxPerfExynosParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("tracing_mark_write:log",e.prototype.logEvent.bind(this));a.registerEventHandler("tracing_mark_write:SyncInterpret",e.prototype.syncEvent.bind(this));a.registerEventHandler("tracing_mark_write:HandleTimer",e.prototype.timerEvent.bind(this))}var c=tracing.LinuxPerfParser;e.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 c=d.openPartialSlices_[d.openSliceCount-1];c.title!=a?this.importer.importError("Titles do not match. Title is "+c.title+" in openSlice, and is "+a+" in endSlice"):d.endSlice(b)}},logEvent:function(a,b,d,c,e){a=/^\s*(\w+):\s*(\w+)$/.exec(e[2]);switch(a[1]){case "start":this.gestureOpenSlice("GestureLog",c,{name:a[2]});break;case "end":this.gestureCloseSlice("GestureLog",c)}return!0},
syncEvent:function(a,b,d,c,e){a=/^\s*(\w+):\s*(\w+)$/.exec(e[2]);switch(a[1]){case "start":this.gestureOpenSlice("SyncInterpret",c,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("SyncInterpret",c)}return!0},timerEvent:function(a,b,d,c,e){a=/^\s*(\w+):\s*(\w+)$/.exec(e[2]);switch(a[1]){case "start":this.gestureOpenSlice("HandleTimer",c,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("HandleTimer",c)}return!0}};c.registerSubtype(e);return{LinuxPerfGestureParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("i915_gem_object_create",e.prototype.gemObjectCreateEvent.bind(this));a.registerEventHandler("i915_gem_object_bind",e.prototype.gemObjectBindEvent.bind(this));a.registerEventHandler("i915_gem_object_unbind",e.prototype.gemObjectBindEvent.bind(this));a.registerEventHandler("i915_gem_object_change_domain",e.prototype.gemObjectChangeDomainEvent.bind(this));a.registerEventHandler("i915_gem_object_pread",e.prototype.gemObjectPreadWriteEvent.bind(this));
a.registerEventHandler("i915_gem_object_pwrite",e.prototype.gemObjectPreadWriteEvent.bind(this));a.registerEventHandler("i915_gem_object_fault",e.prototype.gemObjectFaultEvent.bind(this));a.registerEventHandler("i915_gem_object_clflush",e.prototype.gemObjectDestroyEvent.bind(this));a.registerEventHandler("i915_gem_object_destroy",e.prototype.gemObjectDestroyEvent.bind(this));a.registerEventHandler("i915_gem_ring_dispatch",e.prototype.gemRingDispatchEvent.bind(this));a.registerEventHandler("i915_gem_ring_flush",
e.prototype.gemRingFlushEvent.bind(this));a.registerEventHandler("i915_gem_request",e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_add",e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_complete",e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_retire",e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_wait_begin",e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_wait_end",
e.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_ring_wait_begin",e.prototype.gemRingWaitEvent.bind(this));a.registerEventHandler("i915_gem_ring_wait_end",e.prototype.gemRingWaitEvent.bind(this));a.registerEventHandler("i915_reg_rw",e.prototype.regRWEvent.bind(this));a.registerEventHandler("i915_flip_request",e.prototype.flipEvent.bind(this));a.registerEventHandler("i915_flip_complete",e.prototype.flipEvent.bind(this))}var c=tracing.LinuxPerfParser;e.prototype={__proto__:c.prototype,
i915FlipOpenSlice:function(a,b,d){var c=this.importer.getOrCreatePseudoThread("i915_flip");c.openSliceTS=a;c.openSlice="flip:"+b+"/"+d},i915FlipCloseSlice:function(a,b){var d=this.importer.getOrCreatePseudoThread("i915_flip");if(d.openSlice){var c=new tracing.TimelineSlice("",d.openSlice,tracing.getStringColorId(d.openSlice),d.openSliceTS,b,a-d.openSliceTS);d.thread.pushSlice(c)}d.openSlice=void 0},i915GemObjectSlice:function(a,b,d,c){var e=this.importer.getOrCreatePseudoThread("i915_gem");e.openSlice=
b+":"+d;a=new tracing.TimelineSlice("",e.openSlice,tracing.getStringColorId(e.openSlice),a,c,0);e.thread.pushSlice(a)},i915GemRingSlice:function(a,b,d,c,e){var l=this.importer.getOrCreatePseudoThread("i915_gem_ring");l.openSlice=b+":"+d+"."+c;a=new tracing.TimelineSlice("",l.openSlice,tracing.getStringColorId(l.openSlice),a,e,0);l.thread.pushSlice(a)},i915RegSlice:function(a,b,d,c){var e=this.importer.getOrCreatePseudoThread("i915_reg");e.openSlice=b+":"+d;a=new tracing.TimelineSlice("",e.openSlice,
tracing.getStringColorId(e.openSlice),a,c,0);e.thread.pushSlice(a)},gemObjectCreateEvent:function(a,b,d,c,e){d=/obj=(\w+), size=(\d+)/.exec(e[5]);if(!d)return!1;b=d[1];d=parseInt(d[2]);this.i915GemObjectSlice(c,a,b,{obj:b,size:d});return!0},gemObjectBindEvent:function(a,b,d,c,e){e=/obj=(\w+), offset=(\w+), size=(\d+)/.exec(e[5]);if(!e)return!1;b=e[1];d=e[2];e=parseInt(e[3]);this.i915ObjectGemSlice(c,a+":"+b,{obj:b,offset:d,size:e});return!0},gemObjectChangeDomainEvent:function(a,b,d,c,e){b=/obj=(\w+), read=(\w+=>\w+), write=(\w+=>\w+)/.exec(e[5]);
if(!b)return!1;d=b[1];this.i915GemObjectSlice(c,a,d,{obj:d,read:b[2],write:b[3]});return!0},gemObjectPreadWriteEvent:function(a,b,d,c,e){e=/obj=(\w+), offset=(\d+), len=(\d+)/.exec(e[5]);if(!e)return!1;b=e[1];d=parseInt(e[2]);e=parseInt(e[3]);this.i915GemObjectSlice(c,a,b,{obj:b,offset:d,len:e});return!0},gemObjectFaultEvent:function(a,b,d,c,e){e=/obj=(\w+), (\w+) index=(\d+)/.exec(e[5]);if(!e)return!1;b=e[1];d=e[2];e=parseInt(e[3]);this.i915GemObjectSlice(c,a,b,{obj:b,type:d,index:e});return!0},
gemObjectDestroyEvent:function(a,b,d,c,e){b=/obj=(\w+)/.exec(e[5]);if(!b)return!1;b=b[1];this.i915GemObjectSlice(c,a,b,{obj:b});return!0},gemRingDispatchEvent:function(a,b,d,c,e){e=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(e[5]);if(!e)return!1;b=parseInt(e[1]);d=parseInt(e[2]);e=parseInt(e[3]);this.i915GemRingSlice(c,a,b,d,{dev:b,ring:d,seqno:e});return!0},gemRingFlushEvent:function(a,b,d,c,e){b=/dev=(\d+), ring=(\w+), invalidate=(\w+), flush=(\w+)/.exec(e[5]);if(!b)return!1;d=parseInt(b[1]);e=parseInt(b[2]);
this.i915GemRingSlice(c,a,d,e,{dev:d,ring:e,invalidate:b[3],flush:b[4]});return!0},gemRequestEvent:function(a,b,d,c,e){e=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(e[5]);if(!e)return!1;b=parseInt(e[1]);d=parseInt(e[2]);e=parseInt(e[3]);this.i915GemRingSlice(c,a,b,d,{dev:b,ring:d,seqno:e});return!0},gemRingWaitEvent:function(a,b,d,c,e){d=/dev=(\d+), ring=(\d+)/.exec(e[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,e){a=/(\w+) reg=(\w+), len=(\d+), val=(\(\w+, \w+\))/.exec(e[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,d,c,e){d=/plane=(\d+), obj=(\w+)/.exec(e[5]);if(!d)return!1;b=parseInt(d[1]);d=d[2];"i915_flip_request"==a?this.i915FlipOpenSlice(c,d,b):this.i915FlipCloseSlice(c,{obj:d,plane:b});return!0}};c.registerSubtype(e);return{LinuxPerfI915Parser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("mali_dvfs_event",e.prototype.dvfsEventEvent.bind(this));a.registerEventHandler("mali_dvfs_set_clock",e.prototype.dvfsSetClockEvent.bind(this));a.registerEventHandler("mali_dvfs_set_voltage",e.prototype.dvfsSetVoltageEvent.bind(this));a.registerEventHandler("tracing_mark_write:mali_driver",e.prototype.maliDDKEvent.bind(this))}var c=tracing.LinuxPerfParser;e.prototype={__proto__:c.prototype,maliDDKOpenSlice:function(a,
b,d,c){this.importer.getOrCreateKernelThread("mali_ddk",a,"mali_ddk").thread.beginSlice("gpu-driver",d,b,{blockinfo:c})},maliDDKCloseSlice:function(a,b){var d=this.importer.getOrCreateKernelThread("mali_ddk",a,"mali_ddk").thread;d.openSliceCount?d.endSlice(b):this.importer.importError("maliDDKCloseSlice w/o matching OpenSlice")},maliDDKEvent:function(a,b,d,c,e){a=/^s*(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/.exec(e[2]);switch(a[1]){case "cros_trace_print_enter":this.maliDDKOpenSlice(d,c,a[3],a[2]);break;
case "cros_trace_print_exit":this.maliDDKCloseSlice(d,c,[],a[2])}return!0},dvfsSample:function(a,b,d,c){a=this.importer.getOrCreateCpuState(0).cpu.getOrCreateCounter("",a);0==a.numSeries&&(a.seriesNames.push(b),a.seriesColors.push(tracing.getStringColorId(a.name)));a.timestamps.push(d);a.samples.push(c)},dvfsEventEvent:function(a,b,d,c,e){a=/utilization=(\d+)/.exec(e[5]);if(!a)return!1;this.dvfsSample("DVFS Utilization","utilization",c,a[1]);return!0},dvfsSetClockEvent:function(a,b,d,c,e){a=/frequency=(\d+)/.exec(e[5]);
if(!a)return!1;this.dvfsSample("DVFS Frequency","frequency",c,a[1]);return!0},dvfsSetVoltageEvent:function(a,b,d,c,e){a=/voltage=(\d+)/.exec(e[5]);if(!a)return!1;this.dvfsSample("DVFS Voltage","voltage",c,a[1]);return!0}};c.registerSubtype(e);return{LinuxPerfMaliParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("power_start",e.prototype.powerStartEvent.bind(this));a.registerEventHandler("power_frequency",e.prototype.powerFrequencyEvent.bind(this));a.registerEventHandler("cpu_frequency",e.prototype.cpuFrequencyEvent.bind(this));a.registerEventHandler("cpu_idle",e.prototype.cpuIdleEvent.bind(this))}var c=tracing.LinuxPerfParser;e.prototype={__proto__:c.prototype,cpuStateSlice:function(a,b,d,c){b=this.importer.getOrCreateCpuState(b);
"1"!=d?this.importer.importError("Don't understand power_start events of type "+d):(d=b.cpu.getOrCreateCounter("","C-State"),0==d.numSeries&&(d.seriesNames.push("state"),d.seriesColors.push(tracing.getStringColorId(d.name+".state"))),d.timestamps.push(a),d.samples.push(c))},cpuIdleSlice:function(a,b,d){b=this.importer.getOrCreateCpuState(b).cpu.getOrCreateCounter("","C-State");0==b.numSeries&&(b.seriesNames.push("state"),b.seriesColors.push(tracing.getStringColorId(b.name)));4294967295!=d?b.samples.push(d):
b.samples.push(0);b.timestamps.push(a)},cpuFrequencySlice:function(a,b,d){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(d)},powerStartEvent:function(a,b,d,c,e){a=/type=(\d+) state=(\d) cpu_id=(\d)+/.exec(e[5]);if(!a)return!1;b=parseInt(a[3]);d=parseInt(a[2]);this.cpuStateSlice(c,b,a[1],d);return!0},powerFrequencyEvent:function(a,
b,d,c,e){b=/type=(\d+) state=(\d+) cpu_id=(\d)+/.exec(e[5]);if(!b)return!1;a=parseInt(b[3]);b=parseInt(b[2]);this.cpuFrequencySlice(c,a,b);return!0},cpuFrequencyEvent:function(a,b,d,c,e){b=/state=(\d+) cpu_id=(\d)+/.exec(e[5]);if(!b)return!1;a=parseInt(b[2]);b=parseInt(b[1]);this.cpuFrequencySlice(c,a,b);return!0},cpuIdleEvent:function(a,b,d,c,e){b=/state=(\d+) cpu_id=(\d)+/.exec(e[5]);if(!b)return!1;a=parseInt(b[2]);b=parseInt(b[1]);this.cpuIdleSlice(c,a,b);return!0}};c.registerSubtype(e);return{LinuxPerfPowerParser:e}});
base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("sched_switch",e.prototype.schedSwitchEvent.bind(this));a.registerEventHandler("sched_wakeup",e.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;e.prototype={__proto__:c.prototype,schedSwitchEvent:function(b,c,e,l,h){var j=a.exec(h[5]);if(!j)return!1;b=j[4];e=j[5];h=parseInt(j[6]);j=parseInt(j[7]);this.importer.getOrCreateCpuState(c).switchRunningLinuxPid(this.importer,b,l,h,e,j);return!0},schedWakeupEvent:function(a,c,e,l,h){c=b.exec(h[5]);if(!c)return!1;a=c[1];e=parseInt(c[2]);c=parseInt(c[3]);this.importer.markPidRunnable(l,e,a,c);return!0}};c.registerSubtype(e);return{LinuxPerfSchedParser:e,_LinuxPerfSchedParserTestExports:TestExports}});
base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("workqueue_execute_start",e.prototype.executeStartEvent.bind(this));a.registerEventHandler("workqueue_execute_end",e.prototype.executeEndEvent.bind(this))}var c=tracing.LinuxPerfParser,a=/work struct (.+): function (\S+)/,b=/work struct (.+)/;e.prototype={__proto__:c.prototype,executeStartEvent:function(b,c,e,l,h){b=a.exec(h[5]);if(!b)return!1;h=this.importer.getOrCreateKernelThread(h[1]);h.openSliceTS=l;h.openSlice=
b[2];return!0},executeEndEvent:function(a,c,e,l,h){if(!b.exec(h[5]))return!1;a=this.importer.getOrCreateKernelThread(h[1]);a.openSlice&&(l=new tracing.TimelineSlice("",a.openSlice,tracing.getStringColorId(a.openSlice),a.openSliceTS,{},l-a.openSliceTS),a.thread.pushSlice(l));a.openSlice=void 0;return!0}};c.registerSubtype(e);return{LinuxPerfWorkqueueParser:e}});base.require("linux_perf_parser");
base.exportTo("tracing",function(){function e(a){c.call(this,a);a.registerEventHandler("tracing_mark_write:android",e.prototype.traceMarkWriteAndroidEvent.bind(this));a.registerEventHandler("0:android",e.prototype.traceMarkWriteAndroidEvent.bind(this));this.model_=a.model_;this.ppids_={}}var c=tracing.LinuxPerfParser;e.prototype={__proto__:c.prototype,traceMarkWriteAndroidEvent:function(a,b,d,c,e,l){b=e[2].split("|");switch(b[0]){case "B":var a=parseInt(b[1]),h=b[2],b=this.model_.getOrCreateProcess(a).getOrCreateThread(d);
b.name=l;if(!b.isTimestampValidForBeginOrEnd(c))return this.model_.importErrors.push("Timestamps are moving backward."),!1;this.ppids_[d]=a;b.beginSlice(null,h,c,{});break;case "E":a=this.ppids_[d];if(void 0===a)break;b=this.model_.getOrCreateProcess(a).getOrCreateThread(d);if(!b.openSliceCount)break;c=b.endSlice(c);args={};for(h in args)void 0!==c.args[h]&&this.model_.importErrors.push("Both the B and E events of "+c.name+"provided values for argument "+h+". The value of the E event will be used."),
c.args[h]=event.args[h];break;case "C":a=parseInt(b[1]);h=b[2];d=parseInt(b[3]);l=this.model_.getOrCreateProcess(a).getOrCreateCounter(null,h);0==l.numSeries&&(l.seriesNames.push("value"),l.seriesColors.push(tracing.getStringColorId(l.name+".value")));l.timestamps.push(c);l.samples.push(d);break;default:return!1}return!0}};c.registerSubtype(e);return{LinuxPerfAndroidParser:e}});base.require("timeline_model");base.require("timeline_color_scheme");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 e(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.lineNumber=-1;this.pseudoThreadCounter=1;this.parsers_=[];this.eventHandlers_={}}function a(a){return b.test(a)?b:d.test(a)?d:null}e.prototype={__proto__:Object.prototype,switchRunningLinuxPid:function(a,b,c,d,e,k){if(void 0!==this.lastActivePid&&0!=
this.lastActivePid){var q=c-this.lastActiveTs;name=(a=a.threadsByLinuxPid[this.lastActivePid])?a.userFriendlyName:this.lastActiveComm;b=new tracing.TimelineSlice("",name,tracing.getStringColorId(name),this.lastActiveTs,{comm:this.lastActiveComm,tid:this.lastActivePid,prio:this.lastActivePrio,stateWhenDescheduled:b},q);this.cpu.slices.push(b)}this.lastActiveTs=c;this.lastActivePid=d;this.lastActiveComm=e;this.lastActivePrio=k}};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(/^# tracer:/.test(b))return!0;var c=/^(.+)\n/.exec(b);c&&(b=c[1]);return a(b)?!0:!1};c.prototype={__proto__:Object.prototype,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 e(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],e=this.threadsByLinuxPid[d.args.tid];e&&(e.tempCpuSlices||(e.tempCpuSlices=[]),e.tempCpuSlices.push(d))}var k=tracing.getColorIdByName("running"),q=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",k,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",q,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",k,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;var a=a.parentTS-a.perfTS,b;for(b in this.cpuStates_){for(var c=this.cpuStates_[b].cpu,d=0;d<c.slices.length;d++){var e=c.slices[d];e.start+=a;e.duration=e.duration}for(var k in c.counters){d=c.counters[k];for(e=0;e<d.timestamps.length;e++)d.timestamps[e]+=a}}for(var q in this.kernelThreadStates_)this.kernelThreadStates_[q].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.lineNumber+1)+": "+a)},traceClockSyncEvent:function(a,b,c,d,e){a=/parent_ts=(\d+\.?\d*)/.exec(e[2]);
if(!a)return!1;this.clockSyncRecords_.push({perfTS:d,parentTS:1E3*a[1]});return!0},traceMarkingWriteEvent:function(a,b,c,d,e,k){var q=/^\s*(\w+):\s*(.*)$/.exec(e[5]);if(!q)if(0===e[5].lastIndexOf("B|",0)||"E"===e[5]||0===e[5].lastIndexOf("C|",0))q=[e[5],"android",e[5]];else return!1;a=a+":"+q[1];k=/(.+)-\d+/.exec(e[1])[1];e=this.eventHandlers_[a];return!e?(this.importError("Unknown trace_marking_write event "+a),!0):e(a,b,c,d,q,k)},importCpuData:function(){this.lines_=this.events_.split("\n");var b=
null;for(this.lineNumber=0;this.lineNumber<this.lines_.length;++this.lineNumber){var c=this.lines_[this.lineNumber];if(!(0==c.length||/^#/.test(c))){if(null==b&&(b=a(c),null==b)){this.importError("Cannot parse line: "+c);continue}var d=b.exec(c);if(d){var e=parseInt(/.+-(\d+)/.exec(d[1])[1]),j=parseInt(d[2]),k=1E3*parseFloat(d[3]),q=d[4],m=this.eventHandlers_[q];m?m(q,j,e,k,d)||this.importError("Malformed "+q+" event ("+c+")"):this.importError("Unknown event "+q+" ("+c+")")}else this.importError("Unrecognized line: "+
c)}}}};tracing.TimelineModel.registerImporter(c);return{LinuxPerfImporter:c,_LinuxPerfImporterTestExports:TestExports}});"use strict";
base.exportTo("base",function(){function e(){this.storage_="G_testRunner"in global?FakeLocalStorage():localStorage}e.prototype={get:function(c,a,b){c=this.namespace_(c,b);return!(c in this.storage_)?a:String(this.storage_[c])},set:function(c,a,b){this.storage_[this.namespace_(c,b)]=String(a)},keys:function(c){for(var a=[],c=c||"",b=0;b<this.storage_.length;b++){var d=this.storage_.key(b);this.isnamespaced_(d,c)&&a.push(this.unnamespace_(d,c))}return a},isnamespaced_:function(c,a){return 0==c.indexOf(this.normalize_(a))},
namespace_:function(c,a){return this.normalize_(a)+c},unnamespace_:function(c,a){return c.replace(this.normalize_(a),"")},normalize_:function(c){return e.NAMESPACE+(c?c+".":"")}};e.NAMESPACE="trace-viewer";return{Settings:e}});function FakeLocalStorage(){return Object.create({},{key:{value:function(e){return Object.keys(this).sort()[e]}},length:{get:function(){return Object.keys(this).length}}})}"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 e=base.ui.define("div");e.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=
l.model&&l.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 g=document.createElement("div");g.className="info-button-containerimport-errors-dialog";g.textContent="Errors occurred during import:";
g.appendChild(e);b.appendChild(g);var l=this;c.addEventListener("click",function(){b.visible=!0;e.textContent=l.model.importErrors.join("\n")}.bind(this));a();l.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=l.model&&l.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 g=document.createElement("div");g.className="info-button-container metadata-dialog";g.textContent="Metadata Info:";g.appendChild(e);b.appendChild(g);var l=this;c.addEventListener("click",function(){b.visible=!0;var a=[],c=l.model,d;for(d in c.metadata)a.push(JSON.stringify(c.metadata[d].name)+": "+
JSON.stringify(c.metadata[d].value));e.textContent=a.join("\n")}.bind(this));a();l.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&&void 0!==a.minTimestamp;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:e}});