window.FLATTENED={};window.FLATTENED.base=!0;window.FLATTENED.event_target=!0;window.FLATTENED.measuring_stick=!0;window.FLATTENED.filter=!0;window.FLATTENED.range=!0;window.FLATTENED.selection=!0;window.FLATTENED.timeline_viewport=!0;window.FLATTENED.ui=!0;window.FLATTENED["tracks.track"]=!0;window.FLATTENED["tracks.container_track"]=!0;window.FLATTENED.fast_rect_renderer=!0;window.FLATTENED.color_scheme=!0;window.FLATTENED["tracks.canvas_based_track"]=!0;window.FLATTENED.sorted_array_utils=!0;
window.FLATTENED["tracks.slice_track"]=!0;window.FLATTENED.guid=!0;window.FLATTENED["model.slice"]=!0;window.FLATTENED["model.slice_group"]=!0;window.FLATTENED["model.async_slice_group"]=!0;window.FLATTENED["model.sample"]=!0;window.FLATTENED["model.thread"]=!0;window.FLATTENED["model.counter"]=!0;window.FLATTENED["model.process_base"]=!0;window.FLATTENED["model.process"]=!0;window.FLATTENED["model.kernel"]=!0;window.FLATTENED["model.cpu"]=!0;window.FLATTENED.model=!0;
window.FLATTENED["tracks.cpu_track"]=!0;window.FLATTENED["tracks.counter_track"]=!0;window.FLATTENED["tracks.slice_group_track"]=!0;window.FLATTENED["tracks.async_slice_group_track"]=!0;window.FLATTENED["tracks.thread_track"]=!0;window.FLATTENED["tracks.process_track"]=!0;window.FLATTENED["tracks.model_track"]=!0;window.FLATTENED["tracks.ruler_track"]=!0;window.FLATTENED.timeline_track_view=!0;window.FLATTENED["analysis.util"]=!0;window.FLATTENED.timeline_analysis_view=!0;
window.FLATTENED.overlay=!0;window.FLATTENED.category_filter_dialog=!0;window.FLATTENED.find_control=!0;window.FLATTENED["importer.trace_event_importer"]=!0;window.FLATTENED["importer.linux_perf.parser"]=!0;window.FLATTENED["importer.linux_perf.bus_parser"]=!0;window.FLATTENED["importer.linux_perf.clock_parser"]=!0;window.FLATTENED["importer.linux_perf.cpufreq_parser"]=!0;window.FLATTENED["importer.linux_perf.disk_parser"]=!0;window.FLATTENED["importer.linux_perf.drm_parser"]=!0;
window.FLATTENED["importer.linux_perf.exynos_parser"]=!0;window.FLATTENED["importer.linux_perf.gesture_parser"]=!0;window.FLATTENED["importer.linux_perf.i915_parser"]=!0;window.FLATTENED["importer.linux_perf.mali_parser"]=!0;window.FLATTENED["importer.linux_perf.power_parser"]=!0;window.FLATTENED["importer.linux_perf.sched_parser"]=!0;window.FLATTENED["importer.linux_perf.workqueue_parser"]=!0;window.FLATTENED["importer.linux_perf.android_parser"]=!0;
window.FLATTENED["importer.linux_perf.kfunc_parser"]=!0;window.FLATTENED["importer.linux_perf_importer"]=!0;window.FLATTENED["importer.v8.log_reader"]=!0;window.FLATTENED["importer.v8.splaytree"]=!0;window.FLATTENED["importer.v8.codemap"]=!0;window.FLATTENED["importer.v8_log_importer"]=!0;window.FLATTENED.settings=!0;window.FLATTENED.timeline_view=!0;"use strict";var global=this;
this.base=function(){function d(b){"/"==b[b.length-1]&&(b=b.substring(0,b.length-1));q=b}function c(b,a){r[b]||(r[b]=[]);for(var f=r[b],e=!1,g=0;g<f.length;g++)f[g]==a&&(e=!0);e||f.push(a)}function a(b,a){s[b]||(s[b]=[]);for(var f=s[b],e=!1,g=0;g<s.length;g++)f[g]==a&&(e=!0);e||f.push(a)}function b(b,a){u[b]||(u[b]=[]);for(var f=u[b],e=!1,g=0;g<f.length;g++)f[g]==a&&(e=!0);e||f.push(a)}function f(){if(!p){p=!0;var f=new XMLHttpRequest,e=q+"/deps.js";f.open("GET",e,!1);f.send(null);if(200!=f.status)throw Error("Could not find "+
e+". Run calcdeps.py and try again.");base.addModuleDependency=c;base.addModuleRawScriptDependency=a;base.addModuleStylesheet=b;try{eval(f.responseText)}catch(g){throw Error("When loading deps, got "+g.stack?g.stack:g);}delete base.addModuleStylesheet;delete base.addModuleRawScriptDependency;delete base.addModuleDependency}}function e(b,a){var c=a||0;if(window.FLATTENED){if(!window.FLATTENED[b])throw Error("Somehow, module "+b+" didn't get stored in the flattened js file! You may need to rerun build/calcdeps.py");
}else if(f(),"APPENDED"!=w[b]){if("RESOLVING"==w[b])throw Error("Circular dependency betwen modules. Cannot continue!");w[b]="RESOLVING";for(var j=u[b]||[],d=0;d<j.length;d++)g(j[d]);j=s[b]||[];for(d=0;d<j.length;d++){var k=j[d];if(!v[k]){var h=q+"/"+k,h='<script type="text/javascript" src="'+h+'">\x3c/script>';base.doc.write(h);v[k]="APPENDED"}}j=r[b]||[];for(d=0;d<j.length;d++)e(j[d],c+1);c=b.replace(/\./g,"/")+".js";h=q+"/"+c;base.doc.write('<script type="text/javascript" src="'+h+'">\x3c/script>');
w[b]="APPENDED"}}function g(b){if(!window.FLATTENED&&!x[b]){x[b]=!0;b=b.replace(/\./g,"/")+".css";b=q+"/"+b;var a=document.createElement("link");a.setAttribute("rel","stylesheet");a.setAttribute("href",b);base.doc.head.appendChild(a)}}function j(b,a,f,e){var g=new base.Event(a+"Change");g.propertyName=a;g.newValue=f;g.oldValue=e;b.dispatchEvent(g)}function h(b){return b.replace(/([A-Z])/g,"-$1").toLowerCase()}function k(b,a){switch(a){case y.JS:var f=b+"_";return function(){return this[f]};case y.ATTR:var e=
h(b);return function(){return this.getAttribute(e)};case y.BOOL_ATTR:return e=h(b),function(){return this.hasAttribute(e)}}}function l(b,a,f){switch(a){case y.JS:var e=b+"_";return function(a){var g=this[e];a!==g&&(this[e]=a,f&&f.call(this,a,g),j(this,b,a,g))};case y.ATTR:var g=h(b);return function(a){var e=this[g];a!==e&&(void 0==a?this.removeAttribute(g):this.setAttribute(g,a),f&&f.call(this,a,e),j(this,b,a,e))};case y.BOOL_ATTR:return g=h(b),function(a){var e=this[g];a!==e&&(a?this.setAttribute(g,
b):this.removeAttribute(g),f&&f.call(this,a,e),j(this,b,a,e))}}}function t(b,a,f){var e=base.doc.createEvent("Event");e.initEvent(b,!!a,!!f);e.__proto__=global.Event.prototype;return e}function m(){this.types=[];this.values=[]}var q=".",p=!1,r={},u={},s={},w={},v={},x={},y={JS:"js",ATTR:"attr",BOOL_ATTR:"boolAttr"},z=1;m.prototype={__proto__:Object.prototype,add:function(b,a){this.types.push(b);this.values.push(a)},get:function(b){for(var a=0;a<this.types.length;a++)if(b instanceof this.types[a])return this.values[a]}};
return{set moduleBasePath(b){d(b)},get moduleBasePath(){return q},require:e,requireStylesheet:g,requireRawScript:function(b){if(window.FLATTENED_RAW_SCRIPTS){if(!window.FLATTENED_RAW_SCRIPTS[b])throw Error("Somehow, "+b+" didn't get stored in the flattened js file! You may need to rerun build/calcdeps.py");}else if(!v[b])throw Error(b+" should already have been loaded. Did you forget to run calcdeps.py?");},exportTo:function(b,a){var f;f=b.split(".");for(var e=global,g;f.length&&(g=f.shift());)e=
g in e?e[g]:e[g]={};f=e;try{var c=a()}catch(j){console.log("While running exports for ",name,":");console.log(j.stack||j);return}for(var d in c)(e=Object.getOwnPropertyDescriptor(c,d))&&Object.defineProperty(f,d,e)},addSingletonGetter:function(b){b.getInstance=function(){return b.instance_||(b.instance_=new b)}},createUid:function(){return z++},defineProperty:function(b,a,f,e){"function"==typeof b&&(b=b.prototype);f=f||y.JS;b.__lookupGetter__(a)||b.__defineGetter__(a,k(a,f));b.__lookupSetter__(a)||
b.__defineSetter__(a,l(a,f,e))},dispatchPropertyChange:j,dispatchSimpleEvent:function(b,a,f,e){a=new base.Event(a,f,e);return b.dispatchEvent(a)},Event:t,getUid:function(b){return b.hasOwnProperty("uid")?b.uid:b.uid=z++},initialize:function(){if(global.document)t.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),d("/src");else{var b=cr;Object.defineProperty(global,"cr",{get:function(){Object.defineProperty(global,"cr",{value:b});originalBase.initialize();return b},configurable:!0})}},PropertyKind:y,asArray:function(b){for(var a=[],f=0;f<b.length;f++)a.push(b[f]);return a},concatenateArrays:function(){for(var b=[],a=0;a<arguments.length;a++){if(!(arguments[a]instanceof Array))throw Error("Arguments "+a+"is not an array");b.push.apply(b,
arguments[a])}return b},dictionaryKeys:function(b){var a=[],f;for(f in b)a.push(f);return a},dictionaryValues:function(b){var a=[],f;for(f in b)a.push(b[f]);return a},TypeMap:m}}();base.initialize();
base.exportTo("base",function(){function d(){}d.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],f=b.indexOf(a);0<=f&&(1==b.length?delete this.listeners_[c]:b.splice(f,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,f=0;if(b in this.listeners_)for(var b=this.listeners_[b].concat(),e=0,g;g=b[e];e++)f=g.handleEvent?f|!1===g.handleEvent.call(g,c):f|!1===g.call(this,c);return!f&&c.returnValue}};return{EventTarget:d}});
base.exportTo("tracing",function(){function d(){this.iframe_=void 0}d.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],f=this.iframe_.contentDocument.createElement("link");f.rel="stylesheet";f.href=b.href;this.iframe_.contentDocument.head.appendChild(f)}},detach:function(){document.body.removeChild(this.iframe_);this.iframe_=void 0}};return{MeasuringStick:d}});"use strict";
base.exportTo("tracing",function(){function d(){}function c(b){this.text_=b}function a(b){this.categories_={};b=b||[];for(var a=0;a<b.length;a++)this.addCategory(b[a])}d.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__:d.prototype,matchCounter:function(b){return 0==this.text_.length||void 0===b.name?!1:-1!=b.name.indexOf(this.text_)},
matchSlice:function(b){return 0==this.text_.length||void 0===b.title?!1:-1!=b.title.indexOf(this.text_)}};a.prototype={__proto__:d.prototype,addCategory:function(b){this.categories_[b]=!0},matchCounter:function(b){return!b.category?!0:!this.categories_[b.category]},matchSlice:function(b){return!b.category?!0:!this.categories_[b.category]}};return{filterCounterArray:function(b,a){if(void 0===b)return a;for(var e=[],g=0;g<a.length;++g)b.matchCounter(a[g])&&e.push(a[g]);return e},filterSliceArray:function(b,
a){if(void 0===b)return a;for(var e=[],g=0;g<a.length;++g)b.matchSlice(a[g])&&e.push(a[g]);return e},Filter:d,TitleFilter:c,CategoryFilter:a}});"use strict";"use strict";
base.exportTo("base",function(){function d(){this.isEmpty_=!0;this.max_=this.min_=void 0}d.prototype={__proto__:Object.prototype,reset:function(){this.isEmpty_=!0;this.max_=this.min_=void 0},get isEmpty(){return this.isEmpty_},addRange:function(c){c.isEmpty||(this.addValue(c.min),this.addValue(c.max))},addValue:function(c){this.isEmpty_?(this.min_=this.max_=c,this.isEmpty_=!1):(this.max_=Math.max(this.max_,c),this.min_=Math.min(this.min_,c))},get min(){return this.isEmpty_?void 0:this.min_},get max(){return this.isEmpty_?
void 0:this.max_}};return{Range:d}});"use strict";base.require("range");base.require("event_target");
base.exportTo("tracing",function(){function d(b,a){this.track=b;this.slice=a}function c(b,a,e){this.track=b;this.counter=a;this.sampleIndex=e}function a(){this.bounds_dirty_=!0;this.bounds_=new base.Range;this.length_=0}d.prototype={get selected(){return this.slice.selected},set selected(b){this.slice.selected=b}};c.prototype={get selected(){return!0==this.track.selectedSamples[this.sampleIndex]},set selected(b){this.track.selectedSamples[this.sampleIndex]=b?!0:!1;this.track.invalidate()}};a.prototype=
{__proto__:Object.prototype,get bounds(){if(this.bounds_dirty_){this.bounds_.reset();for(var b=0;b<this.length_;b++){var a=this[b];a.slice&&(this.bounds_.addValue(a.slice.start),this.bounds_.addValue(a.slice.end))}this.bounds_dirty_=!1}return this.bounds_},get duration(){return this.bounds_.isEmpty?0:this.bounds_.max-this.bounds_.min},get length(){return this.length_},clear:function(){for(var b=0;b<this.length_;++b)delete this[b];this.length_=0;this.bounds_dirty_=!0},pushHit:function(b){this.push_(b)},
push_:function(b){this[this.length_++]=b;this.bounds_dirty_=!0;return b},addSlice:function(b,a){return this.push_(new d(b,a))},addCounterSample:function(b,a,e){return this.push_(new c(b,a,e))},subSelection:function(b,f){f=f||1;var e=new a;e.bounds_dirty_=!0;if(0>b||b+f>this.length_)throw Error("Index out of bounds");for(var g=b;g<b+f;g++)e.push_(this[g]);return e},getCounterSampleHitsAsSelection:function(){for(var b=new a,f=0;f<this.length_;f++)this[f]instanceof c&&b.push_(this[f]);return b},getSliceHitsAsSelection:function(){for(var b=
new a,f=0;f<this.length_;f++)this[f]instanceof d&&b.push_(this[f]);return b},getNumSliceHits:function(){for(var b=0,a=0;a<this.length_;a++)this[a]instanceof d&&b++;return b},getNumCounterHits:function(){for(var b=0,a=0;a<this.length_;a++)this[a]instanceof c&&b++;return b},map:function(b){for(var a=0;a<this.length_;a++)b(this[a])},getShiftedSelection:function(b){for(var f=new a,e=0;e<this.length_;e++){var g=this[e];g.track.addItemNearToProvidedHitToSelection(g,b,f)}return 0==f.length?void 0:f}};return{SelectionSliceHit:d,
SelectionCounterSampleHit:c,Selection:a}});"use strict";base.require("event_target");
base.exportTo("tracing",function(){function d(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}d.prototype={__proto__:base.EventTarget.prototype,drawUnderContent:function(){},drawOverContent:function(a,
b,f,e){if(this.gridEnabled){var g=this.gridTimebase;for(a.beginPath();g<f;){if(g>=b){var c=this.xWorldToView(g);a.moveTo(c,0);a.lineTo(c,e)}g+=this.gridStep}a.strokeStyle="rgba(255,0,0,0.25)";a.stroke()}for(g=0;g<this.markers.length;++g)this.markers[g].drawLine(a,b,f,e,this)},setWhenPossible:function(a){this.pendingSetFunction_=a},get isAttachedToDocument_(){for(var a=this.parentEl_;a.parentNode;)a=a.parentNode;return a==this.parentEl_.ownerDocument},onResize_:function(){this.dispatchChangeEvent()},
checkForAttach_:function(){if(this.isAttachedToDocument_&&0!=this.clientWidth){this.iframe_||(this.iframe_=document.createElement("iframe"),this.iframe_.style.cssText="position:absolute;width:100%;height:0;border:0;visibility:hidden;",this.parentEl_.appendChild(this.iframe_),this.iframe_.contentWindow.addEventListener("resize",this.onResizeBoundToThis_));var a=this.clientWidth+"x"+this.clientHeight;if(this.pendingSetFunction_){this.lastSize_=a;try{this.pendingSetFunction_()}catch(b){console.log("While running setWhenPossible:",
b)}this.pendingSetFunction_=void 0}window.clearInterval(this.checkForAttachInterval_);this.checkForAttachInterval_=void 0}},dispatchChangeEvent:function(){base.dispatchSimpleEvent(this,"change")},dispatchMarkersChangeEvent_:function(){base.dispatchSimpleEvent(this,"markersChange")},detach:function(){this.checkForAttachInterval_&&(window.clearInterval(this.checkForAttachInterval_),this.checkForAttachInterval_=void 0);this.iframe_&&(this.iframe_.removeEventListener("resize",this.onResizeBoundToThis_),
this.parentEl_.removeChild(this.iframe_))},get scaleX(){return this.scaleX_},set scaleX(a){this.scaleX_!=a&&(this.scaleX_=a,this.dispatchChangeEvent())},get panX(){return this.panX_},set panX(a){this.panX_!=a&&(this.panX_=a,this.dispatchChangeEvent())},setPanAndScale:function(a,b){if(this.scaleX_!=b||this.panX_!=a)this.scaleX_=b,this.panX_=a,this.dispatchChangeEvent()},xWorldToView:function(a){return(a+this.panX_)*this.scaleX_},xWorldVectorToView:function(a){return a*this.scaleX_},xViewToWorld:function(a){return a/
this.scaleX_-this.panX_},xViewVectorToWorld:function(a){return a/this.scaleX_},xPanWorldPosToViewPos:function(a,b,f){if("string"==typeof b)if("left"==b)b=0;else if("center"==b)b=f/2;else if("right"==b)b=f-1;else throw Error("unrecognized string for viewPos. left|center|right");this.panX=b/this.scaleX_-a},xPanWorldBoundsIntoView:function(a,b,f){0>this.xWorldToView(a)?this.xPanWorldPosToViewPos(a,"left",f):this.xWorldToView(b)>f&&this.xPanWorldPosToViewPos(b,"right",f)},xSetWorldBounds:function(a,b,
f){this.setPanAndScale(-a,f/(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 f=this.xViewVectorToWorld(b),e=0;e<this.markers.length;++e)if(Math.abs(this.markers[e].positionWorld-a)<=f)return this.markers[e]}};c.prototype={get positionWorld(){return this.positionWorld_},set positionWorld(a){this.positionWorld_=
a;this.viewport_.dispatchChangeEvent()},set selected(a){this.selected_=a;this.viewport_.dispatchChangeEvent()},get selected(){return this.selected_},get color(){return this.selected?"rgb(255,0,0)":"rgb(0,0,0)"},drawTriangle_:function(a,b,f,e,g,c){a.beginPath();var d=this.positionWorld_;d>=b&&d<f&&(b=c.xWorldToView(d),a.moveTo(b,g),a.lineTo(b-3,g/2),a.lineTo(b+3,g/2),a.lineTo(b,g),a.closePath(),a.fillStyle=this.color,a.fill(),g!=e&&(a.beginPath(),a.moveTo(b,g),a.lineTo(b,e),a.closePath(),a.strokeStyle=
this.color,a.stroke()))},drawLine:function(a,b,f,e,g){a.beginPath();var c=this.positionWorld_;c>=b&&c<f&&(b=g.xWorldToView(c),a.moveTo(b,0),a.lineTo(b,e));a.strokeStyle=this.color;a.stroke()}};return{TimelineViewport:d,ViewportMarker:c}});
base.exportTo("tracing.ui",function(){function d(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 f=0,e;e=b[f];f++)e instanceof a||a.decorate(e)},define:function(c){function a(e){var g=b(f,e);a.decorate(g);for(var c in e)g[c]=e[c];return g}var b,f;"function"==typeof c?(b=c,f=""):(b=d,f=c);a.decorate=function(b){b.__proto__=a.prototype;b.decorate()};return a},limitInputWidth:function(c,
a,b){function f(){if(c.scrollWidth>l)c.style.width=l+"px";else{c.style.width=0;var a=c.scrollWidth;c.style.width=a<b?b+"px":a+"px"}}c.style.width="10px";var e=c.ownerDocument.defaultView,g=e.getComputedStyle(c),e=e.getComputedStyle(a),j="rtl"==g.direction,d=c.getBoundingClientRect(),k=a.getBoundingClientRect(),d=j?k.right-d.right:d.left-k.left,g=parseInt(g.borderLeftWidth,10)+parseInt(g.paddingLeft,10)+parseInt(g.paddingRight,10)+parseInt(g.borderRightWidth,10),e=j?parseInt(e.paddingLeft,10):parseInt(e.paddingRight,
10),l=a.clientWidth-d-g-e;c.addEventListener("input",f);f()},toCssPx:function(c){window.isFinite(c)||console.error("Pixel value is not a number: "+c);return Math.round(c)+"px"}}});base.requireStylesheet("tracks.track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define("div");d.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("track-button");a.classList.add("track-close-button");a.textContent=String.fromCharCode(215);var b=this;a.addEventListener("click",
function(){b.style.display="None"});this.appendChild(a);var f=document.createElement("div");f.classList.add("track-button");f.classList.add("track-collapse-button");f.textContent="\u2212";var e=!1;f.addEventListener("click",function(){e=!e;this.collapsedDidChange(e);f.textContent=e?"+":"\u2212"});this.appendChild(f);c||(f.style.display="None")}};return{Track:d}});"use strict";base.require("tracks.track");base.require("filter");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.Track);d.prototype={__proto__:tracing.tracks.Track.prototype,decorate:function(){this.categoryFilter_=new tracing.Filter;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 f=0;f<this.tracks_.length;f++){var e=this.tracks_[f].getBoundingClientRect();a>=e.top&&a<e.bottom&&this.tracks_[f].addIntersectingItemsToSelection(c,a,b)}return!1},addIntersectingItemsInRangeToSelection:function(c,a,b,f,e){for(var g=0;g<this.tracks_.length;g++){var j=this.tracks_[g].getBoundingClientRect(),d=Math.max(b,j.top),
j=Math.min(f,j.bottom);d<=j&&this.tracks_[g].addIntersectingItemsInRangeToSelection(c,a,b,f,e)}},addAllObjectsMatchingFilterToSelection:function(c,a){for(var b=0;b<this.tracks_.length;b++)this.tracks_[b].addAllObjectsMatchingFilterToSelection(c,a)}};return{ContainerTrack:d}});
base.exportTo("tracing",function(){function d(c,a,b,f){this.ctx_=c;this.minRectSize_=a;this.maxMergeDist_=b;this.pallette_=f}d.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 f=c+a;a<this.minRectSize_?(f-this.mergeStartX_>this.maxMergeDist_&&this.flush(),this.merging_?(this.mergeCurRight_=f,this.mergedColorId=Math.max(this.mergedColorId,b)):(this.merging_=!0,this.mergeStartX_=c,this.mergeCurRight_=
f,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:d}});"use strict";
base.exportTo("tracing",function(){function d(b){for(var a=0,f=0;f<b.length;++f)a=(a+37*a+11*b.charCodeAt(f))%4294967295;return a}var c=[{r:138,g:113,b:152},{r:175,g:112,b:133},{r:127,g:135,b:225},{r:93,g:81,b:137},{r:116,g:143,b:119},{r:178,g:214,b:122},{r:87,g:109,b:147},{r:119,g:155,b:95},{r:114,g:180,b:160},{r:132,g:85,b:103},{r:157,g:210,b:150},{r:148,g:94,b:86},{r:164,g:108,b:138},{r:139,g:191,b:150},{r:110,g:99,b:145},{r:80,g:129,b:109},{r:125,g:140,b:149},{r:93,g:124,b:132},{r:140,g:85,b:140},
{r:104,g:163,b:162},{r:132,g:141,b:178},{r:131,g:105,b:147},{r:135,g:183,b:98},{r:152,g:134,b:177},{r:141,g:188,b:141},{r:133,g:160,b:210},{r:126,g:186,b:148},{r:112,g:198,b:205},{r:180,g:122,b:195},{r:203,g:144,b:152},{r:182,g:125,b:143},{r:126,g:200,b:148},{r:133,g:160,b:210},{r:240,g:240,b:240}],a=c.length-4,b=c.length,f=c.concat(c.map(function(b){var a;a=240<=b.r&&240<=b.g&&240<=b.b?-0.2:0.45;return{r:Math.min(255,b.r+Math.floor(b.r*a)),g:Math.min(255,b.g+Math.floor(b.g*a)),b:Math.min(255,b.b+
Math.floor(b.b*a))}})).map(function(b){return"rgb("+b.r+","+b.g+","+b.b+")"}),e={};return{getColorPalette:function(){return f},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:d,getStringColorId:function(b){if(void 0===e[b]){var f=d(b);e[b]=f%a}return e[b]}}});"use strict";base.requireStylesheet("tracks.canvas_based_track");
base.require("tracks.track");base.require("fast_rect_renderer");base.require("color_scheme");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.Track);d.prototype={__proto__:tracing.tracks.Track.prototype,decorate:function(){this.className="canvas-based-track";this.slices_=null;this.headingDiv_=document.createElement("div");this.headingDiv_.className="canvas-based-track-title";this.appendChild(this.headingDiv_);this.canvasContainer_=document.createElement("div");this.canvasContainer_.className="canvas-based-track-canvas-container";this.appendChild(this.canvasContainer_);
this.canvas_=document.createElement("canvas");this.canvas_.className="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("ruler-track-with-distance-measurements"):this.classList.add("ruler-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{CanvasBasedTrack:d}});
base.exportTo("tracing",function(){function d(a,b,f){if(0==a.length)return 1;for(var e=0,g=a.length-1,c,d,k=-1;e<=g;)c=Math.floor((e+g)/2),d=b(a[c])-f,0>d?e=c+1:(0<d||(k=c),g=c-1);return-1!=k?k:e}function c(a,b,f,e,g,c){if(0!=a.length&&!(e>g)){var h=d(a,b,e);if(-1!=h&&(0<h&&b(a[h-1])+f(a[h-1])>=e&&c(a[h-1]),h!=a.length))for(f=a.length;h<f&&!(b(a[h])>=g);h++)c(a[h])}}return{findLowIndexInSortedArray:d,findLowIndexInSortedIntervals:function(a,b,f,e){var g=d(a,b,e);return 0==g?e>=b(a[0])&&e<b(a[0]+f(a[0]))?
0:-1:g<=a.length&&e>=b(a[g-1])&&e<b(a[g-1])+f(a[g-1])?g-1:a.length},iterateOverIntersectingIntervals:c,getIntersectingIntervals:function(a,b,f,e,g){var j=[];c(a,b,f,e,g,function(b){j.push(b)});return j}}});"use strict";base.requireStylesheet("tracks.slice_track");base.require("tracks.canvas_based_track");base.require("sorted_array_utils");base.require("fast_rect_renderer");base.require("color_scheme");base.require("ui");
base.exportTo("tracing.tracks",function(){function d(){}function c(b,a){this.string=b;this.width=a}var a=tracing.getColorPalette(),b=tracing.ui.define(tracing.tracks.CanvasBasedTrack);b.prototype={__proto__:tracing.tracks.CanvasBasedTrack.prototype,SHOULD_ELIDE_TEXT:!0,decorate:function(){this.classList.add("slice-track");this.elidedTitleCache=new d;this.asyncStyle_=!1},decorateHit:function(){},get asyncStyle(){return this.asyncStyle_},set asyncStyle(b){this.asyncStyle_=!!b;this.invalidate()},get slices(){return this.slices_},
set slices(b){this.slices_=b||[];b||(this.visible=!1);this.invalidate()},get height(){return window.getComputedStyle(this).height},set height(b){this.style.height=b;this.invalidate()},labelWidth:function(b){var a=e[b];a||(a=this.ctx_.measureText(b).width,e[b]=a);return a+2},labelWidthWorld:function(b,a){return this.labelWidth(b)*a},redraw:function(){var b=this.ctx_,e=this.canvas_.width,g=this.canvas_.height;b.clearRect(0,0,e,g);var c=this.viewport_,d=c.xViewVectorToWorld(1),m=c.xViewToWorld(0),e=
c.xViewToWorld(e);c.drawUnderContent(b,m,e,g);b.save();c.applyTransformToCanvas(b);this.asyncStyle_&&(b.globalAlpha=0.25);var q=new tracing.FastRectRenderer(b,2*d,2*d,a);q.setYandH(0,g);for(var p=this.slices_,r=tracing.findLowIndexInSortedArray(p,function(b){return b.start+b.duration},m),u=r;u<p.length;++u){var s=p[u],w=s.start;if(w>e)break;var v=Math.max(s.duration,0.001),x=s.selected?s.colorId+f:s.colorId;v<d&&(v=d);0<s.duration?q.fillRect(w,v,x):0.001<d?q.fillRect(w,d,x):(b.fillStyle=a[x],b.beginPath(),
b.moveTo(w-4*d,g),b.lineTo(w,0),b.lineTo(w+4*d,g),b.closePath(),b.fill())}q.flush();b.restore();q=window.devicePixelRatio||1;if(8<g){b.textAlign="center";b.textBaseline="top";b.font=10*q+"px sans-serif";b.strokeStyle="rgb(0,0,0)";b.fillStyle="rgb(0,0,0)";w=20*d;v=this.SHOULD_ELIDE_TEXT;for(u=r;u<p.length;++u){s=p[u];if(s.start>e)break;s.duration>w&&(r=s.title,s.didNotFinish&&(r+=" (Did Not Finish)"),x=this.labelWidth(r),v&&this.labelWidthWorld(r,d)>s.duration&&(x=this.elidedTitleCache.get(this,d,
r,x,s.duration),r=x.string,x=x.width),x*d<s.duration&&(s=c.xWorldToView(s.start+0.5*s.duration),b.fillText(r,s,2.5*q,x)))}}c.drawOverContent(b,m,e,g)},addIntersectingItemsToSelection:function(b,a,f){var e=this.getBoundingClientRect();if(a<e.top||a>=e.bottom)return!1;b=this.viewport_.xViewVectorToWorld(b*devicePixelRatio);b=tracing.findLowIndexInSortedIntervals(this.slices_,function(b){return b.start},function(b){return b.duration},b);return 0<=b&&b<this.slices_.length?(f=f.addSlice(this,this.slices_[b]),
this.decorateHit(f),!0):!1},addIntersectingItemsInRangeToSelection:function(b,a,f,e,g){function c(b){b=g.addSlice(p,b);p.decorateHit(b)}var d=window.devicePixelRatio||1;b=this.viewport_.xViewToWorld(b*d);a=this.viewport_.xViewToWorld(a*d);d=this.getBoundingClientRect();f=Math.max(f,d.top);e=Math.min(e,d.bottom);if(!(f>e)){var p=this;tracing.iterateOverIntersectingIntervals(this.slices_,function(b){return b.start},function(b){return b.duration},b,a,c)}},indexOfSlice_:function(b){for(var a=tracing.findLowIndexInSortedArray(this.slices_,
function(b){return b.start},b.start);a<this.slices_.length&&b.start==this.slices_[a].start&&b.colorId!=this.slices_[a].colorId;)a++;return a<this.slices_.length?a:void 0},addItemNearToProvidedHitToSelection:function(b,a,f){if(!b.slice)return!1;b=this.indexOfSlice_(b.slice);if(void 0===b)return!1;a=b+a;if(0>a||a>=this.slices_.length)return!1;b=f.addSlice(this,this.slices_[a]);this.decorateHit(b);return!0},addAllObjectsMatchingFilterToSelection:function(b,a){for(var f=0;f<this.slices_.length;++f)if(b.matchSlice(this.slices_[f])){var e=
a.addSlice(this,this.slices_[f]);this.decorateHit(e)}}};var f=tracing.getColorPaletteHighlightIdBoost(),e={},g={};d.prototype={get:function(b,a,f,e,d){var m=g[f];m||(m={},g[f]=m);e=m[a];e||(m[a]={},e=m[a]);m=e[d];if(void 0===m){for(m=!1;b.labelWidthWorld(f,a)>d;)f=f.substring(0,0.75*f.length),m=!0;m&&3<f.length&&(f=f.substring(0,f.length-3)+"...");m=new c(f,b.labelWidth(f));e[d]=m}return m}};return{SliceTrack:b}});"use strict";"use strict";base.exportTo("tracing",function(){var d=1;return{GUID:{allocate:function(){return d++}}}});
"use strict";base.exportTo("tracing.model",function(){function d(c,a,b,f,e,g){this.category=c||"";this.title=a;this.start=f;this.colorId=b;this.args=e;this.didNotFinish=!1;void 0!==g&&(this.duration=g)}d.prototype={selected:!1,duration:void 0,get end(){return this.start+this.duration}};return{Slice:d}});"use strict";base.require("range");base.require("model.slice");base.require("color_scheme");base.require("filter");
base.exportTo("tracing.model",function(){function d(a){this.sliceConstructor=a||c;this.openPartialSlices_=[];this.slices=[];this.bounds=new base.Range}var c=tracing.model.Slice;d.prototype={__proto__:Object.prototype,get length(){return this.slices.length},pushSlice:function(a){this.slices.push(a);return a},pushSlices:function(a){this.slices.push.apply(this.slices,a)},beginSlice:function(a,b,f,e){if(this.openPartialSlices_.length&&f<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,f,e?e:{});this.openPartialSlices_.push(a);return a},isTimestampValidForBeginOrEnd:function(a){return!this.openPartialSlices_.length?!0:a>=this.openPartialSlices_[this.openPartialSlices_.length-1].start},get openSliceCount(){return this.openPartialSlices_.length},endSlice:function(a){if(!this.openSliceCount)throw Error("endSlice called without an open slice");var b=this.openPartialSlices_[this.openSliceCount-1];this.openPartialSlices_.splice(this.openSliceCount-
1,1);if(a<b.start)throw Error("Slice "+b.title+" end time is before its start.");b.duration=a-b.start;this.pushSlice(b);return b},autoCloseOpenSlices:function(a){a||(this.updateBounds(),a=this.bounds.max);for(;0<this.openSliceCount;)this.endSlice(a).didNotFinish=!0},shiftTimestampsForward:function(a){for(var b=0;b<this.slices.length;b++){var f=this.slices[b];f.start+=a}for(b=0;b<this.openPartialSlices_.length;b++)f=this.openPartialSlices_[i],f.start+=a},updateBounds:function(){this.bounds.reset();
for(var a=0;a<this.slices.length;a++)this.bounds.addValue(this.slices[a].start),this.bounds.addValue(this.slices[a].end);this.openPartialSlices_.length&&(this.bounds.addValue(this.openPartialSlices_[0].start),this.bounds.addValue(this.openPartialSlices_[this.openPartialSlices_.length-1].start))},copySlice:function(a){var b=new this.sliceConstructor(a.category,a.title,a.colorId,a.start,a.args,a.duration);b.didNotFinish=a.didNotFinish;return b}};d.merge=function(a,b){if(0<a.openPartialSlices_.length)throw Error("groupA has open partial slices");
if(0<b.openPartialSlices_.length)throw Error("groupB has open partial slices");for(var f=new d,e=a.slices,g=b.slices,c=e.length-1,h=g.length-1,k=[],l=[],t=function(b){for(var a=0;a<l.length;a++){var e=l[a],g=e.end;if(b<e.start||g<b)throw Error("slice should not be split");var c=f.copySlice(e);e.start=b;e.duration=g-b;e.title+=" (cont.)";c.duration=b-c.start;l[a]=c;f.pushSlice(c)}},m=function(b){for(;0<k.length||0<l.length;){var a=k[k.length-1],f=l[l.length-1],a=a&&a.start,f=f&&f.start;if((void 0===
a||a<b)&&(void 0===f||f<b))break;void 0===f||a>f?(t(a),k.pop()):l.pop()}};0<=c||0<=h;){var q=e[c],p=g[h];void 0===q||void 0!==p&&q.end<p.end?(q=f.copySlice(p),p=!0,h--):(q=f.copySlice(q),p=!1,c--);m(q.end);f.pushSlice(q);p?l.push(q):(t(q.end),k.push(q))}m();f.slices.reverse();return f};return{SliceGroup:d}});"use strict";base.require("range");base.require("model.slice");
base.exportTo("tracing.model",function(){function d(b,f,e,g,c){a.call(this,b,f,e,g,c)}function c(){this.slices=[];this.bounds=new base.Range}var a=tracing.model.Slice;d.prototype={__proto__:a.prototype,toJSON:function(){for(var b={},a=Object.keys(this),e=0;e<a.length;e++){var g=a[e];"function"!=typeof this[g]&&(b[g]="startThread"==g||"endThread"==g?this[g].guid:this[g])}return b},id:void 0,startThread:void 0,endThread:void 0,subSlices:void 0};c.prototype={__proto__:Object.prototype,push:function(b){this.slices.push(b)},
get length(){return this.slices.length},shiftTimestampsForward:function(b){for(var a=0;a<this.slices.length;a++){var e=this.slices[a];e.start+=b;for(var g=0;g<e.subSlices.length;g++)e.subSlices[g].start+=b}},updateBounds:function(){this.bounds.reset();for(var b=0;b<this.slices.length;b++)this.bounds.addValue(this.slices[b].start),this.bounds.addValue(this.slices[b].end)},computeSubGroups:function(){for(var b={},a=0;a<this.slices.length;++a){var e=this.slices[a],g=e.startThread.guid;b[g]||(b[g]=new c);
b[g].slices.push(e)}var a=[],d;for(d in b)e=b[d],e.updateBounds(),a.push(e);return a}};return{AsyncSlice:d,AsyncSliceGroup:c}});"use strict";base.exportTo("tracing.model",function(){function d(c,a,b,f,e){this.category=c||"";this.title=a;this.colorId=b;this.start=f;this.args=e}d.prototype={selected:!1,duration:0,get end(){return this.start}};return{Sample:d}});"use strict";base.require("range");base.require("guid");base.require("model.slice");base.require("model.slice_group");base.require("model.async_slice_group");
base.require("model.sample");
base.exportTo("tracing.model",function(){function d(b,f,c,d,k,l){a.call(this,b,f,c,d,k,l);this.subSlices=[]}function c(a,g){b.call(this,d);this.guid_=tracing.GUID.allocate();if(!a)throw Error("Parent must be provided.");this.parent=a;this.tid=g;this.cpuSlices=void 0;this.samples_=[];this.kernelSlices=new b;this.asyncSlices=new f;this.bounds=new base.Range}var a=tracing.model.Slice,b=tracing.model.SliceGroup,f=tracing.model.AsyncSliceGroup;d.prototype={__proto__:a.prototype};c.prototype={__proto__:b.prototype,
get guid(){return this.guid_},compareTo:function(b){return c.compare(this,b)},toJSON:function(){for(var b={},a=Object.keys(this),f=0;f<a.length;f++){var c=a[f];"function"!=typeof this[c]&&(b[c]="parent"==c?this[c].guid:this[c])}return b},addSample:function(b,a,f,c){if(this.samples_.length&&f<this.samples_[this.samples_.length-1].start)throw Error("Samples must be added in increasing timestamp order.");var d=tracing.getStringColorId(a);b=new tracing.model.Sample(b,a,d,f,c?c:{});this.samples_.push(b);
return b},get samples(){return this.samples_},name:void 0,shiftTimestampsForward:function(a){b.prototype.shiftTimestampsForward.call(this,a);if(this.cpuSlices)for(var f=0;f<this.cpuSlices.length;f++)this.cpuSlices[f].start+=a;if(this.samples_.length)for(f=0;f<this.samples_.length;f++)this.samples_[f].start+=a;this.kernelSlices.shiftTimestampsForward(a);this.asyncSlices.shiftTimestampsForward(a)},get isEmpty(){return this.slices.length||this.openSliceCount||this.cpuSlices&&this.cpuSlices.length||this.kernelSlices.length||
this.asyncSlices.length||this.samples_.length?!1:!0},updateBounds:function(){b.prototype.updateBounds.call(this);this.kernelSlices.updateBounds();this.bounds.addRange(this.kernelSlices.bounds);this.asyncSlices.updateBounds();this.bounds.addRange(this.asyncSlices.bounds);this.cpuSlices&&this.cpuSlices.length&&(this.bounds.addValue(this.cpuSlices[0].start),this.bounds.addValue(this.cpuSlices[this.cpuSlices.length-1].end));this.samples_.length&&(this.bounds.addValue(this.samples_[0].start),this.bounds.addValue(this.samples_[this.samples_.length-
1].end))},addCategoriesToDict:function(b){for(var a=0;a<this.slices.length;a++)b[this.slices[a].category]=!0;for(a=0;a<this.kernelSlices.length;a++)b[this.kernelSlices.slices[a].category]=!0;for(a=0;a<this.asyncSlices.length;a++)b[this.asyncSlices.slices[a].category]=!0;for(a=0;a<this.samples_.length;a++)b[this.samples_[a].category]=!0},mergeKernelWithUserland:function(){0<this.kernelSlices.length&&(this.slices=b.merge(this,this.kernelSlices).slices,this.kernelSlices=new b,this.updateBounds())},get userFriendlyName(){return this.parent.userFriendlyName+
": "+(this.name||this.tid)},get userFriendlyDetails(){return this.parent.userFriendlyDetails+", tid: "+this.tid+(this.name?", name: "+this.name:"")}};c.compare=function(b,a){var f=b.parent.compareTo(a.parent);return 0!=f?f:b.name&&a.name?(f=b.name.localeCompare(a.name),0==f?b.tid-a.tid:f):b.name?-1:a.name?1:b.tid-a.tid};return{ThreadSlice:d,Thread:c}});"use strict";base.require("guid");base.require("range");
base.exportTo("tracing.model",function(){function d(c,a,b,f){this.guid_=tracing.GUID.allocate();this.parent=c;this.id=a;this.category=b||"";this.name=f;this.seriesNames=[];this.seriesColors=[];this.timestamps=[];this.samples=[];this.bounds=new base.Range}d.prototype={__proto__:Object.prototype,get guid(){return this.guid_},toJSON:function(){for(var c={},a=Object.keys(this),b=0;b<a.length;b++){var f=a[b];"function"!=typeof this[f]&&(c[f]="parent"==f?this[f].guid:this[f])}return c},get numSeries(){return this.seriesNames.length},
get numSamples(){return this.timestamps.length},getSampleValue:function(c,a){return this.samples[c*this.numSeries+a]},getSampleStatistics:function(c){c.sort();for(var a=this.numSeries,b=[],f=0;f<a;++f){for(var e=0,g=Number.MAX_VALUE,d=-Number.MAX_VALUE,h=0;h<c.length;h++)var k=c[h],e=e+this.getSampleValue(k,f),g=Math.min(this.getSampleValue(k,f),g),d=Math.max(this.getSampleValue(k,f),d);e/=c.length;h=this.getSampleValue(c[0],f);k=this.getSampleValue(c[c.length-1],f);b.push({min:g,max:d,avg:e,start:h,
end:k})}return b},shiftTimestampsForward:function(c){for(var a=0;a<this.timestamps.length;a++)this.timestamps[a]+=c},updateBounds:function(){if(this.seriesNames.length!=this.seriesColors.length)throw Error("seriesNames.length must match seriesColors.length");if(this.numSeries*this.numSamples!=this.samples.length)throw Error("samples.length must be a multiple of numSamples.");this.totals=[];this.maxTotal=0;this.bounds.reset();if(0!=this.samples.length){this.bounds.addValue(this.timestamps[0]);this.bounds.addValue(this.timestamps[this.timestamps.length-
1]);for(var c=this.numSeries,a=-Infinity,b=0;b<this.timestamps.length;b++){for(var f=0,e=0;e<c;e++)f+=this.samples[b*c+e],this.totals.push(f);f>a&&(a=f)}this.maxTotal=a}}};d.compare=function(c,a){var b=c.parent.compareTo(a);if(0!=b)return b;b=c.name.localeCompare(a.name);return 0==b?c.tid-a.tid:b};return{Counter:d}});"use strict";base.require("range");base.require("guid");base.require("model.thread");base.require("model.counter");
base.exportTo("tracing.model",function(){function d(){this.guid_=tracing.GUID.allocate();this.threads={};this.counters={};this.bounds=new base.Range}var c=tracing.model.Thread,a=tracing.model.Counter;d.prototype={get guid(){return this.guid_},get numThreads(){var b=0,a;for(a in this.threads)b++;return b},shiftTimestampsForward:function(b){for(var a in this.threads)this.threads[a].shiftTimestampsForward(b);for(var e in this.counters)this.counters[e].shiftTimestampsForward(b)},autoCloseOpenSlices:function(b){for(var a in this.threads)this.threads[a].autoCloseOpenSlices(b)},
mergeKernelWithUserland:function(){for(var b in this.threads)this.threads[b].mergeKernelWithUserland()},updateBounds:function(){this.bounds.reset();for(var b in this.threads)this.threads[b].updateBounds(),this.bounds.addRange(this.threads[b].bounds);for(var a in this.counters)this.counters[a].updateBounds(),this.bounds.addRange(this.counters[a].bounds)},addCategoriesToDict:function(b){for(var a in this.threads)this.threads[a].addCategoriesToDict(b);for(var e in this.counters)b[this.counters[e].category]=
!0},findAllThreadsNamed:function(b){var a=[],e;for(e in this.threads){var c=this.threads[e];c.name==b&&a.push(c)}return a},pruneEmptyContainers:function(){var b={},a;for(a in this.threads){var e=this.threads[a];e.isEmpty||(b[a]=e)}this.threads=b},getOrCreateThread:function(b){this.threads[b]||(this.threads[b]=new c(this,b));return this.threads[b]},getOrCreateCounter:function(b,f){var e=b+"."+f;this.counters[e]||(this.counters[e]=new a(this,e,b,f));return this.counters[e]}};return{ProcessBase:d}});
"use strict";base.require("model.process_base");base.exportTo("tracing.model",function(){function d(c){tracing.model.ProcessBase.call(this);this.pid=c}d.compare=function(c,a){return c.pid-a.pid};d.prototype={__proto__:tracing.model.ProcessBase.prototype,compareTo:function(c){return d.compare(this,c)},get userFriendlyName(){return this.pid},get userFriendlyDetails(){return"pid: "+this.pid}};return{Process:d}});"use strict";base.require("model.process_base");
base.exportTo("tracing.model",function(){function d(){tracing.model.ProcessBase.call(this)}d.compare=function(){return 0};d.prototype={__proto__:tracing.model.ProcessBase.prototype,compareTo:function(c){return d.compare(this,c)},get userFriendlyName(){return"kernel"},get userFriendlyDetails(){return"kernel"}};return{Kernel:d}});"use strict";base.require("range");base.require("model.slice");base.require("model.counter");
base.exportTo("tracing.model",function(){function d(a){this.cpuNumber=a;this.slices=[];this.counters={};this.bounds=new base.Range}var c=tracing.model.Counter;d.prototype={getOrCreateCounter:function(a,b){var f;f=a.length?a+"."+b:b;this.counters[f]||(this.counters[f]=new c(this,f,a,b));return this.counters[f]},shiftTimestampsForward:function(a){for(var b=0;b<this.slices.length;b++)this.slices[b].start+=a;for(var f in this.counters)this.counters[f].shiftTimestampsForward(a)},updateBounds:function(){this.bounds.reset();
this.slices.length&&(this.bounds.addValue(this.slices[0].start),this.bounds.addValue(this.slices[this.slices.length-1].end));for(var a in this.counters)this.counters[a].updateBounds(),this.bounds.addRange(this.counters[a].bounds)},addCategoriesToDict:function(a){for(var b=0;b<this.slices.length;b++)a[this.slices[b].category]=!0;for(var f in this.counters)a[this.counters[f].category]=!0}};d.compare=function(a,b){return a.cpuNumber-b.cpuNumber};return{Cpu:d}});"use strict";base.require("range");base.require("event_target");
base.require("model.process");base.require("model.kernel");base.require("model.cpu");base.require("filter");
base.exportTo("tracing",function(){function d(a,f){this.kernel=new b;this.cpus={};this.processes={};this.importErrors=[];this.metadata=[];this.categories=[];this.bounds=new base.Range;a&&this.importTraces([a],f)}function c(){this.importPriority=0}var a=tracing.model.Process,b=tracing.model.Kernel,f=tracing.model.Cpu,e=[];d.registerImporter=function(b){e.push(b)};d.prototype={__proto__:base.EventTarget.prototype,get numProcesses(){var b=0,a;for(a in this.processes)b++;return b},getOrCreateCpu:function(b){this.cpus[b]||
(this.cpus[b]=new f(b));return this.cpus[b]},getOrCreateProcess:function(b){this.processes[b]||(this.processes[b]=new a(b));return this.processes[b]},updateCategories_:function(){var b={};this.kernel.addCategoriesToDict(b);for(var a in this.processes)this.processes[a].addCategoriesToDict(b);for(var f in this.cpus)this.cpus[f].addCategoriesToDict(b);this.categories=[];for(var e in b)""!=e&&this.categories.push(e)},updateBounds:function(){this.bounds.reset();this.kernel.updateBounds();this.bounds.addRange(this.kernel.bounds);
for(var b in this.processes)this.processes[b].updateBounds(),this.bounds.addRange(this.processes[b].bounds);for(var a in this.cpus)this.cpus[a].updateBounds(),this.bounds.addRange(this.cpus[a].bounds)},shiftWorldToZero:function(){if(!this.bounds.isEmpty){var b=this.bounds.min;this.kernel.shiftTimestampsForward(-b);for(var a in this.processes)this.processes[a].shiftTimestampsForward(-b);for(var f in this.cpus)this.cpus[f].shiftTimestampsForward(-b);this.updateBounds()}},getAllThreads:function(){var b=
[],a;for(a in this.kernel.threads)b.push(e.threads[a]);for(var f in this.processes){var e=this.processes[f];for(a in e.threads)b.push(e.threads[a])}return b},getAllCpus:function(){var b=[],a;for(a in this.cpus)b.push(this.cpus[a]);return b},getAllProcesses:function(){var b=[],a;for(a in this.processes)b.push(this.processes[a]);return b},getAllCounters:function(){var b=[],a;for(a in this.processes){var f=this.processes[a],e;for(e in f.counters)b.push(f.counters[e])}for(var c in this.cpus){a=this.cpus[c];
for(var d in a.counters)b.push(a.counters[d])}return b},findAllThreadsNamed:function(b){var a=[];a.push.apply(a,this.kernel.findAllThreadsNamed(b));for(var f in this.processes)a.push.apply(a,this.processes[f].findAllThreadsNamed(b));return a},createImporter_:function(b){for(var a,f=0;f<e.length;++f)if(e[f].canImport(b)){a=e[f];break}if(!a)throw Error("Could not find an importer for the provided eventData.");return new a(this,b)},importTraces:function(b,a){void 0===a&&(a=!0);for(var f=[],e=0;e<b.length;++e)f.push(this.createImporter_(b[e]));
f.sort(function(b,a){return b.importPriority-a.importPriority});for(e=0;e<f.length;e++)f[e].importEvents(0<e);this.updateBounds();this.kernel.autoCloseOpenSlices(this.bounds.max);for(var c in this.processes)this.processes[c].autoCloseOpenSlices(this.bounds.max);for(e=0;e<f.length;e++)f[e].finalizeImport();this.kernel.pruneEmptyContainers();for(c in this.processes)this.processes[c].pruneEmptyContainers();for(c in this.processes)this.processes[c].mergeKernelWithUserland();this.updateBounds();this.updateCategories_();
a&&this.shiftWorldToZero()}};c.canImport=function(b){return b instanceof Array&&0==b.length?!0:"string"===typeof b||b instanceof String?0==b.length:!1};c.prototype={__proto__:Object.prototype,importEvents:function(){},finalizeImport:function(){}};d.registerImporter(c);return{Model:d}});"use strict";base.require("tracks.container_track");base.require("tracks.slice_track");base.require("filter");base.require("model");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(){this.classList.add("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 tracing.tracks.SliceTrack;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 tracing.tracks.CounterTrack,a.heading="CPU "+this.cpu_.cpuNumber+" "+c.name+":",a.counter=c,this.addTrack_(a)}this.addControlButtonElements_(!1)}};
return{CpuTrack:d}});"use strict";base.requireStylesheet("tracks.counter_track");base.require("tracks.canvas_based_track");base.require("color_scheme");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.getColorPalette(),c=tracing.ui.define(tracing.tracks.CanvasBasedTrack);c.prototype={__proto__:tracing.tracks.CanvasBasedTrack.prototype,decorate:function(){this.classList.add("counter-track");this.addControlButtonElements_(!1);this.selectedSamples_={};this.categoryFilter_=new tracing.Filter},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_,f=this.canvas_.width,e=this.canvas_.height;b.clearRect(0,0,f,e);var c=this.viewport_,j=c.xViewVectorToWorld(1),h=c.xViewToWorld(0),f=c.xViewToWorld(f);c.drawUnderContent(b,h,f,e);var k=c.xViewVectorToWorld(1);b.save();c.applyTransformToCanvas(b);for(var l=a.numSeries,
t=a.numSamples,m=tracing.findLowIndexInSortedArray(a.timestamps,function(b){return b},h),m=0<m-1?m-1:0,q=e/a.maxTotal,p=a.numSeries-1;0<=p;p--){b.fillStyle=d[a.seriesColors[p]];b.beginPath();for(var r=m-1,u=0<=r?a.timestamps[r]-k:-1,s=e,w=!1;;){var v=r+1;if(v>=t){b.lineTo(u,s);b.lineTo(u+8*j,s);b.lineTo(u+8*j,e);break}var x=a.timestamps[v],y=a.totals[v*l+p],y=e-q*y;if(x>f){b.lineTo(x,s);b.lineTo(x,e);break}if(v+1<t&&(r=a.timestamps[v+1],r-u<=k&&r<f)){r=v;continue}w||(b.moveTo(h,e),w=!0);x-u<k&&(x=
u+k);b.lineTo(x,s);b.lineTo(x,y);r=v;u=x;s=y}b.closePath();b.fill()}b.fillStyle="rgba(255, 0, 0, 1)";for(v in this.selectedSamples_)if(this.selectedSamples_[v]){x=a.timestamps[v];for(p=a.numSeries-1;0<=p;p--)y=a.totals[v*l+p],y=e-q*y,b.fillRect(x-j,y-1,3*j,3)}b.restore();c.drawOverContent(b,h,f,e)},addIntersectingItemsToSelection:function(a,b,f){var e=this.getBoundingClientRect();if(b<e.top||b>=e.bottom)return!1;b=this.viewport_.xViewVectorToWorld(a*devicePixelRatio);e=this.counter_;if(a<this.counter_.timestamps[0])return!1;
a=tracing.findLowIndexInSortedArray(e.timestamps,function(b){return b},b);if(0>a||a>=e.timestamps.length)return!1;0<a&&b>this.counter_.timestamps[a-1]&&a--;this.getBoundingClientRect();f=f.addCounterSample(this,this.counter,a);this.decorateHit(f);return!0},addIntersectingItemsInRangeToSelection:function(a,b,f,e,c){var d=this.getBoundingClientRect();f=Math.max(f,d.top);e=Math.min(e,d.bottom);if(!(f>e)){e=this.counter_;d=window.devicePixelRatio||1;a=this.viewport_.xViewToWorld(a*d);d=this.viewport_.xViewToWorld(b*
d);f=tracing.findLowIndexInSortedArray(e.timestamps,function(b){return b},a);b=tracing.findLowIndexInSortedArray(e.timestamps,function(b){return b},d);0<f&&a>e.timestamps[f-1]&&f--;0<b&&d>e.timestamps[b-1]&&b--;for(a=f;a<=b;a++)a>=e.timestamps.length||(d=c.addCounterSample(this,this.counter,a),this.decorateHit(d))}},addAllObjectsMatchingFilterToSelection:function(){}};return{CounterTrack:c}});"use strict";base.require("tracks.container_track");base.require("sorted_array_utils");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(){this.classList.add("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 tracing.tracks.SliceTrack;a.slices=c;a.decorateHit=this.decorateHit_;this.addTrack_(a);return a},updateChildTracks_:function(){if(this.group_){var c=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);if(c.length){if(this.visible=!0,!this.areArrayContentsSame_(this.filteredSlices_,c)){this.filteredSlices_=c;this.detach();this.subRows_=this.buildSubRows_(c);for(c=0;c<this.subRows_.length;c++)this.subRows_[c].length&&
this.addSliceTrack_(this.subRows_[c])}}else this.visible=!1}else this.visible=!1},buildSubRows_:function(c){if(!c.length)return[];for(var a=[],b=0;b<c.length;b++)c[b].subSlices&&c[b].subSlices.splice(0,c[b].subSlices.length),a.push(b);a.sort(function(b,a){var f=c[b],e=c[a];return f.start!=e.start?f.start-e.start:a-b});var f=[[]];this.badSlices_=[];for(b=0;b<a.length;b++){for(var e=c[a[b]],g=!1,d=f.length-1;0<=d;d--)if(0!=f[d].length){var h=f[d][f[d].length-1];e.start<h.start&&(this.badSlices_.push(e),
g=!0);if(e.start>=h.start&&e.end<=h.end){for(;f.length<=d+1;)f.push([]);f[d+1].push(e);h.subSlices&&h.subSlices.push(e);g=!0;break}}g||f[0].push(e)}return f},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{SliceGroupTrack:d}});"use strict";base.require("tracks.slice_group_track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.SliceGroupTrack);d.prototype={__proto__:tracing.tracks.SliceGroupTrack.prototype,decorate:function(){this.classList.add("async-slice-group-track")},addSliceTrack_:function(c){c=tracing.tracks.SliceGroupTrack.prototype.addSliceTrack_.call(this,c);c.asyncStyle=!0;return c},buildSubRows_:function(){var c=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);c.sort(function(b,a){return b.start-a.start});for(var a=
[],b=0;b<c.length;b++){for(var f=c[b],e=!1,g=0;g<a.length;g++){var d=a[g];if(f.start>=d[d.length-1].end){e=!0;if(void 0===f.subSlices||1>f.subSlices.length)throw Error("AsyncEvent missing subSlices: ")+f.name;for(g=0;g<f.subSlices.length;g++)d.push(f.subSlices[g]);break}}if(!e&&(d=[],void 0!==f.subSlices)){for(g=0;g<f.subSlices.length;g++)d.push(f.subSlices[g]);a.push(d)}}return a}};return{AsyncSliceGroupTrack:d}});"use strict";base.requireStylesheet("tracks.thread_track");base.require("tracks.container_track");
base.require("tracks.slice_track");base.require("tracks.slice_group_track");base.require("tracks.async_slice_group_track");base.require("filter");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(){this.classList.add("thread-track");this.categoryFilter_=new tracing.Filter},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 tracing.tracks.SliceTrack;c.heading="";c.slices=this.thread_.cpuSlices;c.height="4px";c.decorateHit=function(a){a.thread=this.thread_};this.addTrack_(c);c=new tracing.tracks.AsyncSliceGroupTrack;c.categoryFilter=this.categoryFilter;c.decorateHit=function(){};c.group=this.thread_.asyncSlices;this.addTrack_(c);c=new tracing.tracks.SliceGroupTrack;
c.decorateHit=function(a){a.thread=this.thread_};c.group=this.thread_;this.addTrack_(c);this.thread_.samples.length&&(c=new tracing.tracks.SliceTrack,c.group=this.thread_,c.slices=this.thread_.samples,c.decorateHit=function(a){a.thread=this.thread_},this.addTrack_(c));this.updateVisibility_()}this.addControlButtonElements_(4<=this.tracks_.length)},updateVisibility_:function(){if(this.categoryFilter.matchThread(this.thread)){for(var c=!1,a=0;a<this.tracks_.length;++a){var b=this.tracks_[a];if(b.visible&&
(c=!0,1<=a)){b.heading=this.heading_;b.tooltip=this.tooltip_;break}}this.visible=c}else this.visible=!1},collapsedDidChange:function(c){if(c){c=parseInt(this.tracks_[0].height);for(var a=0;a<this.tracks_.length;++a)2<c?this.tracks_[a].height=Math.floor(c)+"px":this.tracks_[a].style.display="none",c*=0.5}else for(a=0;a<this.tracks_.length;++a)this.tracks_[a].height=this.tracks_[0].height,this.tracks_[a].style.display=""}};return{ThreadTrack:d}});"use strict";base.require("tracks.container_track");
base.require("tracks.counter_track");base.require("tracks.thread_track");base.require("filter");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(){this.classList.add("process-track");this.categoryFilter_=new tracing.Filter},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.model.Counter.compare);c.forEach(function(b){var a=new tracing.tracks.CounterTrack;a.heading=b.name+":";a.counter=b;this.addTrack_(a)}.bind(this));c=[];for(a in this.process.threads)c.push(this.process.threads[a]);c.sort(tracing.model.Thread.compare);c.forEach(function(b){var a=new tracing.tracks.ThreadTrack;a.heading=b.userFriendlyName+":";a.tooltip=b.userFriendlyDetails;a.thread=b;this.addTrack_(a)}.bind(this))}}};
return{ProcessTrack:d}});"use strict";base.requireStylesheet("tracks.model_track");base.require("tracks.container_track");base.require("tracks.cpu_track");base.require("tracks.process_track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(){this.classList.add("model-track");this.measuringStick_=new tracing.MeasuringStick;this.measuringStick_.attach()},detach:function(){tracing.tracks.ContainerTrack.prototype.detach.call(this);this.measuringStick_.detach()},get model(){return this.model_},set model(c){this.model_=c;this.updateHeadingWidth_();this.updateChildTracks_()},
updateHeadingWidth_:function(){var c=[];this.model.getAllThreads().forEach(function(b){c.push(b.userFriendlyName)});this.model.getAllCounters().forEach(function(b){c.push(b.name)});this.model.getAllCpus().forEach(function(b){c.push("CPU "+b.cpuNumber)});var a=0,b=document.createElement("div");b.style.position="fixed";b.className="canvas-based-track-title";for(var f=0;f<c.length;f++){b.textContent=c[f]+":__";var e=this.measuringStick_.measure(b).width;300<e&&(e=300);e>a&&(a=e)}this.headingWidth=a+
"px"},updateChildTracks_:function(){this.detachAllChildren();if(this.model_){var c=this.model_.getAllCpus();c.sort(tracing.model.Cpu.compare);for(var a=0;a<c.length;++a){var b=c[a],f=new tracing.tracks.CpuTrack;f.heading="CPU "+b.cpuNumber+":";f.cpu=b;this.addTrack_(f)}c=this.model_.getAllProcesses();c.sort(tracing.model.Process.compare);for(a=0;a<c.length;++a)b=c[a],f=new tracing.tracks.ProcessTrack,f.process=b,this.addTrack_(f)}}};return{ModelTrack:d}});"use strict";base.requireStylesheet("tracks.ruler_track");
base.require("tracks.track");base.require("tracks.canvas_based_track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.CanvasBasedTrack),c=Math.log(10);d.prototype={__proto__:tracing.tracks.CanvasBasedTrack.prototype,decorate:function(){this.classList.add("ruler-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 b=window.devicePixelRatio||1;a=this.viewport_.xViewToWorld((a-
this.canvasContainer_.offsetLeft)*b);var f=this.viewport_.findMarkerNear(a,6),e=!1,c=!1;f||(f=this.viewport_.addMarker(a),e=!0);f.selected=!0;var d=this,h=function(a){a=d.viewport_.xViewToWorld((a.clientX-d.canvasContainer_.offsetLeft)*b);f.positionWorld=a;c=!0},k=function(){f.selected=!1;!c&&!e&&d.viewport_.removeMarker(f);document.removeEventListener("mouseup",k);document.removeEventListener("mousemove",h)};document.addEventListener("mouseup",k);document.addEventListener("mousemove",h)},drawLine_:function(a,
b,f,e,c,d){a.beginPath();a.moveTo(b,f);a.lineTo(e,c);a.closePath();a.strokeStyle=d;a.stroke()},drawArrow_:function(a,b,f,e,c,d,h){this.drawLine_(a,b,f,e,c,h);var k=e-b,l=c-f,t=Math.sqrt(k*k+l*l),m=(t-10)/t;b+=m*k;f+=m*l;l=l/t*d;d*=-(k/t);a.beginPath();a.fillStyle=h;a.moveTo(b+l,f+d);a.lineTo(e,c);a.lineTo(b-l,f-d);a.lineTo(b+l,f+d);a.closePath();a.fill()},redraw:function(){var a=this.ctx_,b=this.canvas_.width,f=this.canvas_.height;a.clearRect(0,0,b,f);var e=this.viewport_;e.xViewVectorToWorld(1);
for(var g=e.xViewToWorld(0),d=e.xViewToWorld(b),h=this.classList.contains("ruler-track-with-distance-measurements"),k=h?f/2:f,l=0;l<e.markers.length;++l)e.markers[l].drawTriangle_(a,g,d,f,k,e);var t=window.devicePixelRatio||1,m=150*t,l=e.xViewVectorToWorld(m),q,p,r;p=Math.pow(10,Math.ceil(Math.log(l)/c));t=[10,5,2,1];for(l=0;l<t.length;++l)if(!(e.xWorldVectorToView(p/t[l])<m)){q=p/t[l-1];break}r=void 0;100>q?(m="ms",p=1,r=this.strings_msecs_):(m="s",p=1E3,r=this.strings_secs_);var u=e.xWorldVectorToView(q/
5),l=Math.floor(g/q)*q,f=Math.floor(0.25*f);a.fillStyle="rgb(0, 0, 0)";a.strokeStyle="rgb(0, 0, 0)";a.textAlign="left";a.textBaseline="top";t=window.devicePixelRatio||1;a.font=9*t+"px sans-serif";for(g=l;g<d;g+=q){var s=Math.floor(e.xWorldToView(g)),l=Math.floor(1E5*(g/p))/1E5;r[l]||(r[l]=l+" "+m);a.fillText(r[l],s+2*t,0);a.beginPath();a.moveTo(s,0);a.lineTo(s,k);for(l=1;5>l;++l){var w=Math.floor(s+u*l);a.moveTo(w,k-f);a.lineTo(w,k)}a.stroke()}if(h){a.moveTo(0,k);a.lineTo(b,k);a.stroke();b=e.markers.slice();
b.sort(function(b,a){return b.positionWorld_-a.positionWorld_});k+=2;d=k+4;for(l=0;l<b.length-1;l++)t=b[l+1],r=b[l],u=t.positionWorld-r.positionWorld,q=e.xWorldVectorToView(u),h=e.xWorldToView(r.positionWorld+u/2),100>u?(m="ms",p=1):(m="s",p=1E3),p=u/p,m=Math.abs(Math.floor(1E3*p)/1E3)+" "+m,p=a.measureText(m).width,f=e.xViewVectorToWorld(p),p=p+26+10,g=r.positionWorld+u/2-f/2,s=g+f,u=k,f=e.xWorldToView(g),g=e.xWorldToView(s),r=e.xWorldToView(r.positionWorld),t=e.xWorldToView(t.positionWorld),s=!1,
p<=q&&(a.fillStyle="rgb(0,0,0)",a.fillText(m,f,u),s=!0),26<=q&&(s?(m=f-10,p=g+10):p=m=h,this.drawArrow_(a,m,d,r,d,3,"rgb(128,121,121)"),this.drawArrow_(a,p,d,t,d,3,"rgb(128,121,121)"))}},addIntersectingItemsToSelection:function(){},addIntersectingItemsInRangeToSelection:function(){},addAllObjectsMatchingFilterToSelection:function(){}};return{RulerTrack:d}});"use strict";base.requireStylesheet("timeline_track_view");base.require("event_target");base.require("measuring_stick");base.require("filter");
base.require("selection");base.require("timeline_viewport");base.require("tracks.model_track");base.require("tracks.ruler_track");base.require("ui");
base.exportTo("tracing",function(){var d=tracing.Selection,c=tracing.TimelineViewport,a=tracing.ui.define("div");a.prototype={__proto__:HTMLDivElement.prototype,model_:null,decorate:function(){this.classList.add("timeline-track-view");this.categoryFilter_=new tracing.CategoryFilter;this.viewport_=new c(this);this.rulerTrack_=new tracing.tracks.RulerTrack;this.rulerTrack_.viewport=this.viewport_;this.appendChild(this.rulerTrack_);this.modelTrackContainer_=document.createElement("div");this.modelTrackContainer_.className=
"model-track-container";this.appendChild(this.modelTrackContainer_);this.modelTrack_=new tracing.tracks.ModelTrack;this.modelTrackContainer_.appendChild(this.modelTrack_);this.dragBox_=this.ownerDocument.createElement("div");this.dragBox_.className="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 d},bindEventListener_:function(b,a,e,c){this.boundListeners_||(this.boundListeners_=[]);e=e.bind(c);this.boundListeners_.push({object:b,
event:a,boundFunc:e});b.addEventListener(a,e)},detach:function(){this.modelTrack_.detach();for(var b=0;b<this.boundListeners_.length;b++){var a=this.boundListeners_[b];a.object.removeEventListener(a.event,a.boundFunc)}this.boundListeners_=void 0;this.viewport_.detach()},get viewport(){return this.viewport_},get categoryFilter(){return this.categoryFilter_},set categoryFilter(b){this.categoryFilter_=b;this.modelTrack_.categoryFilter=b},get model(){return this.model_},set model(b){if(!b)throw Error("Model cannot be null");
var a=this.model_!=b;this.model_=b;this.modelTrack_.model=b;this.modelTrack_.viewport=this.viewport_;this.modelTrack_.categoryFilter=this.categoryFilter;this.rulerTrack_.headingWidth=this.modelTrack_.headingWidth;a&&this.viewport_.setWhenPossible(this.setInitialViewport_.bind(this))},get numVisibleTracks(){return this.modelTrack_.numVisibleTracks},setInitialViewport_:function(){var b=0.15*(this.model_.bounds.max-this.model_.bounds.min);this.viewport_.xSetWorldBounds(this.model_.bounds.min-b,this.model_.bounds.max+
b,this.firstCanvas.width)},addAllObjectsMatchingFilterToSelection:function(b,a){this.modelTrack_.addAllObjectsMatchingFilterToSelection(b,a)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},set focusElement(b){this.focusElement_=b},get listenToKeys_(){return!this.viewport_.isAttachedToDocument_||this.activeElement instanceof tracing.FindControl?!1:!this.focusElement_?!0:0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0},onKeypress_:function(b){var a=
this.viewport_;if(this.firstCanvas&&this.listenToKeys_&&"INPUT"!=document.activeElement.nodeName){var e=this.firstCanvas.clientWidth;switch(b.keyCode){case 119:case 44:this.zoomBy_(1.5);break;case 115:case 111:this.zoomBy_(1/1.5);break;case 103:this.onGridToggle_(!0);break;case 71:this.onGridToggle_(!1);break;case 87:case 60:this.zoomBy_(10);break;case 83:case 79:this.zoomBy_(0.1);break;case 97:a.panX+=a.xViewVectorToWorld(0.1*e);break;case 100:case 101:a.panX-=a.xViewVectorToWorld(0.1*e);break;case 65:a.panX+=
a.xViewVectorToWorld(0.5*e);break;case 68:a.panX-=a.xViewVectorToWorld(0.5*e);break;case 48:case 122:this.setInitialViewport_();break;case 102:this.zoomToSelection_()}}},onMouseWheel_:function(b){if(b.altKey){var a=Math.pow(1.5,b.wheelDeltaY/120);this.zoomBy_(a);b.preventDefault()}},onKeydown_:function(b){if(this.listenToKeys_){var a,e=this.viewport_,c=this.firstCanvas.clientWidth;switch(b.keyCode){case 37:if(a=this.selection.getShiftedSelection(-1))this.setSelectionAndMakeVisible(a),b.preventDefault();
else{if(!this.firstCanvas)return;e.panX+=e.xViewVectorToWorld(0.1*c)}break;case 39:if(a=this.selection.getShiftedSelection(1))this.setSelectionAndMakeVisible(a),b.preventDefault();else{if(!this.firstCanvas)return;e.panX-=e.xViewVectorToWorld(0.1*c)}break;case 9:-1==this.focusElement.tabIndex&&(b.shiftKey?this.selectPrevious_(b):this.selectNext_(b),b.preventDefault())}b.shiftKey&&this.dragBeginEvent_&&(b=b.shiftKey,this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,
this.dragBoxXEnd_,this.dragBoxYEnd_,b))}},onKeyup_:function(b){this.listenToKeys_&&(b.shiftKey||this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_,b.shiftKey))},zoomBy_:function(b){if(this.firstCanvas){var a=this.viewport_,e=this.firstCanvas.clientWidth,c=this.lastMouseViewPos_.x*(window.devicePixelRatio||1),d=a.xViewToWorld(c);a.scaleX*=b;a.xPanWorldPosToViewPos(d,c,e)}},zoomToSelection_:function(){if(this.selection){var b=this.selection.bounds,
a=b.min+0.5*(b.max-b.min),b=0.5*(b.max-b.min),e=0.15*b;this.viewport_.xSetWorldBounds(a-b-e,a+b+e,this.firstCanvas.width)}},get keyHelp(){var b="Qwerty Controls\n w/s           : Zoom in/out    (with shift: go faster)\n a/d           : Pan left/right\n\nDvorak Controls\n ,/o           : Zoom in/out     (with shift: go faster)\n a/e           : Pan left/right\n\nMouse Controls\n drag          : Select slices   (with "+(0==navigator.platform.indexOf("Mac")?"cmd":"ctrl")+": zoom to slices)\n drag + shift  : Select all slices vertically\n\n",
b=this.focusElement.tabIndex?b+" <-            : Select previous event on current timeline\n ->            : Select next event on current timeline\n":b+"General Navigation\n g/General     : Shows grid at the start/end of the selected task\n <-,^TAB       : Select previous event on current timeline\n ->, TAB       : Select next event on current timeline\n";return b+"\nAlt + Scroll to zoom in/out\nDbl-click to zoom in; Shift dbl-click to zoom out\nf to zoom into selection\nz to reset zoom and pan to initial view\n"},
get selection(){return this.selection_},set selection(b){if(!(b instanceof d))throw Error("Expected Selection");var a;for(a=0;a<this.selection_.length;a++)this.selection_[a].selected=!1;this.selection_=b;base.dispatchSimpleEvent(this,"selectionChange");for(a=0;a<this.selection_.length;a++)this.selection_[a].selected=!0;this.viewport_.dispatchChangeEvent()},setSelectionAndMakeVisible:function(b,a){if(!(b instanceof d))throw Error("Expected Selection");this.selection=b;var e=this.selection.bounds,c=
this.viewport_.xWorldVectorToView(e.max-e.min);a&&50>c?(c=e.min+0.5*(e.max-e.min),e=5*(e.max-e.min),this.viewport_.xSetWorldBounds(c-0.5*e,c+0.5*e,this.firstCanvas.width)):this.viewport_.xPanWorldBoundsIntoView(e.min,e.max,this.firstCanvas.width)},get firstCanvas(){if(this.rulerTrack_)return this.rulerTrack_.firstCanvas;if(this.modelTrack_)return this.modelTrack_.firstCanvas},hideDragBox_:function(){this.dragBox_.style.left="-1000px";this.dragBox_.style.top="-1000px";this.dragBox_.style.width=0;this.dragBox_.style.height=
0},setDragBoxPosition_:function(b,a,e,c,d){var h=Math.min(b,e);b=Math.max(b,e);e=this.modelTrack_.getBoundingClientRect();d?(d=e.top,e=e.bottom):(d=Math.min(a,c),e=Math.max(a,c));a=d;c=h+(b-h);d=a+(e-d);var k=this.modelTrackContainer_.getBoundingClientRect();e=k.left;var l=k.top,t=k.right,k=k.bottom,m=parseInt(this.modelTrack_.headingWidth);e+=m;m={};h>t||c<e||a>k||d<l?a=!1:(m.left=Math.max(e,h),m.top=Math.max(l,a),m.right=Math.min(t,c),m.bottom=Math.min(k,d),m.width=m.right-m.left,m.height=m.bottom-
m.top,a=m);this.dragBox_.style.left=a.left+"px";this.dragBox_.style.width=a.width+"px";this.dragBox_.style.top=a.top+"px";this.dragBox_.style.height=a.height+"px";a=window.devicePixelRatio||1;c=this.firstCanvas;h=this.viewport_.xViewToWorld((h-c.offsetLeft)*a);b=this.viewport_.xViewToWorld((b-c.offsetLeft)*a);a=Math.round(100*(b-h))/100;this.dragBox_.textContent=a+"ms";a=new base.Event("selectionChanging");a.loWX=h;a.hiWX=b;this.dispatchEvent(a)},onGridToggle_:function(b){b=b?this.selection_.bounds.min:
this.selection_.bounds.max;var a=Math.ceil((b-this.model_.bounds.min)/this.viewport_.gridStep_);this.viewport_.gridTimebase=b-(a+1)*this.viewport_.gridStep_;this.viewport_.gridEnabled=!0},isChildOfThis_:function(b){if(b!=this){for(;b.parentNode;){if(b==this)return!0;b=b.parentNode}return!1}},onMouseDown_:function(b){if(0===b.button)if(b.shiftKey)this.rulerTrack_.placeAndBeginDraggingMarker(b.clientX);else{var a=this.firstCanvas,e=this.modelTrack_.getBoundingClientRect(),c=this.firstCanvas.getBoundingClientRect();
e&&(b.clientX>=e.left&&b.clientX<e.right&&b.clientY>=e.top&&b.clientY<e.bottom&&b.clientX>=c.left&&b.clientX<c.right)&&(this.viewport_.xViewToWorld(b.clientX-a.offsetLeft),this.dragBeginEvent_=b,b.preventDefault(),document.activeElement&&document.activeElement.blur(),0<=this.focusElement.tabIndex&&this.focusElement.focus())}},onMouseMove_:function(b){if(this.firstCanvas){var a=this.firstCanvas;this.lastMouseViewPos_={x:b.clientX-a.offsetLeft,y:b.clientY-a.offsetTop};this.dragBeginEvent_&&(this.dragBoxXStart_=
this.dragBeginEvent_.clientX,this.dragBoxXEnd_=b.clientX,this.dragBoxYStart_=this.dragBeginEvent_.clientY,this.dragBoxYEnd_=b.clientY,this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_,b.shiftKey))}},onMouseUp_:function(b){if(this.dragBeginEvent_){this.hideDragBox_();var a=this.dragBeginEvent_;this.dragBeginEvent_=null;var e,c=Math.min(a.clientX,b.clientX),j=Math.max(a.clientX,b.clientX);this.modelTrackContainer_.getBoundingClientRect();b.shiftKey?
(a=this.modelTrack_.getBoundingClientRect(),e=a.top,a=a.bottom):(e=Math.min(a.clientY,b.clientY),a=Math.max(a.clientY,b.clientY));var h=this.firstCanvas,c=c-h.offsetLeft,j=j-h.offsetLeft,h=new d;this.modelTrack_.addIntersectingItemsInRangeToSelection(c,j,e,a,h);this.selection=h;(base.isMac&&b.metaKey||!base.isMac&&b.ctrlKey)&&this.zoomToSelection_()}},onDblClick_:function(b){var a=this.modelTrackContainer_.getBoundingClientRect(),e=a.left,a=a.right,c=parseInt(this.modelTrack_.headingWidth);b.clientX<
e+c||b.clientX>a||(e=4,b.shiftKey&&(e=1/e),this.zoomBy_(e),b.preventDefault())}};base.defineProperty(a,"model",base.PropertyKind.JS);return{TimelineTrackView:a}});"use strict";base.exportTo("tracing.analysis",function(){return{tsRound:function(d){return Math.round(1E3*d)/1E3}}});"use strict";base.require("analysis.util");base.require("ui");base.requireStylesheet("timeline_analysis_view");
base.exportTo("tracing",function(){function d(b,a){var e=a.getSliceHitsAsSelection(),c=a.getCounterSampleHitsAsSelection();if(1==e.length){var d=e[0].slice,h=b.appendTable("analysis-slice-table",2);b.appendTableHeader(h,"Selected slice:");b.appendSummaryRow(h,"Title",d.title);d.category&&b.appendSummaryRow(h,"Category",d.category);b.appendSummaryRowTime(h,"Start",d.start);b.appendSummaryRowTime(h,"Duration",d.duration);d.durationInUserTime&&b.appendSummaryRowTime(h,"Duration (U)",d.durationInUserTime);
var e=0,k;for(k in d.args)e+=1;if(0<e)for(k in b.appendSummaryRow(h,"Args"),d.args)b.appendSummaryRow(h," "+k,d.args[k])}else if(1<e.length){var l=e.bounds.min,t=e.bounds.max;e.map(function(b){return b.slice.title});var h=0,m={};for(k=0;k<e.length;k++)d=e[k].slice,m[d.title]||(m[d.title]={slices:[]},h++),m[d.title].slices.push(d);h=b.appendTable("analysis-slices-table",3);b.appendTableHeader(h,"Slices:");var d=0,q;for(q in m){var p=m[q],r=0;k=0;var u=Number.MAX_VALUE,s=-Number.MAX_VALUE,w=Number.MAX_VALUE,
v=-Number.MAX_VALUE;for(k=0;k<p.slices.length;k++)r+=p.slices[k].duration,u=Math.min(p.slices[k].start,u),s=Math.max(p.slices[k].start,s),w=Math.min(p.slices[k].duration,w),v=Math.max(p.slices[k].duration,v);d+=r;0==p.slices.length&&(k=0);k=r/p.slices.length;w={min:w,max:v,avg:k,avg_stddev:void 0,frequency:void 0,frequency_stddev:void 0};for(k=v=0;k<p.slices.length;k++)var x=w.avg-p.slices[k].duration,v=v+x*x;w.avg_stddev=Math.sqrt(v/(p.slices.length-1));k=s-u;if(2<p.slices.length&&0<k){u=p.slices.length-
1;w.frequency=1E3*u/k;v=0;for(k=1;k<p.slices.length;k++)x=w.frequency-1E3/(p.slices[k].start-p.slices[k-1].start),v+=x*x;w.frequency_stddev=Math.sqrt(v/(u-1))}b.appendDataRow(h,q,r,p.slices.length,w)}b.appendDataRow(h,"*Totals",d,e.length);b.appendSpacingRow(h);b.appendSummaryRowTime(h,"Selection start",l);b.appendSummaryRowTime(h,"Selection extent",t-l)}if(1==c.length){var h=c[0],e=h.counter,y=h.sampleIndex,c=[];for(k=0;k<e.numSeries;++k)c.push(e.samples[e.numSeries*y+k]);h=b.appendTable("analysis-counter-table",
2);b.appendTableHeader(h,"Selected counter:");b.appendSummaryRow(h,"Title",e.name);b.appendSummaryRowTime(h,"Timestamp",e.timestamps[y]);for(k=0;k<e.numSeries;k++)b.appendSummaryRow(h,e.seriesNames[k],c[k])}else if(1<c.length){q={};for(k=0;k<c.length;k++)e=c[k].counter,q[e.guid]||(q[e.guid]=[]),q[e.guid].push(c[k]);h=b.appendTable("analysis-counter-table",7);b.appendTableHeader(h,"Counters:");for(y in q){c=q[y];e=c[0].counter;l=[];for(k=0;k<c.length;k++)l.push(c[k].sampleIndex);c=e.getSampleStatistics(l);
for(k=0;k<c.length;k++)b.appendDataRow(h,e.name+": "+e.seriesNames[k],void 0,void 0,c[k])}}}var c=tracing.ui.define("div");c.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){},appendElement_:function(b,a,e){a=b.ownerDocument.createElement(a);b.appendChild(a);void 0!=e&&(a.textContent=e);return a},appendText_:function(b,a){b.ownerDocument.createTextNode(a);b.appendChild(textNode);return textNode},appendTableCell_:function(b,a,e,c){a=this.appendElement_(a,"td",c);a.className=b.className+
"-col-"+e;return a},appendTableCellWithTooltip_:function(b,a,e,c,d){if(d)return a=this.appendElement_(a,"td"),a.className=b.className+"-col-"+e,b=this.appendElement_(a,"span",c),b.className="tooltip",b.title=d,a;this.appendTableCell_(b,a,e,c)},appendTable:function(b,a){var e=this.appendElement_(this,"table");e.className=b+" analysis-table";e.numColumns=a;return e},appendTableHeader:function(b,a){var e=this.appendElement_(b,"tr");this.appendElement_(e,"th",a).className="analysis-table-header"},appendSummaryRow:function(b,
a,e){var c=this.appendElement_(b,"tr");c.className="analysis-table-row";this.appendTableCell_(b,c,0,a);if(void 0!==e){if("{"==e[0]&&"}"==e[e.length-1]){var d;try{d=JSON.parse(e)}catch(h){d=void 0}void 0===!d?this.appendTableCell_(b,c,1,e):(a=JSON.stringify(d,null," "),this.appendTableCell_(b,c,1,a))}else this.appendTableCell_(b,c,1,e);for(a=2;a<b.numColumns;a++)this.appendTableCell_(b,c,a,"")}else for(a=1;a<b.numColumns;a++)this.appendTableCell_(b,c,1,"")},appendSpacingRow:function(b){var a=this.appendElement_(b,
"tr");a.className="analysis-table-row";for(var e=0;e<b.numColumns;e++)this.appendTableCell_(b,a,e," ")},appendSummaryRowTime:function(b,a,e){this.appendSummaryRow(b,a,tracing.analysis.tsRound(e)+" ms")},appendDataRow:function(b,a,e,c,d){var h=void 0;d&&(h="Min Duration:\t"+tracing.analysis.tsRound(d.min)+" ms \rMax Duration:\t"+tracing.analysis.tsRound(d.max)+" ms \rAvg Duration:\t"+tracing.analysis.tsRound(d.avg)+" ms (\u03c3 = "+tracing.analysis.tsRound(d.avg_stddev)+")",d.start&&(h+="\rStart Time:\t"+
tracing.analysis.tsRound(d.start)+" ms"),d.end&&(h+="\rEnd Time:\t"+tracing.analysis.tsRound(d.end)+" ms"),d.frequency&&d.frequency_stddev&&(h+="\rFrequency:\t"+tracing.analysis.tsRound(d.frequency)+" occurrences/s (\u03c3 = "+tracing.analysis.tsRound(d.frequency_stddev)+")"));d=this.appendElement_(b,"tr");d.className="analysis-table-row";this.appendTableCellWithTooltip_(b,d,0,a,h);void 0!==e?this.appendTableCellWithTooltip_(b,d,1,tracing.analysis.tsRound(e)+" ms",h):this.appendTableCell_(b,d,1,"");
void 0!==c?this.appendTableCellWithTooltip_(b,d,2,String(c)+" occurrences",h):this.appendTableCell_(b,d,2,"")}};var a=tracing.ui.define("div");a.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="analysis"},set selection(b){this.textContent="";var a=new c;d(a,b);this.appendChild(a)}};return{TimelineAnalysisView:a,analyzeSelection_:d}});base.requireStylesheet("overlay");base.require("ui");base.require("event_target");
base.exportTo("tracing.ui",function(){var d=tracing.ui.define("div");d.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(d,"visible",base.PropertyKind.BOOL_ATTR);var c=tracing.ui.define("div");c.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){if(!this.ownerDocument.querySelector(".overlay-root")){var a=this.ownerDocument.createElement("div");tracing.ui.decorate(a,d);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("filter");base.require("overlay");
base.exportTo("tracing",function(){var d=tracing.ui.define("div");d.prototype={__proto__:tracing.ui.Overlay.prototype,decorate:function(){tracing.ui.Overlay.prototype.decorate.call(this);this.className="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.categoriesEl_=document.createElement("div");this.categoriesEl_.className="categories";this.formEl_.appendChild(this.categoriesEl_);this.addEventListener("visibleChange",this.onVisibleChange_.bind(this));this.isCheckedCallback_=this.onChangeCallback_=void 0},set categories(c){this.categories_=c},set settings_key(c){this.settings_key_=c},set settings(c){this.settings_=c},set settingUpdatedCallback(c){this.settingUpdatedCallback_=c},selectedCategories:function(){for(var c=this.categoriesEl_.querySelectorAll("input"),
a=c.length,b=[],f=0;f<a;++f){var e=c[f];e.checked&&b.push(e.value)}return b},unselectedCategories:function(){for(var c=this.categoriesEl_.querySelectorAll("input"),a=c.length,b=[],f=0;f<a;++f){var e=c[f];e.checked||b.push(e.value)}return b},onVisibleChange_:function(){this.visible&&this.updateForm_()},updateForm_:function(){this.categoriesEl_.innerHTML="";for(var c={},a=this.categories_.concat(this.settings_.keys(this.settings_key_)),b=a.length,f=0;f<b;++f)c[a[f]]=!0;var a=[],e;for(e in c)a.push(e);
a=a.sort();for(f=0;f<a.length;f++)e=a[f],c=document.createElement("input"),c.type="checkbox",c.id=c.value=e,c.checked="true"===this.settings_.get(e,"true",this.settings_key_),c.onchange=this.updateSetting_.bind(this),b=document.createElement("label"),b.textContent=e,b.setAttribute("for",e),e=document.createElement("div"),e.appendChild(c),e.appendChild(b),this.categoriesEl_.appendChild(e)},updateSetting_:function(c){c=c.target;this.settings_.set(c.value,c.checked,this.settings_key_);void 0!==this.settingUpdatedCallback_&&
this.settingUpdatedCallback_()}};return{CategoryFilterDialog:d}});"use strict";base.require("timeline_track_view");base.require("filter");base.require("overlay");
base.exportTo("tracing",function(){function d(){this.model_=this.timeline_=void 0;this.filterText_="";this.filterHits_=new tracing.Selection;this.filterHitsDirty_=!0;this.currentHitIndex_=0}var c=tracing.ui.define("div");c.prototype={__proto__:tracing.ui.Overlay.prototype,decorate:function(){tracing.ui.Overlay.prototype.decorate.call(this);this.className="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="button find-previous";a.textContent="\u2190";a.addEventListener("click",function(){this.controller.findPrevious();this.updateHitCountEl_()}.bind(this));var b=document.createElement("div");b.className="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}}};d.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.TitleFilter(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.Selection:(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{FindControl:c,FindController:d}});base.require("model");base.require("color_scheme");
base.exportTo("tracing.importer",function(){function d(c,a){this.importPriority=1;this.model_=c;"string"===typeof a||a instanceof String?("["==a[0]&&(n=a.length,"\n"==a[n-1]&&(a=a.substring(0,n-1),n--,"\r"==a[n-1]&&(a=a.substring(0,n-1),n--)),","==a[n-1]&&(a=a.substring(0,n-1)),"]"!=a[n-1]&&(a+="]")),this.events_=JSON.parse(a)):this.events_=a;if(this.events_.traceEvents){var b=this.events_;this.events_=this.events_.traceEvents;for(fieldName in b)"traceEvents"!=fieldName&&this.model_.metadata.push({name:fieldName,
value:b[fieldName]})}this.allAsyncEvents_=[]}d.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};d.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 f=0;f<a.numSeries;f++)b=a.seriesNames[f],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 f=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid);f.isTimestampValidForBeginOrEnd(b.ts/1E3)?f.beginSlice(b.cat,b.name,b.ts/1E3,b.args):this.model_.importErrors.push("Timestamps are moving backward.")}else if("E"==b.ph)if(f=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),f.isTimestampValidForBeginOrEnd(b.ts/1E3))if(f.openSliceCount){var f=f.endSlice(b.ts/1E3),e;for(e in b.args)void 0!==
f.args[e]&&this.model_.importErrors.push("Both the B and E phases of "+f.name+"provided values for argument "+e+". The value of the E phase event will be used."),f.args[e]=b.args[e]}else this.model_.importErrors.push("E phase event without a matching B phase event.");else this.model_.importErrors.push("Timestamps are moving backward.");else"S"==b.ph?this.processAsyncEvent(a,b):"F"==b.ph?this.processAsyncEvent(a,b):"T"==b.ph?this.processAsyncEvent(a,b):"I"==b.ph||"i"==b.ph?(f=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),
f.beginSlice(b.cat,b.name,b.ts/1E3,b.args),f.endSlice(b.ts/1E3)):"P"==b.ph?(f=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),f.addSample(b.cat,b.name,b.ts/1E3,b.args)):"C"==b.ph?this.processCounterEvent(b):"M"==b.ph?"thread_name"==b.name?(f=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),f.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 f=a[b],e=f.event,d=e.name;if(void 0===d)this.model_.importErrors.push("Async events (ph: S, T or F) require an name parameter.");else{var j=e.id;if(void 0===j)this.model_.importErrors.push("Async events (ph: S, T or F) require an id parameter.");
else if("S"==e.ph)void 0===c[d]&&(c[d]={}),c[d][j]?this.model_.importErrors.push("At "+e.ts+", a slice of the same id "+j+" was alrady open."):(c[d][j]=[],c[d][j].push(f));else if(void 0===c[d])this.model_.importErrors.push("At "+e.ts+", no slice named "+d+" was open.");else if(void 0===c[d][j])this.model_.importErrors.push("At "+e.ts+", no slice named "+d+" with id="+j+" was open.");else{var h=c[d][j];h.push(f);if("F"==e.ph){var k=new tracing.model.AsyncSlice(h[0].event.cat,d,tracing.getStringColorId(d),
h[0].event.ts/1E3);k.duration=e.ts/1E3-h[0].event.ts/1E3;k.startThread=h[0].thread;k.endThread=f.thread;k.id=j;k.args=h[0].event.args;k.subSlices=[];for(f=1;f<h.length;++f){var l=d;"T"==h[f-1].event.ph&&(l=d+":"+h[f-1].event.args.step);l=new tracing.model.AsyncSlice(h[0].event.cat,l,tracing.getStringColorId(d+f),h[f-1].event.ts/1E3);l.duration=h[f].event.ts/1E3-h[f-1].event.ts/1E3;l.startThread=h[f-1].thread;l.endThread=h[f].thread;l.id=j;l.args=h[f-1].event.args;k.subSlices.push(l)}var h=k.subSlices[k.subSlices.length-
1],t;for(t in e.args)h.args[t]=e.args[t];k.startThread.asyncSlices.push(k);delete c[d][j]}}}}}}};tracing.Model.registerImporter(d);return{TraceEventImporter:d}});base.exportTo("tracing.importer.linux_perf",function(){function d(a){this.importer=a;this.model=a.model}var c=[];d.registerSubtype=function(a){c.push(a)};d.getSubtypeConstructors=function(){return c};d.prototype={__proto__:Object.prototype};return{Parser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("memory_bus_usage",d.prototype.traceMarkWriteBusEvent.bind(this));this.model_=a.model_;this.ppids_={}}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,traceMarkWriteBusEvent:function(a,b,f,e,c){c=/bus=(\S+) rw_bytes=(\d+) r_bytes=(\d+) w_bytes=(\d+) cycles=(\d+) ns=(\d+)/.exec(c.details);a=c[1];parseInt(c[2]);f=parseInt(c[3]);b=parseInt(c[4]);parseInt(c[5]);c=parseInt(c[6]);
f=1E9*f/c/1048576;b=1E9*b/c/1048576;c=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,"bus "+a+" read");0==c.numSeries&&(c.seriesNames.push("value"),c.seriesColors.push(tracing.getStringColorId(c.name+".value")));c.timestamps.push(e);c.samples.push(f);c=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,"bus "+a+" write");0==c.numSeries&&(c.seriesNames.push("value"),c.seriesColors.push(tracing.getStringColorId(c.name+".value")));c.timestamps.push(e);c.samples.push(b);return!0}};c.registerSubtype(d);
return{BusParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("clock_set_rate",d.prototype.traceMarkWriteClockEvent.bind(this));this.model_=a.model_;this.ppids_={}}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,traceMarkWriteClockEvent:function(a,b,f,e,c){b=/(\S+) state=(\d+) cpu_id=(\d+)/.exec(c.details);a=b[1];b=parseInt(b[2]);a=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,a);0==a.numSeries&&(a.seriesNames.push("value"),
a.seriesColors.push(tracing.getStringColorId(a.name+".value")));a.timestamps.push(e);a.samples.push(b);return!0}};c.registerSubtype(d);return{ClockParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(b){a.call(this,b);b.registerEventHandler("cpufreq_interactive_up",d.prototype.cpufreqUpDownEvent.bind(this));b.registerEventHandler("cpufreq_interactive_down",d.prototype.cpufreqUpDownEvent.bind(this));b.registerEventHandler("cpufreq_interactive_already",d.prototype.cpufreqTargetEvent.bind(this));b.registerEventHandler("cpufreq_interactive_notyet",d.prototype.cpufreqTargetEvent.bind(this));b.registerEventHandler("cpufreq_interactive_setspeed",
d.prototype.cpufreqTargetEvent.bind(this));b.registerEventHandler("cpufreq_interactive_target",d.prototype.cpufreqTargetEvent.bind(this));b.registerEventHandler("cpufreq_interactive_boost",d.prototype.cpufreqBoostUnboostEvent.bind(this));b.registerEventHandler("cpufreq_interactive_unboost",d.prototype.cpufreqBoostUnboostEvent.bind(this))}function c(a){var f={};a=a.split(/\s+/);for(var e=a.length,c=0;c<e;c++){var d=a[c].split("=");f[d[0]]=parseInt(d[1])}return f}var a=tracing.importer.linux_perf.Parser;
d.prototype={__proto__:a.prototype,cpufreqSlice:function(a,f,c,d){c=this.importer.getOrCreatePseudoThread("cpufreq");c.openSlice=f;a=new tracing.model.Slice("",c.openSlice,tracing.getStringColorId(c.openSlice),a,d,0);c.thread.pushSlice(a)},cpufreqBoostSlice:function(a,f,c){var d=this.importer.getOrCreatePseudoThread("cpufreq_boost");d.openSlice=f;a=new tracing.model.Slice("",d.openSlice,tracing.getStringColorId(d.openSlice),a,c,0);d.thread.pushSlice(a)},cpufreqUpDownEvent:function(a,f,e,d,j){f=c(j.details);
this.cpufreqSlice(d,a,f.cpu,f);return!0},cpufreqTargetEvent:function(a,f,e,d,j){f=c(j.details);this.cpufreqSlice(d,a,f.cpu,f);return!0},cpufreqBoostUnboostEvent:function(a,f,c,d,j){this.cpufreqBoostSlice(d,a,{type:j.details});return!0}};a.registerSubtype(d);return{CpufreqParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("ext4_sync_file_enter",d.prototype.ext4SyncFileEnterEvent.bind(this));a.registerEventHandler("ext4_sync_file_exit",d.prototype.ext4SyncFileExitEvent.bind(this));a.registerEventHandler("block_rq_issue",d.prototype.blockRqIssueEvent.bind(this));a.registerEventHandler("block_rq_complete",d.prototype.blockRqCompleteEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,
openAsyncSlice:function(a,b,f,c,d,j){f=this.importer.getOrCreateKernelThread(b+":"+f,c);a=new tracing.model.AsyncSlice(b,j,tracing.getStringColorId(j),a);a.startThread=f.thread;f.openAsyncSlices||(f.openAsyncSlices={});f.openAsyncSlices[d]=a},closeAsyncSlice:function(a,b,f,c,d,j){f=this.importer.getOrCreateKernelThread(b+":"+f,c);if(f.openAsyncSlices&&(c=f.openAsyncSlices[d]))c.duration=a-c.start,c.args=j,c.endThread=f.thread,c.subSlices=[new tracing.model.Slice(b,c.title,c.colorId,c.start,c.args,
c.duration)],f.thread.asyncSlices.push(c),delete f.openAsyncSlices[d]},ext4SyncFileEnterEvent:function(a,b,f,c,d){a=/dev (\d+,\d+) ino (\d+) parent (\d+) datasync (\d+)/.exec(d.details);if(!a)return!1;b=a[1];f=parseInt(a[2]);this.openAsyncSlice(c,"ext4",d.threadName,d.pid,b+"-"+f,1==a[4]?"fdatasync":"fsync");return!0},ext4SyncFileExitEvent:function(a,b,f,c,d){f=/dev (\d+,\d+) ino (\d+) ret (\d+)/.exec(d.details);if(!f)return!1;a=f[1];b=parseInt(f[2]);f=parseInt(f[3]);this.closeAsyncSlice(c,"ext4",
d.threadName,d.pid,a+"-"+b,{device:a,inode:b,error:f});return!0},blockRqIssueEvent:function(a,b,f,c,d){var j=/(\d+,\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? \d+ \(.*\) (\d+) \+ (\d+) \[.*\]/.exec(d.details);if(!j)return!1;switch(j[3]){case "D":a="discard";break;case "W":a="write";break;case "R":a="read";break;case "N":a="none";break;default:a="unknown"}j[2]&&(a+=" flush");"F"==j[4]&&(a+=" fua");"A"==j[5]&&(a+=" ahead");"S"==j[6]&&(a+=" sync");"M"==j[7]&&(a+=" meta");b=j[1];f=parseInt(j[8]);j=parseInt(j[9]);
this.openAsyncSlice(c,"block",d.threadName,d.pid,b+"-"+f+"-"+j,a);return!0},blockRqCompleteEvent:function(a,b,c,e,d){var j=/(\d+,\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? \(.*\) (\d+) \+ (\d+) \[(.*)\]/.exec(d.details);if(!j)return!1;a=j[1];b=parseInt(j[8]);c=parseInt(j[9]);j=parseInt(j[10]);this.closeAsyncSlice(e,"block",d.threadName,d.pid,a+"-"+b+"-"+c,{device:a,sector:b,numSectors:c,error:j});return!0}};c.registerSubtype(d);return{DiskParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("drm_vblank_event",d.prototype.vblankEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,drmVblankSlice:function(a,b,c){var e=this.importer.getOrCreatePseudoThread("drm_vblank");e.openSlice=b;a=new tracing.model.Slice("",e.openSlice,tracing.getStringColorId(e.openSlice),a,c,0);e.thread.pushSlice(a)},vblankEvent:function(a,b,c,e,d){b=/crtc=(\d+), seq=(\d+)/.exec(d.details);
if(!b)return!1;a=parseInt(b[1]);b=parseInt(b[2]);this.drmVblankSlice(e,"vblank:"+a,{crtc:a,seq:b});return!0}};c.registerSubtype(d);return{DrmParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("exynos_flip_request",d.prototype.flipEvent.bind(this));a.registerEventHandler("exynos_flip_complete",d.prototype.flipEvent.bind(this));a.registerEventHandler("exynos_busfreq_target_int",d.prototype.busfreqTargetIntEvent.bind(this));a.registerEventHandler("exynos_busfreq_target_mif",d.prototype.busfreqTargetMifEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,
exynosFlipOpenSlice:function(a,b){var c=this.importer.getOrCreatePseudoThread("exynos_flip");c.openSliceTS=a;c.openSlice="flip:"+b},exynosFlipCloseSlice:function(a,b){var c=this.importer.getOrCreatePseudoThread("exynos_flip");if(c.openSlice){var e=new tracing.model.Slice("",c.openSlice,tracing.getStringColorId(c.openSlice),c.openSliceTS,b,a-c.openSliceTS);c.thread.pushSlice(e)}c.openSlice=void 0},flipEvent:function(a,b,c,e,d){b=/pipe=(\d+)/.exec(d.details);if(!b)return!1;b=parseInt(b[1]);"exynos_flip_request"==
a?this.exynosFlipOpenSlice(e,b):this.exynosFlipCloseSlice(e,{pipe:b});return!0},exynosBusfreqSample:function(a,b,c){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(c)},busfreqTargetIntEvent:function(a,b,c,e,d){a=/frequency=(\d+)/.exec(d.details);if(!a)return!1;this.exynosBusfreqSample("INT Frequency",e,parseInt(a[1]));return!0},
busfreqTargetMifEvent:function(a,b,c,e,d){a=/frequency=(\d+)/.exec(d.details);if(!a)return!1;this.exynosBusfreqSample("MIF Frequency",e,parseInt(a[1]));return!0}};c.registerSubtype(d);return{ExynosParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("tracing_mark_write:log",d.prototype.logEvent.bind(this));a.registerEventHandler("tracing_mark_write:SyncInterpret",d.prototype.syncEvent.bind(this));a.registerEventHandler("tracing_mark_write:HandleTimer",d.prototype.timerEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,gestureOpenSlice:function(a,b,c){this.importer.getOrCreatePseudoThread("gesture").thread.beginSlice("touchpad_gesture",
a,b,c)},gestureCloseSlice:function(a,b){var c=this.importer.getOrCreatePseudoThread("gesture").thread;if(c.openSliceCount){var e=c.openPartialSlices_[c.openSliceCount-1];e.title!=a?this.importer.importError("Titles do not match. Title is "+e.title+" in openSlice, and is "+a+" in endSlice"):c.endSlice(b)}},logEvent:function(a,b,c,e,d){a=/^\s*(\w+):\s*(\w+)$/.exec(d.details);switch(a[1]){case "start":this.gestureOpenSlice("GestureLog",e,{name:a[2]});break;case "end":this.gestureCloseSlice("GestureLog",
e)}return!0},syncEvent:function(a,b,c,e,d){a=/^\s*(\w+):\s*(\w+)$/.exec(d.details);switch(a[1]){case "start":this.gestureOpenSlice("SyncInterpret",e,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("SyncInterpret",e)}return!0},timerEvent:function(a,b,c,e,d){a=/^\s*(\w+):\s*(\w+)$/.exec(d.details);switch(a[1]){case "start":this.gestureOpenSlice("HandleTimer",e,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("HandleTimer",e)}return!0}};c.registerSubtype(d);return{GestureParser:d}});
base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("i915_gem_object_create",d.prototype.gemObjectCreateEvent.bind(this));a.registerEventHandler("i915_gem_object_bind",d.prototype.gemObjectBindEvent.bind(this));a.registerEventHandler("i915_gem_object_unbind",d.prototype.gemObjectBindEvent.bind(this));a.registerEventHandler("i915_gem_object_change_domain",d.prototype.gemObjectChangeDomainEvent.bind(this));a.registerEventHandler("i915_gem_object_pread",
d.prototype.gemObjectPreadWriteEvent.bind(this));a.registerEventHandler("i915_gem_object_pwrite",d.prototype.gemObjectPreadWriteEvent.bind(this));a.registerEventHandler("i915_gem_object_fault",d.prototype.gemObjectFaultEvent.bind(this));a.registerEventHandler("i915_gem_object_clflush",d.prototype.gemObjectDestroyEvent.bind(this));a.registerEventHandler("i915_gem_object_destroy",d.prototype.gemObjectDestroyEvent.bind(this));a.registerEventHandler("i915_gem_ring_dispatch",d.prototype.gemRingDispatchEvent.bind(this));
a.registerEventHandler("i915_gem_ring_flush",d.prototype.gemRingFlushEvent.bind(this));a.registerEventHandler("i915_gem_request",d.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_add",d.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_complete",d.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_retire",d.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_wait_begin",d.prototype.gemRequestEvent.bind(this));
a.registerEventHandler("i915_gem_request_wait_end",d.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_ring_wait_begin",d.prototype.gemRingWaitEvent.bind(this));a.registerEventHandler("i915_gem_ring_wait_end",d.prototype.gemRingWaitEvent.bind(this));a.registerEventHandler("i915_reg_rw",d.prototype.regRWEvent.bind(this));a.registerEventHandler("i915_flip_request",d.prototype.flipEvent.bind(this));a.registerEventHandler("i915_flip_complete",d.prototype.flipEvent.bind(this))}var c=
tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,i915FlipOpenSlice:function(a,b,c){var e=this.importer.getOrCreatePseudoThread("i915_flip");e.openSliceTS=a;e.openSlice="flip:"+b+"/"+c},i915FlipCloseSlice:function(a,b){var c=this.importer.getOrCreatePseudoThread("i915_flip");if(c.openSlice){var e=new tracing.model.Slice("",c.openSlice,tracing.getStringColorId(c.openSlice),c.openSliceTS,b,a-c.openSliceTS);c.thread.pushSlice(e)}c.openSlice=void 0},i915GemObjectSlice:function(a,b,
c,e){var d=this.importer.getOrCreatePseudoThread("i915_gem");d.openSlice=b+":"+c;a=new tracing.model.Slice("",d.openSlice,tracing.getStringColorId(d.openSlice),a,e,0);d.thread.pushSlice(a)},i915GemRingSlice:function(a,b,c,e,d){var j=this.importer.getOrCreatePseudoThread("i915_gem_ring");j.openSlice=b+":"+c+"."+e;a=new tracing.model.Slice("",j.openSlice,tracing.getStringColorId(j.openSlice),a,d,0);j.thread.pushSlice(a)},i915RegSlice:function(a,b,c,e){var d=this.importer.getOrCreatePseudoThread("i915_reg");
d.openSlice=b+":"+c;a=new tracing.model.Slice("",d.openSlice,tracing.getStringColorId(d.openSlice),a,e,0);d.thread.pushSlice(a)},gemObjectCreateEvent:function(a,b,c,e,d){c=/obj=(\w+), size=(\d+)/.exec(d.details);if(!c)return!1;b=c[1];c=parseInt(c[2]);this.i915GemObjectSlice(e,a,b,{obj:b,size:c});return!0},gemObjectBindEvent:function(a,b,c,e,d){d=/obj=(\w+), offset=(\w+), size=(\d+)/.exec(d.details);if(!d)return!1;b=d[1];c=d[2];d=parseInt(d[3]);this.i915ObjectGemSlice(e,a+":"+b,{obj:b,offset:c,size:d});
return!0},gemObjectChangeDomainEvent:function(a,b,c,e,d){b=/obj=(\w+), read=(\w+=>\w+), write=(\w+=>\w+)/.exec(d.details);if(!b)return!1;c=b[1];this.i915GemObjectSlice(e,a,c,{obj:c,read:b[2],write:b[3]});return!0},gemObjectPreadWriteEvent:function(a,b,c,e,d){d=/obj=(\w+), offset=(\d+), len=(\d+)/.exec(d.details);if(!d)return!1;b=d[1];c=parseInt(d[2]);d=parseInt(d[3]);this.i915GemObjectSlice(e,a,b,{obj:b,offset:c,len:d});return!0},gemObjectFaultEvent:function(a,b,c,e,d){d=/obj=(\w+), (\w+) index=(\d+)/.exec(d.details);
if(!d)return!1;b=d[1];c=d[2];d=parseInt(d[3]);this.i915GemObjectSlice(e,a,b,{obj:b,type:c,index:d});return!0},gemObjectDestroyEvent:function(a,b,c,e,d){b=/obj=(\w+)/.exec(d.details);if(!b)return!1;b=b[1];this.i915GemObjectSlice(e,a,b,{obj:b});return!0},gemRingDispatchEvent:function(a,b,c,e,d){d=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(d.details);if(!d)return!1;b=parseInt(d[1]);c=parseInt(d[2]);d=parseInt(d[3]);this.i915GemRingSlice(e,a,b,c,{dev:b,ring:c,seqno:d});return!0},gemRingFlushEvent:function(a,
b,c,e,d){b=/dev=(\d+), ring=(\w+), invalidate=(\w+), flush=(\w+)/.exec(d.details);if(!b)return!1;c=parseInt(b[1]);d=parseInt(b[2]);this.i915GemRingSlice(e,a,c,d,{dev:c,ring:d,invalidate:b[3],flush:b[4]});return!0},gemRequestEvent:function(a,b,c,e,d){d=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(d.details);if(!d)return!1;b=parseInt(d[1]);c=parseInt(d[2]);d=parseInt(d[3]);this.i915GemRingSlice(e,a,b,c,{dev:b,ring:c,seqno:d});return!0},gemRingWaitEvent:function(a,b,c,e,d){c=/dev=(\d+), ring=(\d+)/.exec(d.details);
if(!c)return!1;b=parseInt(c[1]);c=parseInt(c[2]);this.i915GemRingSlice(e,a,b,c,{dev:b,ring:c});return!0},regRWEvent:function(a,b,c,e,d){a=/(\w+) reg=(\w+), len=(\d+), val=(\(\w+, \w+\))/.exec(d.details);if(!a)return!1;b=a[1];c=a[2];this.i915RegSlice(e,b,c,{rw:b,reg:c,len:a[3],data:a[3]});return!0},flipEvent:function(a,b,c,e,d){c=/plane=(\d+), obj=(\w+)/.exec(d.details);if(!c)return!1;b=parseInt(c[1]);c=c[2];"i915_flip_request"==a?this.i915FlipOpenSlice(e,c,b):this.i915FlipCloseSlice(e,{obj:c,plane:b});
return!0}};c.registerSubtype(d);return{I915Parser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("mali_dvfs_event",d.prototype.dvfsEventEvent.bind(this));a.registerEventHandler("mali_dvfs_set_clock",d.prototype.dvfsSetClockEvent.bind(this));a.registerEventHandler("mali_dvfs_set_voltage",d.prototype.dvfsSetVoltageEvent.bind(this));this.addJMCounter("mali_hwc_MESSAGES_SENT","Messages Sent");this.addJMCounter("mali_hwc_MESSAGES_RECEIVED","Messages Received");this.addJMCycles("mali_hwc_GPU_ACTIVE",
"GPU Active");this.addJMCycles("mali_hwc_IRQ_ACTIVE","IRQ Active");for(var b=0;7>b;b++){var f="JS"+b,e="mali_hwc_"+f;this.addJMCounter(e+"_JOBS",f+" Jobs");this.addJMCounter(e+"_TASKS",f+" Tasks");this.addJMCycles(e+"_ACTIVE",f+" Active");this.addJMCycles(e+"_WAIT_READ",f+" Wait Read");this.addJMCycles(e+"_WAIT_ISSUE",f+" Wait Issue");this.addJMCycles(e+"_WAIT_DEPEND",f+" Wait Depend");this.addJMCycles(e+"_WAIT_FINISH",f+" Wait Finish")}this.addTilerCounter("mali_hwc_TRIANGLES","Triangles");this.addTilerCounter("mali_hwc_QUADS",
"Quads");this.addTilerCounter("mali_hwc_POLYGONS","Polygons");this.addTilerCounter("mali_hwc_POINTS","Points");this.addTilerCounter("mali_hwc_LINES","Lines");this.addTilerCounter("mali_hwc_VCACHE_HIT","VCache Hit");this.addTilerCounter("mali_hwc_VCACHE_MISS","VCache Miss");this.addTilerCounter("mali_hwc_FRONT_FACING","Front Facing");this.addTilerCounter("mali_hwc_BACK_FACING","Back Facing");this.addTilerCounter("mali_hwc_PRIM_VISIBLE","Prim Visible");this.addTilerCounter("mali_hwc_PRIM_CULLED","Prim Culled");
this.addTilerCounter("mali_hwc_PRIM_CLIPPED","Prim Clipped");this.addTilerCounter("mali_hwc_WRBUF_HIT","Wrbuf Hit");this.addTilerCounter("mali_hwc_WRBUF_MISS","Wrbuf Miss");this.addTilerCounter("mali_hwc_WRBUF_LINE","Wrbuf Line");this.addTilerCounter("mali_hwc_WRBUF_PARTIAL","Wrbuf Partial");this.addTilerCounter("mali_hwc_WRBUF_STALL","Wrbuf Stall");this.addTilerCycles("mali_hwc_ACTIVE","Tiler Active");this.addTilerCycles("mali_hwc_INDEX_WAIT","Index Wait");this.addTilerCycles("mali_hwc_INDEX_RANGE_WAIT",
"Index Range Wait");this.addTilerCycles("mali_hwc_VERTEX_WAIT","Vertex Wait");this.addTilerCycles("mali_hwc_PCACHE_WAIT","Pcache Wait");this.addTilerCycles("mali_hwc_WRBUF_WAIT","Wrbuf Wait");this.addTilerCycles("mali_hwc_BUS_READ","Bus Read");this.addTilerCycles("mali_hwc_BUS_WRITE","Bus Write");this.addTilerCycles("mali_hwc_TILER_UTLB_STALL","Tiler UTLB Stall");this.addTilerCycles("mali_hwc_TILER_UTLB_HIT","Tiler UTLB Hit");this.addFragCycles("mali_hwc_FRAG_ACTIVE","Active");this.addFragCounter("mali_hwc_FRAG_PRIMATIVES",
"Primitives");this.addFragCounter("mali_hwc_FRAG_PRIMATIVES_DROPPED","Primitives Dropped");this.addFragCycles("mali_hwc_FRAG_CYCLE_DESC","Descriptor Processing");this.addFragCycles("mali_hwc_FRAG_CYCLES_PLR","PLR Processing??");this.addFragCycles("mali_hwc_FRAG_CYCLES_VERT","Vertex Processing");this.addFragCycles("mali_hwc_FRAG_CYCLES_TRISETUP","Triangle Setup");this.addFragCycles("mali_hwc_FRAG_CYCLES_RAST","Rasterization???");this.addFragCounter("mali_hwc_FRAG_THREADS","Threads");this.addFragCounter("mali_hwc_FRAG_DUMMY_THREADS",
"Dummy Threads");this.addFragCounter("mali_hwc_FRAG_QUADS_RAST","Quads Rast");this.addFragCounter("mali_hwc_FRAG_QUADS_EZS_TEST","Quads EZS Test");this.addFragCounter("mali_hwc_FRAG_QUADS_EZS_KILLED","Quads EZS Killed");this.addFragCounter("mali_hwc_FRAG_QUADS_LZS_TEST","Quads LZS Test");this.addFragCounter("mali_hwc_FRAG_QUADS_LZS_KILLED","Quads LZS Killed");this.addFragCycles("mali_hwc_FRAG_CYCLE_NO_TILE","No Tiles");this.addFragCounter("mali_hwc_FRAG_NUM_TILES","Tiles");this.addFragCounter("mali_hwc_FRAG_TRANS_ELIM",
"Transactions Eliminated");this.addComputeCycles("mali_hwc_COMPUTE_ACTIVE","Active");this.addComputeCounter("mali_hwc_COMPUTE_TASKS","Tasks");this.addComputeCounter("mali_hwc_COMPUTE_THREADS","Threads Started");this.addComputeCycles("mali_hwc_COMPUTE_CYCLES_DESC","Waiting for Descriptors");this.addTripipeCycles("mali_hwc_TRIPIPE_ACTIVE","Active");this.addArithCounter("mali_hwc_ARITH_WORDS","Instructions (/Pipes)");this.addArithCycles("mali_hwc_ARITH_CYCLES_REG","Reg scheduling stalls (/Pipes)");this.addArithCycles("mali_hwc_ARITH_CYCLES_L0",
"L0 cache miss stalls (/Pipes)");this.addArithCounter("mali_hwc_ARITH_FRAG_DEPEND","Frag dep check failures (/Pipes)");this.addLSCounter("mali_hwc_LS_WORDS","Instruction Words Completed");this.addLSCounter("mali_hwc_LS_ISSUES","Full Pipeline Issues");this.addLSCounter("mali_hwc_LS_RESTARTS","Restarts (unpairable insts)");this.addLSCounter("mali_hwc_LS_REISSUES_MISS","Pipeline reissue (cache miss/uTLB)");this.addLSCounter("mali_hwc_LS_REISSUES_VD","Pipeline reissue (varying data)");this.addLSCounter("mali_hwc_LS_REISSUE_ATTRIB_MISS",
"Pipeline reissue (attribute cache miss)");this.addLSCounter("mali_hwc_LS_REISSUE_NO_WB","Writeback not used");this.addTexCounter("mali_hwc_TEX_WORDS","Words");this.addTexCounter("mali_hwc_TEX_BUBBLES","Bubbles");this.addTexCounter("mali_hwc_TEX_WORDS_L0","Words L0");this.addTexCounter("mali_hwc_TEX_WORDS_DESC","Words Desc");this.addTexCounter("mali_hwc_TEX_THREADS","Threads");this.addTexCounter("mali_hwc_TEX_RECIRC_FMISS","Recirc due to Full Miss");this.addTexCounter("mali_hwc_TEX_RECIRC_DESC","Recirc due to Desc Miss");
this.addTexCounter("mali_hwc_TEX_RECIRC_MULTI","Recirc due to Multipass");this.addTexCounter("mali_hwc_TEX_RECIRC_PMISS","Recirc due to Partial Cache Miss");this.addTexCounter("mali_hwc_TEX_RECIRC_CONF","Recirc due to Cache Conflict");this.addLSCCounter("mali_hwc_LSC_READ_HITS","Read Hits");this.addLSCCounter("mali_hwc_LSC_READ_MISSES","Read Misses");this.addLSCCounter("mali_hwc_LSC_WRITE_HITS","Write Hits");this.addLSCCounter("mali_hwc_LSC_WRITE_MISSES","Write Misses");this.addLSCCounter("mali_hwc_LSC_ATOMIC_HITS",
"Atomic Hits");this.addLSCCounter("mali_hwc_LSC_ATOMIC_MISSES","Atomic Misses");this.addLSCCounter("mali_hwc_LSC_LINE_FETCHES","Line Fetches");this.addLSCCounter("mali_hwc_LSC_DIRTY_LINE","Dirty Lines");this.addLSCCounter("mali_hwc_LSC_SNOOPS","Snoops");this.addAXICounter("mali_hwc_AXI_TLB_STALL","Address channel stall");this.addAXICounter("mali_hwc_AXI_TLB_MISS","Cache Miss");this.addAXICounter("mali_hwc_AXI_TLB_TRANSACTION","Transactions");this.addAXICounter("mali_hwc_LS_TLB_MISS","LS Cache Miss");
this.addAXICounter("mali_hwc_LS_TLB_HIT","LS Cache Hit");this.addAXICounter("mali_hwc_AXI_BEATS_READ","Read Beats");this.addAXICounter("mali_hwc_AXI_BEATS_WRITE","Write Beats");this.addMMUCounter("mali_hwc_MMU_TABLE_WALK","Page Table Walks");this.addMMUCounter("mali_hwc_MMU_REPLAY_MISS","Cache Miss from Replay Buffer");this.addMMUCounter("mali_hwc_MMU_REPLAY_FULL","Replay Buffer Full");this.addMMUCounter("mali_hwc_MMU_NEW_MISS","Cache Miss on New Request");this.addMMUCounter("mali_hwc_MMU_HIT","Cache Hit");
this.addMMUCycles("mali_hwc_UTLB_STALL","UTLB Stalled");this.addMMUCycles("mali_hwc_UTLB_REPLAY_MISS","UTLB Replay Miss");this.addMMUCycles("mali_hwc_UTLB_REPLAY_FULL","UTLB Replay Full");this.addMMUCycles("mali_hwc_UTLB_NEW_MISS","UTLB New Miss");this.addMMUCycles("mali_hwc_UTLB_HIT","UTLB Hit");this.addL2Counter("mali_hwc_L2_READ_BEATS","Read Beats");this.addL2Counter("mali_hwc_L2_WRITE_BEATS","Write Beats");this.addL2Counter("mali_hwc_L2_ANY_LOOKUP","Any Lookup");this.addL2Counter("mali_hwc_L2_READ_LOOKUP",
"Read Lookup");this.addL2Counter("mali_hwc_L2_SREAD_LOOKUP","Shareable Read Lookup");this.addL2Counter("mali_hwc_L2_READ_REPLAY","Read Replayed");this.addL2Counter("mali_hwc_L2_READ_SNOOP","Read Snoop");this.addL2Counter("mali_hwc_L2_READ_HIT","Read Cache Hit");this.addL2Counter("mali_hwc_L2_CLEAN_MISS","CleanUnique Miss");this.addL2Counter("mali_hwc_L2_WRITE_LOOKUP","Write Lookup");this.addL2Counter("mali_hwc_L2_SWRITE_LOOKUP","Shareable Write Lookup");this.addL2Counter("mali_hwc_L2_WRITE_REPLAY",
"Write Replayed");this.addL2Counter("mali_hwc_L2_WRITE_SNOOP","Write Snoop");this.addL2Counter("mali_hwc_L2_WRITE_HIT","Write Cache Hit");this.addL2Counter("mali_hwc_L2_EXT_READ_FULL","ExtRD with BIU Full");this.addL2Counter("mali_hwc_L2_EXT_READ_HALF","ExtRD with BIU >1/2 Full");this.addL2Counter("mali_hwc_L2_EXT_WRITE_FULL","ExtWR with BIU Full");this.addL2Counter("mali_hwc_L2_EXT_WRITE_HALF","ExtWR with BIU >1/2 Full");this.addL2Counter("mali_hwc_L2_EXT_READ","External Read (ExtRD)");this.addL2Counter("mali_hwc_L2_EXT_READ_LINE",
"ExtRD (linefill)");this.addL2Counter("mali_hwc_L2_EXT_WRITE","External Write (ExtWR)");this.addL2Counter("mali_hwc_L2_EXT_WRITE_LINE","ExtWR (linefill)");this.addL2Counter("mali_hwc_L2_EXT_WRITE_SMALL","ExtWR (burst size <64B)");this.addL2Counter("mali_hwc_L2_EXT_BARRIER","External Barrier");this.addL2Counter("mali_hwc_L2_EXT_AR_STALL","Address Read stalls");this.addL2Counter("mali_hwc_L2_EXT_R_BUF_FULL","Response Buffer full stalls");this.addL2Counter("mali_hwc_L2_EXT_RD_BUF_FULL","Read Data Buffer full stalls");
this.addL2Counter("mali_hwc_L2_EXT_R_RAW","RAW hazard stalls");this.addL2Counter("mali_hwc_L2_EXT_W_STALL","Write Data stalls");this.addL2Counter("mali_hwc_L2_EXT_W_BUF_FULL","Write Data Buffer full");this.addL2Counter("mali_hwc_L2_EXT_R_W_HAZARD","WAW or WAR hazard stalls");this.addL2Counter("mali_hwc_L2_TAG_HAZARD","Tag hazard replays");this.addL2Cycles("mali_hwc_L2_SNOOP_FULL","Snoop buffer full");this.addL2Cycles("mali_hwc_L2_REPLAY_FULL","Replay buffer full");a.registerEventHandler("tracing_mark_write:mali_driver",
d.prototype.maliDDKEvent.bind(this));this.model_=a.model_}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,maliDDKOpenSlice:function(a,b,c,e,d){a=this.importer.model_.getOrCreateProcess(a).getOrCreateThread(b);e=/^([\w\d_]*)(?:\(\))?:?\s*(.*)$/.exec(e);a.beginSlice("gpu-driver",e[1],c,{args:e[2],blockinfo:d})},maliDDKCloseSlice:function(a,b,c){a=this.importer.model_.getOrCreateProcess(a).getOrCreateThread(b);a.openSliceCount&&a.endSlice(c)},autoDetectLineRE:function(a){var b=
/^\s*\(([\w\-]*)\)\s*(\w+):\s*([\w\\\/\.\-]*@\d*):?\s*(.*)$/;if(b.test(a))return b;b=/^s*()(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/;return b.test(a)?b:null},lineRE:null,maliDDKEvent:function(a,b,c,e,d){if(null==this.lineRE&&(this.lineRE=this.autoDetectLineRE(d.details),null==this.lineRE))return!1;a=this.lineRE.exec(d.details);b=""===a[1]?"mali":a[1];switch(a[2]){case "cros_trace_print_enter":this.maliDDKOpenSlice(c,b,e,a[4],a[3]);break;case "cros_trace_print_exit":this.maliDDKCloseSlice(c,b,e,[],a[3])}return!0},
dvfsSample:function(a,b,c,e){e=parseInt(e);a=this.model_.getOrCreateProcess(0).getOrCreateCounter("DVFS",a);0==a.numSeries&&(a.seriesNames.push(b),a.seriesColors.push(tracing.getStringColorId(a.name)));a.timestamps.push(c);a.samples.push(e)},dvfsEventEvent:function(a,b,c,e,d){a=/utilization=(\d+)/.exec(d.details);if(!a)return!1;this.dvfsSample("DVFS Utilization","utilization",e,a[1]);return!0},dvfsSetClockEvent:function(a,b,c,e,d){a=/frequency=(\d+)/.exec(d.details);if(!a)return!1;this.dvfsSample("DVFS Frequency",
"frequency",e,a[1]);return!0},dvfsSetVoltageEvent:function(a,b,c,e,d){a=/voltage=(\d+)/.exec(d.details);if(!a)return!1;this.dvfsSample("DVFS Voltage","voltage",e,a[1]);return!0},hwcSample:function(a,b,c,e,d){d=/val=(\d+)/.exec(d.details);if(!d)return!1;d=parseInt(d[1]);a=this.model_.getOrCreateProcess(0).getOrCreateCounter(a,b);0==a.numSeries&&(a.seriesNames.push(c),a.seriesColors.push(tracing.getStringColorId(a.name)));a.timestamps.push(e);a.samples.push(d);return!0},jmSample:function(a,b,c,e){return this.hwcSample("mali:jm",
"JM: "+a,b,c,e)},addJMCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.jmSample(b,"count",j,h)}.bind(this))},addJMCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.jmSample(b,"cycles",j,h)}.bind(this))},tilerSample:function(a,b,c,e){return this.hwcSample("mali:tiler","Tiler: "+a,b,c,e)},addTilerCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.tilerSample(b,"count",j,h)}.bind(this))},
addTilerCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.tilerSample(b,"cycles",j,h)}.bind(this))},fragSample:function(a,b,c,e){return this.hwcSample("mali:fragment","Fragment: "+a,b,c,e)},addFragCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.fragSample(b,"count",j,h)}.bind(this))},addFragCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.fragSample(b,"cycles",j,h)}.bind(this))},
computeSample:function(a,b,c,e){return this.hwcSample("mali:compute","Compute: "+a,b,c,e)},addComputeCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.computeSample(b,"count",j,h)}.bind(this))},addComputeCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.computeSample(b,"cycles",j,h)}.bind(this))},addTripipeCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.hwcSample("mali:shader",
"Tripipe: "+b,"cycles",j,h)}.bind(this))},arithSample:function(a,b,c,e){return this.hwcSample("mali:arith","Arith: "+a,b,c,e)},addArithCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.arithSample(b,"count",j,h)}.bind(this))},addArithCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.arithSample(b,"cycles",j,h)}.bind(this))},addLSCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.hwcSample("mali:ls",
"LS: "+b,"count",j,h)}.bind(this))},textureSample:function(a,b,c,e){return this.hwcSample("mali:texture","Texture: "+a,b,c,e)},addTexCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.textureSample(b,"count",j,h)}.bind(this))},addLSCCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.hwcSample("mali:lsc","LSC: "+b,"count",j,h)}.bind(this))},addAXICounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,
j,h){return this.hwcSample("mali:axi","AXI: "+b,"count",j,h)}.bind(this))},mmuSample:function(a,b,c,e){return this.hwcSample("mali:mmu","MMU: "+a,b,c,e)},addMMUCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.mmuSample(b,"count",j,h)}.bind(this))},addMMUCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.mmuSample(b,"cycles",j,h)}.bind(this))},l2Sample:function(a,b,c,e){return this.hwcSample("mali:l2","L2: "+a,b,c,e)},
addL2Counter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.l2Sample(b,"count",j,h)}.bind(this))},addL2Cycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.l2Sample(b,"cycles",j,h)}.bind(this))}};c.registerSubtype(d);return{MaliParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("power_start",d.prototype.powerStartEvent.bind(this));a.registerEventHandler("power_frequency",d.prototype.powerFrequencyEvent.bind(this));a.registerEventHandler("cpu_frequency",d.prototype.cpuFrequencyEvent.bind(this));a.registerEventHandler("cpu_idle",d.prototype.cpuIdleEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,cpuStateSlice:function(a,b,
c,e){b=this.importer.getOrCreateCpuState(b);"1"!=c?this.importer.importError("Don't understand power_start events of type "+c):(c=b.cpu.getOrCreateCounter("","C-State"),0==c.numSeries&&(c.seriesNames.push("state"),c.seriesColors.push(tracing.getStringColorId(c.name+".state"))),c.timestamps.push(a),c.samples.push(e))},cpuIdleSlice:function(a,b,c){b=this.importer.getOrCreateCpuState(b).cpu.getOrCreateCounter("","C-State");0==b.numSeries&&(b.seriesNames.push("state"),b.seriesColors.push(tracing.getStringColorId(b.name)));
4294967295!=c?b.samples.push(c):b.samples.push(0);b.timestamps.push(a)},cpuFrequencySlice:function(a,b,c){b=this.importer.getOrCreateCpuState(b).cpu.getOrCreateCounter("","Clock Frequency");0==b.numSeries&&(b.seriesNames.push("state"),b.seriesColors.push(tracing.getStringColorId(b.name+".state")));b.timestamps.push(a);b.samples.push(c)},powerStartEvent:function(a,b,c,e,d){a=/type=(\d+) state=(\d) cpu_id=(\d)+/.exec(d.details);if(!a)return!1;b=parseInt(a[3]);c=parseInt(a[2]);this.cpuStateSlice(e,b,
a[1],c);return!0},powerFrequencyEvent:function(a,b,c,e,d){b=/type=(\d+) state=(\d+) cpu_id=(\d)+/.exec(d.details);if(!b)return!1;a=parseInt(b[3]);b=parseInt(b[2]);this.cpuFrequencySlice(e,a,b);return!0},cpuFrequencyEvent:function(a,b,c,e,d){b=/state=(\d+) cpu_id=(\d)+/.exec(d.details);if(!b)return!1;a=parseInt(b[2]);b=parseInt(b[1]);this.cpuFrequencySlice(e,a,b);return!0},cpuIdleEvent:function(a,b,c,e,d){b=/state=(\d+) cpu_id=(\d)+/.exec(d.details);if(!b)return!1;a=parseInt(b[2]);b=parseInt(b[1]);
this.cpuIdleSlice(e,a,b);return!0}};c.registerSubtype(d);return{PowerParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("sched_switch",d.prototype.schedSwitchEvent.bind(this));a.registerEventHandler("sched_wakeup",d.prototype.schedWakeupEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;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;d.prototype={__proto__:c.prototype,schedSwitchEvent:function(b,c,d,j,h){var k=a.exec(h.details);if(!k)return!1;b=k[4];d=k[5];h=parseInt(k[6]);k=parseInt(k[7]);this.importer.getOrCreateCpuState(c).switchRunningLinuxPid(this.importer,b,j,h,d,k);return!0},schedWakeupEvent:function(a,c,d,j,h){h=b.exec(h.details);if(!h)return!1;a=d;c=h[1];d=parseInt(h[2]);h=parseInt(h[3]);this.importer.markPidRunnable(j,d,c,h,a);return!0}};c.registerSubtype(d);return{SchedParser:d,_SchedParserTestExports:TestExports}});
base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("workqueue_execute_start",d.prototype.executeStartEvent.bind(this));a.registerEventHandler("workqueue_execute_end",d.prototype.executeEndEvent.bind(this));a.registerEventHandler("workqueue_queue_work",d.prototype.executeQueueWork.bind(this));a.registerEventHandler("workqueue_activate_work",d.prototype.executeActivateWork.bind(this))}var c=tracing.importer.linux_perf.Parser,a=/work struct (.+): function (\S+)/,
b=/work struct (.+)/;d.prototype={__proto__:c.prototype,executeStartEvent:function(b,c,d,j,h){b=a.exec(h.details);if(!b)return!1;d=this.importer.getOrCreateKernelThread(h.threadName,d,d);d.openSliceTS=j;d.openSlice=b[2];return!0},executeEndEvent:function(a,c,d,j,h){if(!b.exec(h.details))return!1;a=this.importer.getOrCreateKernelThread(h.threadName,d,d);a.openSlice&&(j=new tracing.model.Slice("",a.openSlice,tracing.getStringColorId(a.openSlice),a.openSliceTS,{},j-a.openSliceTS),a.thread.pushSlice(j));
a.openSlice=void 0;return!0},executeQueueWork:function(){return!0},executeActivateWork:function(){return!0}};c.registerSubtype(d);return{WorkqueueParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(b){a.call(this,b);b.registerEventHandler("tracing_mark_write:android",d.prototype.traceMarkWriteAndroidEvent.bind(this));b.registerEventHandler("0:android",d.prototype.traceMarkWriteAndroidEvent.bind(this));this.model_=b.model_;this.ppids_={}}function c(a){var c={};if(a){a=a.split(";");for(var e=0;e<a.length;++e){var d=a[e].split("=");d[0]&&(c[d.shift()]=d.join("="))}}return c}var a=tracing.importer.linux_perf.Parser;d.prototype={__proto__:a.prototype,
traceMarkWriteAndroidEvent:function(a,d,e,g,j){a=j.details.split("|");switch(a[0]){case "B":d=parseInt(a[1]);var h=a[4],k=a[2],l=this.model_.getOrCreateProcess(d).getOrCreateThread(e);l.name=j.threadName;if(!l.isTimestampValidForBeginOrEnd(g))return this.model_.importErrors.push("Timestamps are moving backward."),!1;this.ppids_[e]=d;l.beginSlice(h,k,g,c(a[3]));break;case "E":d=this.ppids_[e];if(void 0===d)break;l=this.model_.getOrCreateProcess(d).getOrCreateThread(e);if(!l.openSliceCount)break;g=
l.endSlice(g);a=c(a[3]);for(h in a)void 0!==g.args[h]&&this.model_.importErrors.push("Both the B and E events of "+g.title+"provided values for argument "+h+". The value of the E event will be used."),g.args[h]=a[h];break;case "C":d=parseInt(a[1]);j=a[2];e=parseInt(a[3]);h=a[4];a=this.model_.getOrCreateProcess(d).getOrCreateCounter(h,j);0==a.numSeries&&(a.seriesNames.push("value"),a.seriesColors.push(tracing.getStringColorId(a.name+".value")));a.timestamps.push(g);a.samples.push(e);break;default:return!1}return!0}};
a.registerSubtype(d);return{AndroidParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("graph_ent",d.prototype.traceKernelFuncEnterEvent.bind(this));a.registerEventHandler("graph_ret",d.prototype.traceKernelFuncReturnEvent.bind(this));this.model_=a.model_;this.ppids_={}}var c=tracing.importer.linux_perf.Parser;TestExports={};var a=/func=(.+)/;TestExports.funcEnterRE=a;d.prototype={__proto__:c.prototype,traceKernelFuncEnterEvent:function(b,c,e,d,j){b=a.exec(j.details);if(!b||void 0===
j.tgid)return!1;c=parseInt(j.tgid);b=b[1];e=this.model_.getOrCreateProcess(c).getOrCreateThread(e);e.name=j.threadName;j=e.kernelSlices;if(!j.isTimestampValidForBeginOrEnd(d))return this.model_.importErrors.push("Timestamps are moving backward."),!1;slice=j.beginSlice(null,b,d,{});return!0},traceKernelFuncReturnEvent:function(a,c,e,d,j){if(void 0===j.tgid)return!1;a=parseInt(j.tgid);e=this.model_.getOrCreateProcess(a).getOrCreateThread(e);e.name=j.threadName;j=e.kernelSlices;if(!j.isTimestampValidForBeginOrEnd(d))return this.model_.importErrors.push("Timestamps are moving backward."),
!1;0<j.openSliceCount&&j.endSlice(d);return!0}};c.registerSubtype(d);return{KernelFuncParser:d}});"use strict";base.require("model");base.require("color_scheme");base.require("importer.linux_perf.bus_parser");base.require("importer.linux_perf.clock_parser");base.require("importer.linux_perf.cpufreq_parser");base.require("importer.linux_perf.disk_parser");base.require("importer.linux_perf.drm_parser");base.require("importer.linux_perf.exynos_parser");base.require("importer.linux_perf.gesture_parser");
base.require("importer.linux_perf.i915_parser");base.require("importer.linux_perf.mali_parser");base.require("importer.linux_perf.power_parser");base.require("importer.linux_perf.sched_parser");base.require("importer.linux_perf.workqueue_parser");base.require("importer.linux_perf.android_parser");base.require("importer.linux_perf.kfunc_parser");
base.exportTo("tracing.importer",function(){function d(a){this.cpu=a}function c(a,b){this.importPriority=2;this.model_=a;this.events_=b;this.clockSyncRecords_=[];this.cpuStates_={};this.wakeups_=[];this.kernelThreadStates_={};this.buildMapFromLinuxPidsToThreads();this.lineNumberBase=0;this.lineNumber=-1;this.pseudoThreadCounter=1;this.parsers_=[];this.eventHandlers_={}}function a(a){return b.test(a)?f:e.test(a)?g:j.test(a)?h:null}d.prototype={__proto__:Object.prototype,switchRunningLinuxPid:function(a,
b,c,e,d,f){if(void 0!==this.lastActivePid&&0!=this.lastActivePid){var g=c-this.lastActiveTs;a=(a=a.threadsByLinuxPid[this.lastActivePid])?a.userFriendlyName:this.lastActiveComm;b=new tracing.model.Slice("",a,tracing.getStringColorId(a),this.lastActiveTs,{comm:this.lastActiveComm,tid:this.lastActivePid,prio:this.lastActivePrio,stateWhenDescheduled:b},g);this.cpu.slices.push(b)}this.lastActiveTs=c;this.lastActivePid=e;this.lastActiveComm=d;this.lastActivePrio=f}};TestExports={};var b=RegExp("^\\s*(.+)-(\\d+)\\s+\\(\\s*(\\d+|-+)\\)\\s\\[(\\d+)\\]\\s+[dX.][N.][Hhs.][0-9a-f.]\\s+(\\d+\\.\\d+):\\s+(\\S+):\\s(.*)$"),
f=function(a){a=b.exec(a);if(!a)return a;var c=a[3];"-"===c[0]&&(c=void 0);return{threadName:a[1],pid:a[2],tgid:c,cpuNumber:a[4],timestamp:a[5],eventName:a[6],details:a[7]}};TestExports.lineParserWithTGID=f;var e=/^\s*(.+)-(\d+)\s+\[(\d+)\]\s+[dX.][N.][Hhs.][0-9a-f.]\s+(\d+\.\d+):\s+(\S+):\s(.*)$/,g=function(a){a=e.exec(a);return!a?a:{threadName:a[1],pid:a[2],cpuNumber:a[3],timestamp:a[4],eventName:a[5],details:a[6]}};TestExports.lineParserWithIRQInfo=g;var j=/^\s*(.+)-(\d+)\s+\[(\d+)\]\s*(\d+\.\d+):\s+(\S+):\s(.*)$/,
h=function(a){a=j.exec(a);return!a?a:{threadName:a[1],pid:a[2],cpuNumber:a[3],timestamp:a[4],eventName:a[5],details:a[6]}};TestExports.lineParserWithLegacyFmt=h;TestExports.traceEventClockSyncRE=/trace_event_clock_sync: parent_ts=(\d+\.?\d*)/;TestExports.autoDetectLineParser=a;c.canImport=function(b){if(!("string"===typeof b||b instanceof String))return!1;if(c._extractEventsFromSystraceHTML(b,!1).ok||/^# tracer:/.test(b))return!0;var e=/^(.+)\n/.exec(b);e&&(b=e[1]);return a(b)?!0:!1};c._extractEventsFromSystraceHTML=
function(a,b){function c(a){for(;g<f.length;g++)if(a.test(f[g]))return!0;return!1}function e(a,b){return-1===a.indexOf(b,a.length-b.length)?a:a.substring(a,a.length-b.length)}var d={ok:!1};void 0===b&&(b=!0);if(!1==/^<!DOCTYPE HTML>/.test(a))return d;var f=a.split("\n"),g=1;if(!c(/^  <script>$/)||!c(/^  var linuxPerfData = "\\$/))return d;var h=g+1;if(!c(/^  <\/script>$/))return d;var j=g;if(!c(/^<\/body>$/)||!c(/^<\/html>$/))return d;var w=f.slice(h,j),j=[];if(b)for(var v=0;v<w.length;v++){var x=
w[v],x=e(x,"\\n\\");j.push(x)}else j=[w[w.length-1]];w=j[j.length-1];v=e(w,'\\n";');if(v==w)return d;j[j.length-1]=v;return{ok:!0,lines:b?j:void 0,events_begin_at_line:h}};c.prototype={__proto__:Object.prototype,get model(){return this.model_},buildMapFromLinuxPidsToThreads: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 d(b)}return this.cpuStates_[a]},getOrCreateKernelThread:function(a,b,c){this.kernelThreadStates_[a]||(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.buildMapFromLinuxPidsToThreads(),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 e=b.slices[c],d=this.threadsByLinuxPid[e.args.tid];d&&(d.tempCpuSlices||(d.tempCpuSlices=[]),d.tempCpuSlices.push(e))}for(c in this.wakeups_)if(a=this.wakeups_[c],d=this.threadsByLinuxPid[a.tid])d.tempWakeups=
d.tempWakeups||[],d.tempWakeups.push(a);var f=tracing.getColorIdByName("running"),g=tracing.getColorIdByName("runnable"),h=tracing.getColorIdByName("sleeping"),j=tracing.getColorIdByName("iowait");this.model_.getAllThreads().forEach(function(a){if(void 0!==a.tempCpuSlices){var b=a.tempCpuSlices;delete a.tempCpuSlices;b.sort(function(a,b){return a.start-b.start});var c=a.tempWakeups||[];delete a.tempWakeups;c.sort(function(a,b){return a.ts-b.ts});var d=[];if(b.length){var e=b[0];if(c.length&&c[0].ts<
e.start){var k=c.shift();d.push(new tracing.model.Slice("","Runnable",g,k.ts,{"wakeup from tid":k.fromTid},e.start-k.ts))}d.push(new tracing.model.Slice("","Running",f,e.start,{},e.duration))}k=void 0;for(e=1;e<b.length;e++){for(var l=b[e-1],m=b[e],q=m.start-l.end;c.length&&c[0].ts<m.start;){var t=c.shift();void 0===k&&t.ts>l.end&&(k=t)}t=function(a,b){void 0!==k&&(q=k.ts-l.end);d.push(new tracing.model.Slice("",a,b,l.end,{},q));void 0!==k&&(d.push(new tracing.model.Slice("","Runnable",g,k.ts,{"wakeup from tid":k.fromTid},
m.start-k.ts)),k=void 0)};if("S"==l.args.stateWhenDescheduled)t("Sleeping",h);else if("R"==l.args.stateWhenDescheduled||"R+"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","Runnable",g,l.end,{},q));else if("D"==l.args.stateWhenDescheduled)t("Uninterruptible Sleep",j);else if("T"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","__TASK_STOPPED",j,l.end,{},q));else if("t"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","debug",j,l.end,{},q));else if("Z"==
l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","Zombie",j,l.end,{},q));else if("X"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","Exit Dead",j,l.end,{},q));else if("x"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","Task Dead",j,l.end,{},q));else if("W"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","WakeKill",j,l.end,{},q));else if("D|W"==l.args.stateWhenDescheduled)t("Uninterruptable Sleep | WakeKill",j);else throw Error("Unrecognized state: ")+
l.args.stateWhenDescheduled;d.push(new tracing.model.Slice("","Running",f,m.start,{},m.duration))}a.cpuSlices=d}})},alignClocks:function(a){if(0==this.clockSyncRecords_.length){if(!a)return!0;this.abortImport();return!1}a=this.clockSyncRecords_[0];if(0==a.parentTS||a.parentTS==a.perfTS)return!0;a=a.parentTS-a.perfTS;for(var b in this.cpuStates_){for(var c=this.cpuStates_[b].cpu,d=0;d<c.slices.length;d++){var e=c.slices[d];e.start+=a;e.duration=e.duration}for(var f in c.counters){d=c.counters[f];for(e=
0;e<d.timestamps.length;e++)d.timestamps[e]+=a}}for(var g in this.kernelThreadStates_)this.kernelThreadStates_[g].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.importer.linux_perf.Parser.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(a,b,c,d,e){this.wakeups_.push({ts:a,tid:b,fromTid:e})},importError:function(a){this.model_.importErrors.push("Line "+(this.lineNumberBase+this.lineNumber+1)+": "+a)},traceClockSyncEvent:function(a,b,c,d,e){a=/parent_ts=(\d+\.?\d*)/.exec(e.details);if(!a)return!1;this.clockSyncRecords_.push({perfTS:d,parentTS:1E3*a[1]});return!0},traceMarkingWriteEvent:function(a,b,c,d,e,f){var g=/^\s*(\w+):\s*(.*)$/.exec(e.details);
if(g)e.subEventName=g[1],e.details=g[2];else if(g=e.details.substring(0,2),"B|"==g||"E"==g||"E|"==g||"C|"==g)e.subEventName="android";else return!1;a=a+":"+e.subEventName;g=this.eventHandlers_[a];return!g?(this.importError("Unknown trace_marking_write event "+a),!0):g(a,b,c,d,e,f)},importCpuData:function(){var b=c._extractEventsFromSystraceHTML(this.events_,!0);b.ok?(this.lineNumberBase=b.events_begin_at_line,this.lines_=b.lines):(this.lineNumberBase=0,this.lines_=this.events_.split("\n"));b=null;
for(this.lineNumber=0;this.lineNumber<this.lines_.length;++this.lineNumber){var e=this.lines_[this.lineNumber];if(!(0==e.length||/^#/.test(e))){if(null==b&&(b=a(e),null==b)){this.importError("Cannot parse line: "+e);continue}var d=b(e);if(d){var f=parseInt(d.pid),g=parseInt(d.cpuNumber),h=1E3*parseFloat(d.timestamp),j=d.eventName,u=this.eventHandlers_[j];u?u(j,g,f,h,d)||this.importError("Malformed "+j+" event ("+e+")"):this.importError("Unknown event "+j+" ("+e+")")}else this.importError("Unrecognized line: "+
e)}}}};tracing.Model.registerImporter(c);return{LinuxPerfImporter:c,_LinuxPerfImporterTestExports:TestExports}});
base.exportTo("tracing.importer.v8",function(){function d(){}function c(a){this.dispatchTable_=a;this.lineNum_=0;this.csvParser_=new d}d.CSV_FIELD_RE_=/^"((?:[^"]|"")*)"|([^,]*)/;d.DOUBLE_QUOTE_RE_=/""/g;d.prototype.parseLine=function(a){var b=d.CSV_FIELD_RE_,c=d.DOUBLE_QUOTE_RE_,e=0,g=a.length,j=[];if(0<g){do{var h=b.exec(a.substr(e));"string"===typeof h[1]?(h=h[1],e+=h.length+3,j.push(h.replace(c,'"'))):(h=h[2],e+=h.length+1,j.push(h))}while(e<=g)}return j};c.prototype.printError=function(){};c.prototype.processLogChunk=
function(a){this.processLog_(a.split("\n"))};c.prototype.processLogLine=function(a){this.processLog_([a])};c.prototype.processStack=function(a,b,c){b=b?[a,b]:[a];for(var e=0,d=c.length;e<d;++e){var j=c[e],h=j.charAt(0);"+"==h||"-"==h?(a+=parseInt(j,16),b.push(a)):"o"!=h&&b.push(parseInt(j,16))}return b};c.prototype.skipDispatch=function(){return!1};c.prototype.dispatchLogRow_=function(a){var b=a[0];if(b in this.dispatchTable_&&(b=this.dispatchTable_[b],!(null===b||this.skipDispatch(b)))){for(var c=
[],e=0;e<b.parsers.length;++e){var d=b.parsers[e];if(null===d)c.push(a[1+e]);else if("function"==typeof d)c.push(d(a[1+e]));else{c.push(a.slice(1+e));break}}b.processor.apply(this,c)}};c.prototype.processLog_=function(a){for(var b=0,c=a.length;b<c;++b,++this.lineNum_){var d=a[b];if(d)try{var g=this.csvParser_.parseLine(d);this.dispatchLogRow_(g)}catch(j){this.printError("line "+(this.lineNum_+1)+": "+(j.message||j))}}};return{LogReader:c}});
base.exportTo("tracing.importer.v8",function(){function d(){}d.prototype.root_=null;d.prototype.isEmpty=function(){return!this.root_};d.prototype.insert=function(c,a){if(this.isEmpty())this.root_=new d.Node(c,a);else if(this.splay_(c),this.root_.key!=c){var b=new d.Node(c,a);c>this.root_.key?(b.left=this.root_,b.right=this.root_.right,this.root_.right=null):(b.right=this.root_,b.left=this.root_.left,this.root_.left=null);this.root_=b}};d.prototype.remove=function(c){if(this.isEmpty())throw Error("Key not found: "+
c);this.splay_(c);if(this.root_.key!=c)throw Error("Key not found: "+c);var a=this.root_;if(this.root_.left){var b=this.root_.right;this.root_=this.root_.left;this.splay_(c);this.root_.right=b}else this.root_=this.root_.right;return a};d.prototype.find=function(c){if(this.isEmpty())return null;this.splay_(c);return this.root_.key==c?this.root_:null};d.prototype.findMin=function(){if(this.isEmpty())return null;for(var c=this.root_;c.left;)c=c.left;return c};d.prototype.findMax=function(c){if(this.isEmpty())return null;
for(c=c||this.root_;c.right;)c=c.right;return c};d.prototype.findGreatestLessThan=function(c){if(this.isEmpty())return null;this.splay_(c);return this.root_.key<=c?this.root_:this.root_.left?this.findMax(this.root_.left):null};d.prototype.exportKeysAndValues=function(){var c=[];this.traverse_(function(a){c.push([a.key,a.value])});return c};d.prototype.exportValues=function(){var c=[];this.traverse_(function(a){c.push(a.value)});return c};d.prototype.splay_=function(c){if(!this.isEmpty()){var a,b,
f;a=b=f=new d.Node(null,null);for(var e=this.root_;;)if(c<e.key){if(!e.left)break;if(c<e.left.key){var g=e.left;e.left=g.right;g.right=e;e=g;if(!e.left)break}f=f.left=e;e=e.left}else if(c>e.key){if(!e.right)break;if(c>e.right.key&&(g=e.right,e.right=g.left,g.left=e,e=g,!e.right))break;b=b.right=e;e=e.right}else break;b.right=e.left;f.left=e.right;e.left=a.right;e.right=a.left;this.root_=e}};d.prototype.traverse_=function(c){for(var a=[this.root_];0<a.length;){var b=a.shift();null!=b&&(c(b),a.push(b.left),
a.push(b.right))}};d.Node=function(c,a){this.key=c;this.value=a};d.Node.prototype.left=null;d.Node.prototype.right=null;return{SplayTree:d}});base.require("importer.v8.splaytree");
base.exportTo("tracing.importer.v8",function(){function d(){this.dynamics_=new tracing.importer.v8.SplayTree;this.dynamicsNameGen_=new tracing.importer.v8.CodeMap.NameGenerator;this.statics_=new tracing.importer.v8.SplayTree;this.libraries_=new tracing.importer.v8.SplayTree;this.pages_=[]}d.PAGE_ALIGNMENT=12;d.PAGE_SIZE=1<<d.PAGE_ALIGNMENT;d.prototype.addCode=function(c,a){this.deleteAllCoveredNodes_(this.dynamics_,c,c+a.size);this.dynamics_.insert(c,a)};d.prototype.moveCode=function(c,a){var b=this.dynamics_.remove(c);
this.deleteAllCoveredNodes_(this.dynamics_,a,a+b.value.size);this.dynamics_.insert(a,b.value)};d.prototype.deleteCode=function(c){this.dynamics_.remove(c)};d.prototype.addLibrary=function(c,a){this.markPages_(c,c+a.size);this.libraries_.insert(c,a)};d.prototype.addStaticCode=function(c,a){this.statics_.insert(c,a)};d.prototype.markPages_=function(c,a){for(var b=c;b<=a;b+=d.PAGE_SIZE)this.pages_[b>>>d.PAGE_ALIGNMENT]=1};d.prototype.deleteAllCoveredNodes_=function(c,a,b){for(var d=[],e=b-1;e>=a;){var g=
c.findGreatestLessThan(e);if(!g)break;e=g.key;g=e+g.value.size;e<b&&a<g&&d.push(e);e-=1}a=0;for(b=d.length;a<b;++a)c.remove(d[a])};d.prototype.isAddressBelongsTo_=function(c,a){return c>=a.key&&c<a.key+a.value.size};d.prototype.findInTree_=function(c,a){var b=c.findGreatestLessThan(a);return b&&this.isAddressBelongsTo_(a,b)?b.value:null};d.prototype.findEntry=function(c){if(c>>>d.PAGE_ALIGNMENT in this.pages_)return this.findInTree_(this.statics_,c)||this.findInTree_(this.libraries_,c);var a=this.dynamics_.findMin(),
b=this.dynamics_.findMax();if(null!=b&&c<b.key+b.value.size&&c>=a.key){c=this.findInTree_(this.dynamics_,c);if(null==c)return null;c.nameUpdated_||(c.name=this.dynamicsNameGen_.getName(c.name),c.nameUpdated_=!0);return c}return null};d.prototype.findDynamicEntryByStartAddress=function(c){return(c=this.dynamics_.find(c))?c.value:null};d.prototype.getAllDynamicEntries=function(){return this.dynamics_.exportValues()};d.prototype.getAllDynamicEntriesWithAddresses=function(){return this.dynamics_.exportKeysAndValues()};
d.prototype.getAllStaticEntries=function(){return this.statics_.exportValues()};d.prototype.getAllLibrariesEntries=function(){return this.libraries_.exportValues()};d.CodeEntry=function(c,a){this.size=c;this.name=a||"";this.nameUpdated_=!1};d.CodeEntry.prototype.getName=function(){return this.name};d.CodeEntry.prototype.toString=function(){return this.name+": "+this.size.toString(16)};d.NameGenerator=function(){this.knownNames_={}};d.NameGenerator.prototype.getName=function(c){if(!(c in this.knownNames_))return this.knownNames_[c]=
0,c;var a=++this.knownNames_[c];return c+" {"+a+"}"};return{CodeMap:d}});base.require("model");base.require("model.slice");base.require("color_scheme");base.require("importer.v8.log_reader");base.require("importer.v8.codemap");
base.exportTo("tracing.importer",function(){function d(a,c){this.importPriority=3;this.model_=a;this.logData_=c;this.code_map_=new tracing.importer.v8.CodeMap;this.v8_samples_thread_=this.v8_stack_thread_=this.v8_timer_thread_=void 0}var c=["/d8","/libv8.so"],a={"V8.Execute":{pause:!1,no_execution:!1},"V8.External":{pause:!1,no_execution:!0},"V8.CompileFullCode":{pause:!0,no_execution:!0},"V8.RecompileSynchronous":{pause:!0,no_execution:!0},"V8.RecompileParallel":{pause:!1,no_execution:!1},"V8.CompileEval":{pause:!0,
no_execution:!0},"V8.Parse":{pause:!0,no_execution:!0},"V8.PreParse":{pause:!0,no_execution:!0},"V8.ParseLazy":{pause:!0,no_execution:!0},"V8.GCScavenger":{pause:!0,no_execution:!0},"V8.GCCompactor":{pause:!0,no_execution:!0},"V8.GCContext":{pause:!0,no_execution:!0}};d.canImport=function(a){return"string"!==typeof a&&!(a instanceof String)?!1:"timer-event,"==a.substring(0,12)||"tick,"==a.substring(0,5)||"shared-library,"==a.substring(0,15)||"profiler,"==a.substring(0,9)};d.prototype={__proto__:Object.prototype,
processTimerEvent_:function(b,c,d){var g=a[b];if(void 0!==g){c/=1E3;d/=1E3;var j=tracing.getStringColorId(b);b=new tracing.model.Slice("v8",b,j,c,g,d);this.v8_timer_thread_.pushSlice(b)}},processTimerEventStart_:function(b,c){debugger;var d=a[b];void 0!==d&&this.v8_timer_thread_.beginSlice("v8",b,c/1E3,d)},processTimerEventEnd_:function(a,c){debugger;this.v8_timer_thread_.endSlice(c/1E3)},processCodeCreateEvent_:function(a,c,d,g,j){a=new tracing.importer.v8.CodeMap.CodeEntry(g,j);a.kind=c;this.code_map_.addCode(d,
a)},processCodeMoveEvent_:function(a,c){this.code_map_.moveCode(a,c)},processCodeDeleteEvent_:function(a){this.code_map_.deleteCode(a)},processSharedLibrary_:function(a,d,e){e=new tracing.importer.v8.CodeMap.CodeEntry(e-d,a);e.kind=-3;for(var g=0;g<c.length;g++){var j=c[g];if(0<=a.indexOf(j,a.length-j.length)){e.kind=-1;break}}this.code_map_.addLibrary(d,e)},findCodeKind_:function(a){for(name in CodeKinds)if(0<=CodeKinds[name].kinds.indexOf(a))return CodeKinds[name]},nameForCodeEntry_:function(a){return a?
a.name:"UnknownCode"},processTickEvent_:function(a,c,d,g,j,h,k){c=this.code_map_.findEntry(a);c=this.nameForCodeEntry_(c);d/=1E3;this.v8_samples_thread_.addSample("v8",c,d);if(k&&k.length)for(a=0;8>a&&k[a];a++)c=this.code_map_.findEntry(k[a]),c=this.nameForCodeEntry_(c),g=tracing.getStringColorId(c),c=new tracing.model.Slice("v8",c,g,d,{},0),this.v8_stack_thread_.pushSlice(c)},processDistortion_:function(a){distortion_per_entry=a/1E6},processPlotRange_:function(a,c){xrange_start_override=a;xrange_end_override=
c},importEvents:function(){var a=new tracing.importer.v8.LogReader({"timer-event":{parsers:[null,parseInt,parseInt],processor:this.processTimerEvent_.bind(this)},"shared-library":{parsers:[null,parseInt,parseInt],processor:this.processSharedLibrary_.bind(this)},"timer-event-start":{parsers:[null,parseInt],processor:this.processTimerEventStart_.bind(this)},"timer-event-end":{parsers:[null,parseInt],processor:this.processTimerEventEnd_.bind(this)},"code-creation":{parsers:[null,parseInt,parseInt,parseInt,
null],processor:this.processCodeCreateEvent_.bind(this)},"code-move":{parsers:[parseInt,parseInt],processor:this.processCodeMoveEvent_.bind(this)},"code-delete":{parsers:[parseInt],processor:this.processCodeDeleteEvent_.bind(this)},tick:{parsers:[parseInt,parseInt,parseInt,null,null,parseInt,"var-args"],processor:this.processTickEvent_.bind(this)},distortion:{parsers:[parseInt],processor:this.processDistortion_.bind(this)},"plot-range":{parsers:[parseInt,parseInt],processor:this.processPlotRange_.bind(this)}});
this.v8_timer_thread_=this.model_.getOrCreateProcess(-32).getOrCreateThread(1);this.v8_timer_thread_.name="V8 Timers";this.v8_stack_thread_=this.model_.getOrCreateProcess(-32).getOrCreateThread(2);this.v8_stack_thread_.name="V8 JavaScript";this.v8_samples_thread_=this.model_.getOrCreateProcess(-32).getOrCreateThread(3);this.v8_samples_thread_.name="V8 PC";for(var c=this.logData_.split("\n"),d=0;d<c.length;d++)a.processLogLine(c[d])},finalizeImport:function(){}};tracing.Model.registerImporter(d);return{V8LogImporter:d}});
"use strict";
base.exportTo("base",function(){function d(){this.storage_=a?a:"G_testRunner"in global?new c:localStorage}function c(){}var a=void 0;d.setAlternativeStorageInstance=function(b){a=b};d.prototype={get:function(a,c,d){a=this.namespace_(a,d);a=this.storage_.getItem(a);return null===a||void 0===a?c:String(a)},set:function(a,c,d){this.storage_.setItem(this.namespace_(a,d),String(c))},keys:function(a){var c=[];a=a||"";for(var d=0;d<this.storage_.length;d++){var g=this.storage_.key(d);this.isnamespaced_(g,a)&&
c.push(this.unnamespace_(g,a))}return c},isnamespaced_:function(a,c){return 0==a.indexOf(this.normalize_(c))},namespace_:function(a,c){return this.normalize_(c)+a},unnamespace_:function(a,c){return a.replace(this.normalize_(c),"")},normalize_:function(a){return d.NAMESPACE+(a?a+".":"")}};d.NAMESPACE="trace-viewer";c.prototype={__proto__:Object.prototype,getItem:function(a){return void 0===this[a]||null===this[a]?null:this[a]},setItem:function(a,c){this[a]=c},key:function(a){return Object.keys(this).sort()[a]},
get length(){return Object.keys(this).length}};return{Settings:d}});"use strict";base.requireStylesheet("timeline_view");base.require("timeline_track_view");base.require("timeline_analysis_view");base.require("category_filter_dialog");base.require("filter");base.require("find_control");base.require("overlay");base.require("importer.trace_event_importer");base.require("importer.linux_perf_importer");base.require("importer.v8_log_importer");base.require("settings");
base.exportTo("tracing",function(){var d=tracing.ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("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="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.FindControl;this.findCtl_.controller=new tracing.FindController;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=
j.model&&j.model.importErrors.length?"":"none"}var b=new tracing.ui.Overlay;b.classList.add("view-import-errors-overlay");b.autoClose=!0;var c=document.createElement("div");c.className="button view-import-errors-button view-info-button";c.textContent="Import errors!";var d=document.createElement("div");d.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(d);
b.appendChild(g);var j=this;c.addEventListener("click",function(){b.visible=!0;d.textContent=j.model.importErrors.join("\n")}.bind(this));a();j.addEventListener("modelChange",a);return c},createCategoryFilterButton_:function(){function a(){c.style.display=d.model?"":"none"}var b,c=document.createElement("div");c.className="button view-info-button";c.textContent="Categories";c.__defineSetter__("callback",function(a){b=a});var d=this;a();d.addEventListener("modelChange",a);c.addEventListener("click",
function(){var a=new tracing.CategoryFilterDialog;a.categories=d.model.categories;a.settings=d.settings;a.settings_key="categories";a.settingUpdatedCallback=b;a.visible=!0}.bind(this));return c},createHelpButton_:function(){var a=new tracing.ui.Overlay;a.classList.add("view-help-overlay");a.autoClose=!0;a.additionalCloseKeyCodes.push(63);var b=document.createElement("div");b.className="button 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=j.model&&j.model.metadata.length?"":"none"}var b=new tracing.ui.Overlay;b.classList.add("view-metadata-overlay");b.autoClose=!0;var c=document.createElement("div");c.className="button view-metadata-button view-info-button";
c.textContent="Metadata";var d=document.createElement("div");d.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(d);b.appendChild(g);var j=this;c.addEventListener("click",function(){b.visible=!0;var a=[],c=j.model,f;for(f in c.metadata)a.push(JSON.stringify(c.metadata[f].name)+": "+JSON.stringify(c.metadata[f].value,void 0," "));d.textContent=a.join("\n")}.bind(this));
a();j.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.Model(a)},get model(){if(this.timeline_)return this.timeline_.model},set model(a){var b=a!=this.model,c=a&&!a.bounds.isEmpty;b&&(this.timelineContainer_.textContent="",this.timeline_&&
(this.timeline_.removeEventListener("selectionChange",this.onSelectionChangedBoundToThis_),this.timeline_.detach(),this.timeline_=void 0,this.findCtl_.controller.timeline=void 0));c&&!this.timeline_&&(this.timeline_=new tracing.TimelineTrackView,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(".view-help-button").click(),a.preventDefault()))},beginFind:function(){if(!this.findInProgress_){this.findInProgress_=!0;var a=tracing.FindControl();a.controller=
new tracing.FindController;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.Selection;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.CategoryFilter(b)}}};var c=tracing.ui.define("div");c.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="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:d}});
