window.FLATTENED={};window.FLATTENED_RAW_SCRIPTS={};window.FLATTENED.base=!0;window.FLATTENED["tracing.color_scheme"]=!0;window.FLATTENED["tracing.importer.linux_perf.parser"]=!0;window.FLATTENED["base.guid"]=!0;window.FLATTENED["tracing.trace_model.counter_series"]=!0;window.FLATTENED["tracing.importer.linux_perf.android_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.bus_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.clock_parser"]=!0;
window.FLATTENED["tracing.importer.linux_perf.cpufreq_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.disk_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.drm_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.exynos_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.gesture_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.i915_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.kfunc_parser"]=!0;
window.FLATTENED["tracing.importer.linux_perf.mali_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.power_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.sched_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.sync_parser"]=!0;window.FLATTENED["tracing.importer.linux_perf.workqueue_parser"]=!0;window.FLATTENED["base.event_target"]=!0;window.FLATTENED["base.events"]=!0;window.FLATTENED["base.range"]=!0;window.FLATTENED["tracing.filter"]=!0;
window.FLATTENED["tracing.trace_model.counter"]=!0;window.FLATTENED["tracing.trace_model.trace_model_event"]=!0;window.FLATTENED["tracing.trace_model.slice"]=!0;window.FLATTENED["tracing.trace_model.cpu"]=!0;window.FLATTENED["base.sorted_array_utils"]=!0;window.FLATTENED["base.iteration_helpers"]=!0;window.FLATTENED["base.utils"]=!0;window.FLATTENED["tracing.trace_model.object_snapshot"]=!0;window.FLATTENED["tracing.trace_model.object_instance"]=!0;
window.FLATTENED["tracing.trace_model.time_to_object_instance_map"]=!0;window.FLATTENED["tracing.trace_model.object_collection"]=!0;window.FLATTENED["tracing.trace_model.async_slice"]=!0;window.FLATTENED["tracing.trace_model.async_slice_group"]=!0;window.FLATTENED["tracing.trace_model.sample"]=!0;window.FLATTENED["tracing.trace_model.slice_group"]=!0;window.FLATTENED["tracing.trace_model.thread"]=!0;window.FLATTENED["base.settings"]=!0;window.FLATTENED["tracing.trace_model_settings"]=!0;
window.FLATTENED["tracing.trace_model.process_base"]=!0;window.FLATTENED["tracing.trace_model.kernel"]=!0;window.FLATTENED["tracing.trace_model.process"]=!0;window.FLATTENED["tracing.trace_model"]=!0;window.FLATTENED["tracing.importer.linux_perf_importer"]=!0;window.FLATTENED_RAW_SCRIPTS["../third_party/gl-matrix/src/gl-matrix/common.js"]=!0;window.FLATTENED_RAW_SCRIPTS["../third_party/gl-matrix/src/gl-matrix/mat2d.js"]=!0;
window.FLATTENED_RAW_SCRIPTS["../third_party/gl-matrix/src/gl-matrix/mat4.js"]=!0;window.FLATTENED_RAW_SCRIPTS["../third_party/gl-matrix/src/gl-matrix/vec2.js"]=!0;window.FLATTENED_RAW_SCRIPTS["../third_party/gl-matrix/src/gl-matrix/vec3.js"]=!0;window.FLATTENED_RAW_SCRIPTS["../third_party/gl-matrix/src/gl-matrix/vec4.js"]=!0;window.FLATTENED["base.gl_matrix"]=!0;window.FLATTENED["base.quad"]=!0;window.FLATTENED["tracing.trace_model.instant_event"]=!0;
window.FLATTENED["tracing.importer.trace_event_importer"]=!0;window.FLATTENED["tracing.importer.v8.splaytree"]=!0;window.FLATTENED["tracing.importer.v8.codemap"]=!0;window.FLATTENED["tracing.importer.v8.log_reader"]=!0;window.FLATTENED["tracing.importer.v8_log_importer"]=!0;window.FLATTENED["tracing.importer"]=!0;window.FLATTENED["tracing.analysis.util"]=!0;window.FLATTENED["tracing.selection"]=!0;window.FLATTENED.ui=!0;window.FLATTENED["tracing.analysis.analysis_link"]=!0;
window.FLATTENED["tracing.analysis.generic_object_view"]=!0;window.FLATTENED["tracing.analysis.analysis_results"]=!0;window.FLATTENED["tracing.analysis.analyze_counters"]=!0;window.FLATTENED["tracing.analysis.analyze_slices"]=!0;window.FLATTENED["tracing.analysis.analyze_selection"]=!0;window.FLATTENED["tracing.analysis.object_instance_view"]=!0;window.FLATTENED["tracing.analysis.object_snapshot_view"]=!0;window.FLATTENED["tracing.analysis.default_object_view"]=!0;
window.FLATTENED["tracing.analysis.slice_view"]=!0;window.FLATTENED["tracing.analysis.analysis_view"]=!0;window.FLATTENED["base.properties"]=!0;window.FLATTENED["ui.overlay"]=!0;window.FLATTENED["tracing.category_filter_dialog"]=!0;window.FLATTENED["tracing.mouse_mode_constants"]=!0;window.FLATTENED["tracing.timeline_viewport"]=!0;window.FLATTENED["base.raf"]=!0;window.FLATTENED["ui.container_that_decorates_its_children"]=!0;window.FLATTENED["tracing.tracks.track"]=!0;
window.FLATTENED["tracing.tracks.drawing_container"]=!0;window.FLATTENED["tracing.constants"]=!0;window.FLATTENED["tracing.tracks.heading_track"]=!0;window.FLATTENED["tracing.tracks.ruler_track"]=!0;window.FLATTENED["base.measuring_stick"]=!0;window.FLATTENED["tracing.tracks.container_track"]=!0;window.FLATTENED["tracing.fast_rect_renderer"]=!0;window.FLATTENED["tracing.tracks.slice_track"]=!0;window.FLATTENED["tracing.tracks.cpu_track"]=!0;
window.FLATTENED["tracing.tracks.object_instance_track"]=!0;window.FLATTENED["tcmalloc.heap_instance_track"]=!0;window.FLATTENED["tracing.tracks.counter_track"]=!0;window.FLATTENED["tracing.tracks.spacing_track"]=!0;window.FLATTENED["tracing.tracks.slice_group_track"]=!0;window.FLATTENED["tracing.tracks.async_slice_group_track"]=!0;window.FLATTENED["tracing.tracks.thread_track"]=!0;window.FLATTENED["ui.dom_helpers"]=!0;window.FLATTENED["tracing.tracks.process_track_base"]=!0;
window.FLATTENED["tracing.tracks.kernel_track"]=!0;window.FLATTENED["tracing.tracks.process_track"]=!0;window.FLATTENED["tracing.tracks.trace_model_track"]=!0;window.FLATTENED["ui.mouse_mode_selector"]=!0;window.FLATTENED["tracing.timeline_track_view"]=!0;window.FLATTENED["tracing.find_control"]=!0;window.FLATTENED["ui.drag_handle"]=!0;window.FLATTENED["tracing.timeline_view"]=!0;window.FLATTENED["tracing.standalone_timeline_view"]=!0;
var templateData_=window.atob(" "),templateElem_=
document.createElement("div");for(templateElem_.innerHTML=templateData_;templateElem_.hasChildNodes();)document.head.appendChild(templateElem_.removeChild(templateElem_.firstChild));"use strict";var global=this;
this.base=function(){function d(a){"/"==a[a.length-1]&&(a=a.substring(0,a.length-1));l=a}function b(a,c){n[a]||(n[a]=[]);for(var e=n[a],b=!1,f=0;f<e.length;f++)e[f]==c&&(b=!0);b||e.push(c)}function a(a,c){q[a]||(q[a]=[]);for(var e=q[a],b=!1,f=0;f<q.length;f++)e[f]==c&&(b=!0);b||e.push(c)}function c(a,c){p[a]||(p[a]=[]);for(var e=p[a],b=!1,f=0;f<e.length;f++)e[f]==c&&(b=!0);b||e.push(c)}function e(){if(!window.FLATTENED&&!m){m=!0;var e=new XMLHttpRequest;e.open("GET","/deps.js",!1);e.send(null);if(200!=
e.status){var e=JSON.parse(e.responseText),f="You have a module problem: "+e.message,g=document.createElement("div");g.style.position="fixed";g.style.border="3px solid red";g.style.color="black";g.style.padding="8px";g.innerHTML='<h2>Module parsing problem</h2><div id="message"></div><pre id="details"></pre>';g.querySelector("#message").textContent=e.message;var h=g.querySelector("#details");h.textContent=e.details;h.style.maxWidth="800px";h.style.overflow="auto";document.body?document.body.appendChild(g):
setTimeout(function(){document.body.appendChild(g)},150);throw Error(f);}base.addModuleDependency=b;base.addModuleRawScriptDependency=a;base.addModuleStylesheet=c;try{eval(e.responseText)}catch(d){throw Error("When loading deps, got "+d.stack?d.stack:d.message);}delete base.addModuleStylesheet;delete base.addModuleRawScriptDependency;delete base.addModuleDependency}}function f(){if(!t&&!window.FLATTENED){t=!0;var a=new XMLHttpRequest;a.open("GET","/templates",!1);a.send(null);var c=document.createElement("div");
for(c.innerHTML=a.responseText;c.hasChildNodes();)document.head.appendChild(c.removeChild(c.firstChild))}}function g(a,c){var b=c||0,d=a;a instanceof Array||(d=[a]);e();f();d.forEach(function(a){if(window.FLATTENED){if(!window.FLATTENED[a])throw Error("Somehow, module "+a+" didn't get stored in the flattened js file! You may need to rerun build/generate_about_tracing_contents.py");}else if("APPENDED"!=v[a]&&"RESOLVING"!=v[a]){v[a]="RESOLVING";g(n[a]||[],b+1);for(var c=p[a]||[],e=0;e<c.length;e++)k(c[e]);
c=q[a]||[];for(e=0;e<c.length;e++){var f=c[e];w[f]||(h(f),w[f]="APPENDED")}h(a.replace(/\./g,"/")+".js");v[name]="APPENDED"}})}function h(a){var c=document.createElement("script");c.src=l+"/"+a;c.type="text/javascript";c.defer=!0;c.async=!1;base.doc.head.appendChild(c)}function k(a){if(!window.FLATTENED&&!s[a]){s[a]=!0;a=a.replace(/\./g,"/")+".css";a=l+"/"+a;var c=document.createElement("link");c.setAttribute("rel","stylesheet");c.setAttribute("href",a);base.doc.head.appendChild(c)}}var l=".",m=!1,
n={},p={},q={},t=!1,v={},w={},s={},r={};return{set moduleBasePath(a){d(a)},get moduleBasePath(){return l},initialize:function(){if(global.document)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 a=base;Object.defineProperty(global,"base",{get:function(){Object.defineProperty(global,
"base",{value:a});a.initialize();return a},configurable:!0})}},require:g,requireStylesheet:k,requireRawScript:function(a){if(window.FLATTENED_RAW_SCRIPTS){if(!window.FLATTENED_RAW_SCRIPTS[a])throw Error("Somehow, "+a+" didn't get stored in the flattened js file! You may need to rerun build/generate_about_tracing_contents.py");}else if(!w[a])throw Error(a+" should already have been loaded. Did you forget to run build/generate_about_tracing_contents.py?");},requireTemplate:function(a){if(!window.FLATTENED&&
!r[a]){r[a]=!0;a=a.replace(/\./g,"/")+".html";a=l+"/"+a;var c=document.createElement("link");c.setAttribute("rel","import");c.setAttribute("href",a)}},exportTo:function(a,c){var e;e=a.split(".");for(var b=global,f;e.length&&(f=e.shift());)b=f in b?b[f]:b[f]={};e=b;try{var g=c()}catch(h){console.log("While running exports for ",a,":");console.log(h.stack||h);return}for(var d in g)(b=Object.getOwnPropertyDescriptor(g,d))&&Object.defineProperty(e,d,b)}}}();base.initialize();"use strict";
base.exportTo("tracing",function(){function d(a){for(var c=0,e=0;e<a.length;++e)c=(c+37*c+11*a.charCodeAt(e))%4294967295;return c}var b=[{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},{r:199,g:155,b:125}],a=b.length-5,c=b.length,e=b.concat(b.map(function(a){var c;c=240<=a.r&&240<=a.g&&240<=a.b?-0.2:0.45;return{r:Math.min(255,a.r+Math.floor(a.r*c)),g:Math.min(255,a.g+Math.floor(a.g*c)),
b:Math.min(255,a.b+Math.floor(a.b*c))}})).map(function(a){return"rgb("+a.r+","+a.g+","+a.b+")"}),f={};return{getColorPalette:function(){return e},getColorPaletteHighlightIdBoost:function(){return c},getColorIdByName:function(c){if("iowait"==c)return a;if("running"==c)return a+1;if("runnable"==c)return a+2;if("sleeping"==c)return a+3;if("UNKNOWN"==c)return a+4;throw Error("Unrecognized color ")+c;},getStringHash:d,getStringColorId:function(c){if(void 0===f[c]){var e=d(c);f[c]=e%a}return f[c]}}});"use strict";
base.exportTo("tracing.importer.linux_perf",function(){function d(a){this.importer=a;this.model=a.model}var b=[];d.registerSubtype=function(a){b.push(a)};d.getSubtypeConstructors=function(){return b};d.prototype={__proto__:Object.prototype};return{Parser:d}});"use strict";base.exportTo("base",function(){var d=1;return{GUID:{allocate:function(){return d++}}}});"use strict";base.require("base.guid");
base.exportTo("tracing.trace_model",function(){function d(a,c){this.guid_=base.GUID.allocate();this.timestamp_=a;this.value_=c}function b(a,c){this.guid_=base.GUID.allocate();this.name_=a;this.color_=c;this.timestamps_=[];this.samples_=[]}d.prototype={__proto__:Object.prototype,get value(){return this.value_},set timestamp(a){this.timestamp_=a},toJSON:function(){for(var a={},c=Object.keys(this),e=0;e<c.length;e++){var b=c[e];"function"!=typeof this[b]&&(a[b]="parent"==b?this[b].guid:this[b])}return a}};
b.prototype={__proto__:Object.prototype,toJSON:function(){for(var a={},c=Object.keys(this),e=0;e<c.length;e++){var b=c[e];"function"!=typeof this[b]&&(a[b]="parent"==b?this[b].guid:this[b])}return a},get length(){return this.timestamps_.length},get name(){return this.name_},get color(){return this.color_},get samples(){return this.samples_},get timestamps(){return this.timestamps_},getSample:function(a){return this.samples_[a]},getTimestamp:function(a){return this.timestamps_[a]},addSample:function(a,
c){this.timestamps_.push(a);this.samples_.push(new d(a,c))},getStatistics:function(a){for(var c=0,e=Number.MAX_VALUE,b=-Number.MAX_VALUE,g=0;g<a.length;++g)var h=this.getSample(a[g]).value,c=c+h,e=Math.min(h,e),b=Math.max(h,b);return{min:e,max:b,avg:c/a.length,start:this.getSample(a[0]).value,end:this.getSample(a.length-1).value}},shiftTimestampsForward:function(a){for(var c=0;c<this.timestamps_.length;++c)this.timestamps_[c]+=a,this.samples_[c].timestamp=this.timestamps_[c]}};return{CounterSeries:b}});
"use strict";base.require("tracing.importer.linux_perf.parser");base.require("tracing.trace_model.counter_series");
base.exportTo("tracing.importer.linux_perf",function(){function d(c){a.call(this,c);c.registerEventHandler("tracing_mark_write:android",d.prototype.traceMarkWriteAndroidEvent.bind(this));c.registerEventHandler("0:android",d.prototype.traceMarkWriteAndroidEvent.bind(this));this.model_=c.model_;this.ppids_={}}function b(a){var e={};if(a){a=a.split(";");for(var b=0;b<a.length;++b){var g=a[b].split("=");g[0]&&(e[g.shift()]=g.join("="))}}return e}var a=tracing.importer.linux_perf.Parser;d.prototype={__proto__:a.prototype,
openAsyncSlice:function(a,e,b,g,h){e=new tracing.trace_model.AsyncSlice(e,b,tracing.getStringColorId(b),h);e.id=g;e.startThread=a;this.openAsyncSlices||(this.openAsyncSlices={});this.openAsyncSlices[b+":"+g]=e},closeAsyncSlice:function(a,e,b,g){this.openAsyncSlices&&(e=e+":"+b,b=this.openAsyncSlices[e])&&(b.endThread=a,b.duration=g-b.start,b.startThread.asyncSliceGroup.push(b),b.subSlices=[new tracing.trace_model.Slice(b.category,b.title,b.colorId,b.start,b.args,b.duration)],delete this.openAsyncSlices[e])},
traceMarkWriteAndroidEvent:function(a,e,f,g,h){a=h.details.split("|");switch(a[0]){case "B":e=parseInt(a[1]);var d=a[4],l=a[2],m=this.model_.getOrCreateProcess(e).getOrCreateThread(f);m.name=h.threadName;if(!m.sliceGroup.isTimestampValidForBeginOrEnd(g))return this.model_.importErrors.push("Timestamps are moving backward."),!1;this.ppids_[f]=e;m.sliceGroup.beginSlice(d,l,g,b(a[3]));break;case "E":e=this.ppids_[f];if(void 0===e)break;m=this.model_.getOrCreateProcess(e).getOrCreateThread(f);if(!m.sliceGroup.openSliceCount)break;
f=m.sliceGroup.endSlice(g);h=b(a[3]);for(d in h)void 0!==f.args[d]&&this.model_.importErrors.push("Both the B and E events of "+f.title+"provided values for argument "+d+". The value of the E event will be used."),f.args[d]=h[d];break;case "C":e=parseInt(a[1]);var l=a[2],n=parseInt(a[3]),d=a[4];f=this.model_.getOrCreateProcess(e).getOrCreateCounter(d,l);0===f.numSeries&&f.addSeries(new tracing.trace_model.CounterSeries(n,tracing.getStringColorId(f.name+".value")));f.series.forEach(function(a){a.addSample(g,
n)});break;case "S":e=parseInt(a[1]);l=a[2];a=parseInt(a[3]);m=this.model_.getOrCreateProcess(e).getOrCreateThread(f);m.name=h.threadName;this.ppids_[f]=e;this.openAsyncSlice(m,null,l,a,g);break;case "F":e=this.ppids_[f];if(void 0===e)break;m=this.model_.getOrCreateProcess(e).getOrCreateThread(f);l=a[2];a=parseInt(a[3]);this.closeAsyncSlice(m,l,a,g);break;default:return!1}return!0}};a.registerSubtype(d);return{AndroidParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");base.require("tracing.trace_model.counter_series");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.call(this,a);a.registerEventHandler("memory_bus_usage",d.prototype.traceMarkWriteBusEvent.bind(this));this.model_=a.model_;this.ppids_={}}var b=tracing.importer.linux_perf.Parser;d.prototype={__proto__:b.prototype,traceMarkWriteBusEvent:function(a,c,e,b,g,h){e=/bus=(\S+) rw_bytes=(\d+) r_bytes=(\d+) w_bytes=(\d+) cycles=(\d+) ns=(\d+)/.exec(g.details);a=e[1];parseInt(e[2]);c=parseInt(e[3]);parseInt(e[4]);parseInt(e[5]);e=parseInt(e[6]);
var d=1E9*c/e,d=d/1048576;c=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,"bus "+a+" read");0===c.numSeries&&c.addSeries(new tracing.trace_model.CounterSeries("value",tracing.getStringColorId(c.name+".value")));c.series.forEach(function(a){a.addSample(b,d)});c=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,"bus "+a+" write");0===c.numSeries&&c.addSeries(new tracing.trace_model.CounterSeries("value",tracing.getStringColorId(c.name+".value")));c.series.forEach(function(a){a.addSample(b,
d)});return!0}};b.registerSubtype(d);return{BusParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");base.require("tracing.trace_model.counter_series");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.call(this,a);a.registerEventHandler("clock_set_rate",d.prototype.traceMarkWriteClockEvent.bind(this));this.model_=a.model_;this.ppids_={}}var b=tracing.importer.linux_perf.Parser;d.prototype={__proto__:b.prototype,traceMarkWriteClockEvent:function(a,c,e,b,g,h){a=/(\S+) state=(\d+) cpu_id=(\d+)/.exec(g.details);c=a[1];var d=parseInt(a[2]);a=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,c);0===a.numSeries&&a.addSeries(new tracing.trace_model.CounterSeries("value",
tracing.getStringColorId(a.name+".value")));a.series.forEach(function(a){a.addSample(b,d)});return!0}};b.registerSubtype(d);return{ClockParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(c){a.call(this,c);c.registerEventHandler("cpufreq_interactive_up",d.prototype.cpufreqUpDownEvent.bind(this));c.registerEventHandler("cpufreq_interactive_down",d.prototype.cpufreqUpDownEvent.bind(this));c.registerEventHandler("cpufreq_interactive_already",d.prototype.cpufreqTargetEvent.bind(this));c.registerEventHandler("cpufreq_interactive_notyet",d.prototype.cpufreqTargetEvent.bind(this));c.registerEventHandler("cpufreq_interactive_setspeed",
d.prototype.cpufreqTargetEvent.bind(this));c.registerEventHandler("cpufreq_interactive_target",d.prototype.cpufreqTargetEvent.bind(this));c.registerEventHandler("cpufreq_interactive_boost",d.prototype.cpufreqBoostUnboostEvent.bind(this));c.registerEventHandler("cpufreq_interactive_unboost",d.prototype.cpufreqBoostUnboostEvent.bind(this))}function b(a){var e={};a=a.split(/\s+/);for(var b=a.length,g=0;g<b;g++){var h=a[g].split("=");e[h[0]]=parseInt(h[1])}return e}var a=tracing.importer.linux_perf.Parser;
d.prototype={__proto__:a.prototype,cpufreqSlice:function(a,e,b,g){b=this.importer.getOrCreatePseudoThread("cpufreq");b.openSlice=e;a=new tracing.trace_model.Slice("",b.openSlice,tracing.getStringColorId(b.openSlice),a,g,0);b.thread.sliceGroup.pushSlice(a)},cpufreqBoostSlice:function(a,e,b){var g=this.importer.getOrCreatePseudoThread("cpufreq_boost");g.openSlice=e;a=new tracing.trace_model.Slice("",g.openSlice,tracing.getStringColorId(g.openSlice),a,b,0);g.thread.sliceGroup.pushSlice(a)},cpufreqUpDownEvent:function(a,
e,f,g,h){e=b(h.details);this.cpufreqSlice(g,a,e.cpu,e);return!0},cpufreqTargetEvent:function(a,e,f,g,h){e=b(h.details);this.cpufreqSlice(g,a,e.cpu,e);return!0},cpufreqBoostUnboostEvent:function(a,e,b,g,h){this.cpufreqBoostSlice(g,a,{type:h.details});return!0}};a.registerSubtype(d);return{CpufreqParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.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 b=tracing.importer.linux_perf.Parser;d.prototype={__proto__:b.prototype,
openAsyncSlice:function(a,c,e,b,g,h){e=this.importer.getOrCreateKernelThread(c+":"+e,b);a=new tracing.trace_model.AsyncSlice(c,h,tracing.getStringColorId(h),a);a.startThread=e.thread;e.openAsyncSlices||(e.openAsyncSlices={});e.openAsyncSlices[g]=a},closeAsyncSlice:function(a,c,e,b,g,h){e=this.importer.getOrCreateKernelThread(c+":"+e,b);e.openAsyncSlices&&(b=e.openAsyncSlices[g])&&(b.duration=a-b.start,b.args=h,b.endThread=e.thread,b.subSlices=[new tracing.trace_model.Slice(c,b.title,b.colorId,b.start,
b.args,b.duration)],e.thread.asyncSliceGroup.push(b),delete e.openAsyncSlices[g])},ext4SyncFileEnterEvent:function(a,c,e,b,g){a=/dev (\d+,\d+) ino (\d+) parent (\d+) datasync (\d+)/.exec(g.details);if(!a)return!1;c=a[1];e=parseInt(a[2]);this.openAsyncSlice(b,"ext4",g.threadName,g.pid,c+"-"+e,1==a[4]?"fdatasync":"fsync");return!0},ext4SyncFileExitEvent:function(a,c,e,b,g){e=/dev (\d+,\d+) ino (\d+) ret (\d+)/.exec(g.details);if(!e)return!1;a=e[1];c=parseInt(e[2]);e=parseInt(e[3]);this.closeAsyncSlice(b,
"ext4",g.threadName,g.pid,a+"-"+c,{device:a,inode:c,error:e});return!0},blockRqIssueEvent:function(a,c,e,b,g){var h=/(\d+,\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? \d+ \(.*\) (\d+) \+ (\d+) \[.*\]/.exec(g.details);if(!h)return!1;switch(h[3]){case "D":a="discard";break;case "W":a="write";break;case "R":a="read";break;case "N":a="none";break;default:a="unknown"}h[2]&&(a+=" flush");"F"==h[4]&&(a+=" fua");"A"==h[5]&&(a+=" ahead");"S"==h[6]&&(a+=" sync");"M"==h[7]&&(a+=" meta");c=h[1];e=parseInt(h[8]);h=parseInt(h[9]);
this.openAsyncSlice(b,"block",g.threadName,g.pid,c+"-"+e+"-"+h,a);return!0},blockRqCompleteEvent:function(a,c,e,b,g){var h=/(\d+,\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? \(.*\) (\d+) \+ (\d+) \[(.*)\]/.exec(g.details);if(!h)return!1;a=h[1];c=parseInt(h[8]);e=parseInt(h[9]);h=parseInt(h[10]);this.closeAsyncSlice(b,"block",g.threadName,g.pid,a+"-"+c+"-"+e,{device:a,sector:c,numSectors:e,error:h});return!0}};b.registerSubtype(d);return{DiskParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.call(this,a);a.registerEventHandler("drm_vblank_event",d.prototype.vblankEvent.bind(this))}var b=tracing.importer.linux_perf.Parser;d.prototype={__proto__:b.prototype,drmVblankSlice:function(a,c,e){var b=this.importer.getOrCreatePseudoThread("drm_vblank");b.openSlice=c;a=new tracing.trace_model.Slice("",b.openSlice,tracing.getStringColorId(b.openSlice),a,e,0);b.thread.sliceGroup.pushSlice(a)},vblankEvent:function(a,c,e,b,g){c=
/crtc=(\d+), seq=(\d+)/.exec(g.details);if(!c)return!1;a=parseInt(c[1]);c=parseInt(c[2]);this.drmVblankSlice(b,"vblank:"+a,{crtc:a,seq:c});return!0}};b.registerSubtype(d);return{DrmParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.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 b=tracing.importer.linux_perf.Parser;d.prototype={__proto__:b.prototype,
exynosFlipOpenSlice:function(a,c){var e=this.importer.getOrCreatePseudoThread("exynos_flip");e.openSliceTS=a;e.openSlice="flip:"+c},exynosFlipCloseSlice:function(a,c){var e=this.importer.getOrCreatePseudoThread("exynos_flip");if(e.openSlice){var b=new tracing.trace_model.Slice("",e.openSlice,tracing.getStringColorId(e.openSlice),e.openSliceTS,c,a-e.openSliceTS);e.thread.sliceGroup.pushSlice(b)}e.openSlice=void 0},flipEvent:function(a,c,e,b,g){c=/pipe=(\d+)/.exec(g.details);if(!c)return!1;c=parseInt(c[1]);
"exynos_flip_request"==a?this.exynosFlipOpenSlice(b,c):this.exynosFlipCloseSlice(b,{pipe:c});return!0},exynosBusfreqSample:function(a,c,e){a=this.importer.getOrCreateCpuState(0).cpu.getOrCreateCounter("",a);0===a.numSeries&&a.addSeries(new tracing.trace_model.CounterSeries("frequency",tracing.getStringColorId(a.name+".frequency")));a.series.forEach(function(a){a.addSample(c,e)})},busfreqTargetIntEvent:function(a,c,e,b,g){a=/frequency=(\d+)/.exec(g.details);if(!a)return!1;this.exynosBusfreqSample("INT Frequency",
b,parseInt(a[1]));return!0},busfreqTargetMifEvent:function(a,c,e,b,g){a=/frequency=(\d+)/.exec(g.details);if(!a)return!1;this.exynosBusfreqSample("MIF Frequency",b,parseInt(a[1]));return!0}};b.registerSubtype(d);return{ExynosParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.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 b=tracing.importer.linux_perf.Parser;d.prototype={__proto__:b.prototype,gestureOpenSlice:function(a,c,e){this.importer.getOrCreatePseudoThread("gesture").thread.sliceGroup.beginSlice("touchpad_gesture",
a,c,e)},gestureCloseSlice:function(a,c){var e=this.importer.getOrCreatePseudoThread("gesture").thread;if(e.sliceGroup.openSliceCount){var b=e.sliceGroup.mostRecentlyOpenedPartialSlice;b.title!=a?this.importer.importError("Titles do not match. Title is "+b.title+" in openSlice, and is "+a+" in endSlice"):e.sliceGroup.endSlice(c)}},logEvent:function(a,c,e,b,g){a=/^\s*(\w+):\s*(\w+)$/.exec(g.details);switch(a[1]){case "start":this.gestureOpenSlice("GestureLog",b,{name:a[2]});break;case "end":this.gestureCloseSlice("GestureLog",
b)}return!0},syncEvent:function(a,c,e,b,g){a=/^\s*(\w+):\s*(\w+)$/.exec(g.details);switch(a[1]){case "start":this.gestureOpenSlice("SyncInterpret",b,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("SyncInterpret",b)}return!0},timerEvent:function(a,c,e,b,g){a=/^\s*(\w+):\s*(\w+)$/.exec(g.details);switch(a[1]){case "start":this.gestureOpenSlice("HandleTimer",b,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("HandleTimer",b)}return!0}};b.registerSubtype(d);return{GestureParser:d}});
"use strict";base.require("tracing.importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.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 b=
tracing.importer.linux_perf.Parser;d.prototype={__proto__:b.prototype,i915FlipOpenSlice:function(a,c,e){var b=this.importer.getOrCreatePseudoThread("i915_flip");b.openSliceTS=a;b.openSlice="flip:"+c+"/"+e},i915FlipCloseSlice:function(a,c){var e=this.importer.getOrCreatePseudoThread("i915_flip");if(e.openSlice){var b=new tracing.trace_model.Slice("",e.openSlice,tracing.getStringColorId(e.openSlice),e.openSliceTS,c,a-e.openSliceTS);e.thread.sliceGroup.pushSlice(b)}e.openSlice=void 0},i915GemObjectSlice:function(a,
c,e,b){var g=this.importer.getOrCreatePseudoThread("i915_gem");g.openSlice=c+":"+e;a=new tracing.trace_model.Slice("",g.openSlice,tracing.getStringColorId(g.openSlice),a,b,0);g.thread.sliceGroup.pushSlice(a)},i915GemRingSlice:function(a,c,e,b,g){var h=this.importer.getOrCreatePseudoThread("i915_gem_ring");h.openSlice=c+":"+e+"."+b;a=new tracing.trace_model.Slice("",h.openSlice,tracing.getStringColorId(h.openSlice),a,g,0);h.thread.sliceGroup.pushSlice(a)},i915RegSlice:function(a,c,e,b){var g=this.importer.getOrCreatePseudoThread("i915_reg");
g.openSlice=c+":"+e;a=new tracing.trace_model.Slice("",g.openSlice,tracing.getStringColorId(g.openSlice),a,b,0);g.thread.sliceGroup.pushSlice(a)},gemObjectCreateEvent:function(a,c,e,b,g){e=/obj=(\w+), size=(\d+)/.exec(g.details);if(!e)return!1;c=e[1];e=parseInt(e[2]);this.i915GemObjectSlice(b,a,c,{obj:c,size:e});return!0},gemObjectBindEvent:function(a,c,e,b,g){g=/obj=(\w+), offset=(\w+), size=(\d+)/.exec(g.details);if(!g)return!1;c=g[1];e=g[2];g=parseInt(g[3]);this.i915ObjectGemSlice(b,a+":"+c,{obj:c,
offset:e,size:g});return!0},gemObjectChangeDomainEvent:function(a,c,e,b,g){c=/obj=(\w+), read=(\w+=>\w+), write=(\w+=>\w+)/.exec(g.details);if(!c)return!1;e=c[1];this.i915GemObjectSlice(b,a,e,{obj:e,read:c[2],write:c[3]});return!0},gemObjectPreadWriteEvent:function(a,c,e,b,g){g=/obj=(\w+), offset=(\d+), len=(\d+)/.exec(g.details);if(!g)return!1;c=g[1];e=parseInt(g[2]);g=parseInt(g[3]);this.i915GemObjectSlice(b,a,c,{obj:c,offset:e,len:g});return!0},gemObjectFaultEvent:function(a,c,e,b,g){g=/obj=(\w+), (\w+) index=(\d+)/.exec(g.details);
if(!g)return!1;c=g[1];e=g[2];g=parseInt(g[3]);this.i915GemObjectSlice(b,a,c,{obj:c,type:e,index:g});return!0},gemObjectDestroyEvent:function(a,c,e,b,g){c=/obj=(\w+)/.exec(g.details);if(!c)return!1;c=c[1];this.i915GemObjectSlice(b,a,c,{obj:c});return!0},gemRingDispatchEvent:function(a,c,e,b,g){g=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(g.details);if(!g)return!1;c=parseInt(g[1]);e=parseInt(g[2]);g=parseInt(g[3]);this.i915GemRingSlice(b,a,c,e,{dev:c,ring:e,seqno:g});return!0},gemRingFlushEvent:function(a,
c,e,b,g){c=/dev=(\d+), ring=(\w+), invalidate=(\w+), flush=(\w+)/.exec(g.details);if(!c)return!1;e=parseInt(c[1]);g=parseInt(c[2]);this.i915GemRingSlice(b,a,e,g,{dev:e,ring:g,invalidate:c[3],flush:c[4]});return!0},gemRequestEvent:function(a,c,e,b,g){g=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(g.details);if(!g)return!1;c=parseInt(g[1]);e=parseInt(g[2]);g=parseInt(g[3]);this.i915GemRingSlice(b,a,c,e,{dev:c,ring:e,seqno:g});return!0},gemRingWaitEvent:function(a,c,e,b,g){e=/dev=(\d+), ring=(\d+)/.exec(g.details);
if(!e)return!1;c=parseInt(e[1]);e=parseInt(e[2]);this.i915GemRingSlice(b,a,c,e,{dev:c,ring:e});return!0},regRWEvent:function(a,c,e,b,g){a=/(\w+) reg=(\w+), len=(\d+), val=(\(\w+, \w+\))/.exec(g.details);if(!a)return!1;c=a[1];e=a[2];this.i915RegSlice(b,c,e,{rw:c,reg:e,len:a[3],data:a[3]});return!0},flipEvent:function(a,c,e,b,g){e=/plane=(\d+), obj=(\w+)/.exec(g.details);if(!e)return!1;c=parseInt(e[1]);e=e[2];"i915_flip_request"==a?this.i915FlipOpenSlice(b,e,c):this.i915FlipCloseSlice(b,{obj:e,plane:c});
return!0}};b.registerSubtype(d);return{I915Parser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.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 b=tracing.importer.linux_perf.Parser,a=/func=(.+)/;d.prototype={__proto__:b.prototype,traceKernelFuncEnterEvent:function(c,e,b,g,h){c=a.exec(h.details);if(!c||void 0===h.tgid)return!1;e=parseInt(h.tgid);c=c[1];
b=this.model_.getOrCreateProcess(e).getOrCreateThread(b);b.name=h.threadName;h=b.kernelSliceGroup;if(!h.isTimestampValidForBeginOrEnd(g))return this.model_.importErrors.push("Timestamps are moving backward."),!1;h.beginSlice(null,c,g,{});return!0},traceKernelFuncReturnEvent:function(a,e,b,g,h){if(void 0===h.tgid)return!1;a=parseInt(h.tgid);b=this.model_.getOrCreateProcess(a).getOrCreateThread(b);b.name=h.threadName;h=b.kernelSliceGroup;if(!h.isTimestampValidForBeginOrEnd(g))return this.model_.importErrors.push("Timestamps are moving backward."),
!1;0<h.openSliceCount&&h.endSlice(g);return!0}};b.registerSubtype(d);return{KernelFuncParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.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 c=0;7>c;c++){var e="JS"+c,f="mali_hwc_"+e;this.addJMCounter(f+"_JOBS",e+" Jobs");this.addJMCounter(f+"_TASKS",e+" Tasks");this.addJMCycles(f+"_ACTIVE",e+" Active");this.addJMCycles(f+"_WAIT_READ",e+" Wait Read");this.addJMCycles(f+"_WAIT_ISSUE",e+" Wait Issue");this.addJMCycles(f+"_WAIT_DEPEND",e+" Wait Depend");this.addJMCycles(f+"_WAIT_FINISH",e+" 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 b=tracing.importer.linux_perf.Parser;d.prototype={__proto__:b.prototype,maliDDKOpenSlice:function(a,c,e,b,g){a=this.importer.model_.getOrCreateProcess(a).getOrCreateThread(c);b=/^([\w\d_]*)(?:\(\))?:?\s*(.*)$/.exec(b);a.sliceGroup.beginSlice("gpu-driver",b[1],e,{args:b[2],blockinfo:g})},maliDDKCloseSlice:function(a,c,e,b,g){a=this.importer.model_.getOrCreateProcess(a).getOrCreateThread(c);a.sliceGroup.openSliceCount&&a.sliceGroup.endSlice(e)},
autoDetectLineRE:function(a){var c=/^\s*\(([\w\-]*)\)\s*(\w+):\s*([\w\\\/\.\-]*@\d*):?\s*(.*)$/;if(c.test(a))return c;c=/^s*()(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/;return c.test(a)?c:null},lineRE:null,maliDDKEvent:function(a,c,e,b,g){if(null==this.lineRE&&(this.lineRE=this.autoDetectLineRE(g.details),null==this.lineRE))return!1;a=this.lineRE.exec(g.details);c=""===a[1]?"mali":a[1];switch(a[2]){case "cros_trace_print_enter":this.maliDDKOpenSlice(e,c,b,a[4],a[3]);break;case "cros_trace_print_exit":this.maliDDKCloseSlice(e,
c,b,[],a[3])}return!0},dvfsSample:function(a,c,e,b){var g=parseInt(b);a=this.model_.getOrCreateProcess(0).getOrCreateCounter("DVFS",a);0===a.numSeries&&a.addSeries(new tracing.trace_model.CounterSeries(c,tracing.getStringColorId(a.name)));a.series.forEach(function(a){a.addSample(e,g)})},dvfsEventEvent:function(a,c,e,b,g){a=/utilization=(\d+)/.exec(g.details);if(!a)return!1;this.dvfsSample("DVFS Utilization","utilization",b,a[1]);return!0},dvfsSetClockEvent:function(a,c,e,b,g){a=/frequency=(\d+)/.exec(g.details);
if(!a)return!1;this.dvfsSample("DVFS Frequency","frequency",b,a[1]);return!0},dvfsSetVoltageEvent:function(a,c,e,b,g){a=/voltage=(\d+)/.exec(g.details);if(!a)return!1;this.dvfsSample("DVFS Voltage","voltage",b,a[1]);return!0},hwcSample:function(a,c,e,b,g){g=/val=(\d+)/.exec(g.details);if(!g)return!1;var h=parseInt(g[1]);a=this.model_.getOrCreateProcess(0).getOrCreateCounter(a,c);0===a.numSeries&&a.addSeries(new tracing.trace_model.CounterSeries(e,tracing.getStringColorId(a.name)));a.series.forEach(function(a){a.addSample(b,
h)});return!0},jmSample:function(a,c,e,b){return this.hwcSample("mali:jm","JM: "+a,c,e,b)},addJMCounter:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,h,d){return this.jmSample(c,"count",h,d)}.bind(this))},addJMCycles:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.jmSample(c,"cycles",d,k)}.bind(this))},tilerSample:function(a,c,b,f){return this.hwcSample("mali:tiler","Tiler: "+a,c,b,f)},addTilerCounter:function(a,c){this.importer.registerEventHandler(a,
function(a,b,g,d,k){return this.tilerSample(c,"count",d,k)}.bind(this))},addTilerCycles:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.tilerSample(c,"cycles",d,k)}.bind(this))},fragSample:function(a,c,b,f){return this.hwcSample("mali:fragment","Fragment: "+a,c,b,f)},addFragCounter:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.fragSample(c,"count",d,k)}.bind(this))},addFragCycles:function(a,c){this.importer.registerEventHandler(a,
function(a,b,g,d,k){return this.fragSample(c,"cycles",d,k)}.bind(this))},computeSample:function(a,c,b,f){return this.hwcSample("mali:compute","Compute: "+a,c,b,f)},addComputeCounter:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.computeSample(c,"count",d,k)}.bind(this))},addComputeCycles:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.computeSample(c,"cycles",d,k)}.bind(this))},addTripipeCycles:function(a,c){this.importer.registerEventHandler(a,
function(a,b,g,d,k){return this.hwcSample("mali:shader","Tripipe: "+c,"cycles",d,k)}.bind(this))},arithSample:function(a,c,b,f){return this.hwcSample("mali:arith","Arith: "+a,c,b,f)},addArithCounter:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.arithSample(c,"count",d,k)}.bind(this))},addArithCycles:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.arithSample(c,"cycles",d,k)}.bind(this))},addLSCounter:function(a,c){this.importer.registerEventHandler(a,
function(a,b,g,d,k){return this.hwcSample("mali:ls","LS: "+c,"count",d,k)}.bind(this))},textureSample:function(a,c,b,f){return this.hwcSample("mali:texture","Texture: "+a,c,b,f)},addTexCounter:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.textureSample(c,"count",d,k)}.bind(this))},addLSCCounter:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.hwcSample("mali:lsc","LSC: "+c,"count",d,k)}.bind(this))},addAXICounter:function(a,c){this.importer.registerEventHandler(a,
function(a,b,g,d,k){return this.hwcSample("mali:axi","AXI: "+c,"count",d,k)}.bind(this))},mmuSample:function(a,c,b,f){return this.hwcSample("mali:mmu","MMU: "+a,c,b,f)},addMMUCounter:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.mmuSample(c,"count",d,k)}.bind(this))},addMMUCycles:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.mmuSample(c,"cycles",d,k)}.bind(this))},l2Sample:function(a,c,b,f){return this.hwcSample("mali:l2","L2: "+
a,c,b,f)},addL2Counter:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.l2Sample(c,"count",d,k)}.bind(this))},addL2Cycles:function(a,c){this.importer.registerEventHandler(a,function(a,b,g,d,k){return this.l2Sample(c,"cycles",d,k)}.bind(this))}};b.registerSubtype(d);return{MaliParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");base.require("tracing.trace_model.counter_series");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.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 b=tracing.importer.linux_perf.Parser;d.prototype={__proto__:b.prototype,cpuStateSlice:function(a,c,
b,f){c=this.importer.getOrCreateCpuState(c);"1"!=b?this.importer.importError("Don't understand power_start events of type "+b):(b=c.cpu.getOrCreateCounter("","C-State"),0===b.numSeries&&b.addSeries(new tracing.trace_model.CounterSeries("state",tracing.getStringColorId(b.name+".state"))),b.series.forEach(function(c){c.addSample(a,f)}))},cpuIdleSlice:function(a,c,b){c=this.importer.getOrCreateCpuState(c).cpu.getOrCreateCounter("","C-State");0===c.numSeries&&c.addSeries(new tracing.trace_model.CounterSeries("state",
tracing.getStringColorId(c.name)));var f=4294967295!=b?b:0;c.series.forEach(function(c){c.addSample(a,f)})},cpuFrequencySlice:function(a,c,b){c=this.importer.getOrCreateCpuState(c).cpu.getOrCreateCounter("","Clock Frequency");0===c.numSeries&&c.addSeries(new tracing.trace_model.CounterSeries("state",tracing.getStringColorId(c.name+".state")));c.series.forEach(function(c){c.addSample(a,b)})},powerStartEvent:function(a,c,b,f,g){a=/type=(\d+) state=(\d) cpu_id=(\d)+/.exec(g.details);if(!a)return!1;c=
parseInt(a[3]);b=parseInt(a[2]);this.cpuStateSlice(f,c,a[1],b);return!0},powerFrequencyEvent:function(a,c,b,f,g){c=/type=(\d+) state=(\d+) cpu_id=(\d)+/.exec(g.details);if(!c)return!1;a=parseInt(c[3]);c=parseInt(c[2]);this.cpuFrequencySlice(f,a,c);return!0},cpuFrequencyEvent:function(a,c,b,f,g){c=/state=(\d+) cpu_id=(\d)+/.exec(g.details);if(!c)return!1;a=parseInt(c[2]);c=parseInt(c[1]);this.cpuFrequencySlice(f,a,c);return!0},cpuIdleEvent:function(a,c,b,f,g){c=/state=(\d+) cpu_id=(\d)+/.exec(g.details);
if(!c)return!1;a=parseInt(c[2]);c=parseInt(c[1]);this.cpuIdleSlice(f,a,c);return!0}};b.registerSubtype(d);return{PowerParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.call(this,a);a.registerEventHandler("sched_switch",d.prototype.schedSwitchEvent.bind(this));a.registerEventHandler("sched_wakeup",d.prototype.schedWakeupEvent.bind(this))}var b=tracing.importer.linux_perf.Parser,a={},c=RegExp("prev_comm=(.+) prev_pid=(\\d+) prev_prio=(\\d+) prev_state=(\\S\\+?|\\S\\|\\S) ==> next_comm=(.+) next_pid=(\\d+) next_prio=(\\d+)");a.schedSwitchRE=c;var e=/comm=(.+) pid=(\d+) prio=(\d+) success=(\d+) target_cpu=(\d+)/;
a.schedWakeupRE=e;d.prototype={__proto__:b.prototype,schedSwitchEvent:function(a,b,e,d,l){var m=c.exec(l.details);if(!m)return!1;a=m[4];e=m[5];l=parseInt(m[6]);m=parseInt(m[7]);this.importer.getOrCreateCpuState(b).switchRunningLinuxPid(this.importer,a,d,l,e,m);return!0},schedWakeupEvent:function(a,c,b,d,l){l=e.exec(l.details);if(!l)return!1;a=b;c=l[1];b=parseInt(l[2]);l=parseInt(l[3]);this.importer.markPidRunnable(d,b,c,l,a);return!0}};b.registerSubtype(d);return{SchedParser:d,_SchedParserTestExports:a}});
"use strict";base.require("tracing.importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.call(this,a);a.registerEventHandler("sync_timeline",d.prototype.timelineEvent.bind(this));a.registerEventHandler("sync_wait",d.prototype.syncWaitEvent.bind(this));a.registerEventHandler("sync_pt",d.prototype.syncPtEvent.bind(this));this.model_=a.model_}var b=tracing.importer.linux_perf.Parser,a=/name=(\S+) value=(\S*)/,c=/(\S+) name=(\S+) state=(\d+)/,e=/name=(\S+) value=(\S*)/;d.prototype={__proto__:b.prototype,timelineEvent:function(c,
b,e,d,l){c=a.exec(l.details);if(!c)return!1;b=this.importer.getOrCreatePseudoThread(c[1]);void 0!==b.lastActiveTs&&(e=d-b.lastActiveTs,l=b.lastActiveValue,void 0==l&&(l=" "),e=new tracing.trace_model.Slice("",l,tracing.getStringColorId(l),b.lastActiveTs,{},e),b.thread.sliceGroup.pushSlice(e));b.lastActiveTs=d;b.lastActiveValue=c[2];return!0},syncWaitEvent:function(a,b,e,d,l){a=c.exec(l.details);if(!a||void 0===l.tgid)return!1;b=parseInt(l.tgid);e=this.model_.getOrCreateProcess(b).getOrCreateThread(e);
e.name=l.threadName;l=e.kernelSliceGroup;if(!l.isTimestampValidForBeginOrEnd(d))return this.model_.importErrors.push("Timestamps are moving backward."),!1;e='fence_wait("'+a[2]+'")';if("begin"==a[1])l.beginSlice(null,e,d,{"Start state":a[3]});else if("end"==a[1])0<l.openSliceCount&&l.endSlice(d);else return!1;return!0},syncPtEvent:function(a,c,b,d,l){return e.exec(l.details)?!0:!1}};b.registerSubtype(d);return{SyncParser:d}});"use strict";base.require("tracing.importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){b.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 b=tracing.importer.linux_perf.Parser,a=/work struct (.+): function (\S+)/,
c=/work struct (.+)/;d.prototype={__proto__:b.prototype,executeStartEvent:function(c,b,g,d,k){c=a.exec(k.details);if(!c)return!1;g=this.importer.getOrCreateKernelThread(k.threadName,g,g);g.openSliceTS=d;g.openSlice=c[2];return!0},executeEndEvent:function(a,b,g,d,k){if(!c.exec(k.details))return!1;a=this.importer.getOrCreateKernelThread(k.threadName,g,g);a.openSlice&&(d=new tracing.trace_model.Slice("",a.openSlice,tracing.getStringColorId(a.openSlice),a.openSliceTS,{},d-a.openSliceTS),a.thread.sliceGroup.pushSlice(d));
a.openSlice=void 0;return!0},executeQueueWork:function(a,c,b,d,k){return!0},executeActivateWork:function(a,c,b,d,k){return!0}};b.registerSubtype(d);return{WorkqueueParser:d}});"use strict";
base.exportTo("base",function(){function d(){}d.prototype={addEventListener:function(a,c){this.listeners_||(this.listeners_=Object.create(null));if(a in this.listeners_){var b=this.listeners_[a];0>b.indexOf(c)&&b.push(c)}else this.listeners_[a]=[c]},removeEventListener:function(a,c){if(this.listeners_&&a in this.listeners_){var b=this.listeners_[a],f=b.indexOf(c);0<=f&&(1==b.length?delete this.listeners_[a]:b.splice(f,1))}},dispatchEvent:function(a){if(!this.listeners_)return!0;var c=this;a.__defineGetter__("target",
function(){return c});a.preventDefault=function(){this.returnValue=!1};var b=a.type,f=0;if(b in this.listeners_)for(var b=this.listeners_[b].concat(),g=0,d;d=b[g];g++)f=d.handleEvent?f|!1===d.handleEvent.call(d,a):f|!1===d.call(this,a);return!f&&a.returnValue},hasEventListener:function(a){return void 0!==this.listeners_[a]}};var b={decorate:function(a){for(var c in b)if("decorate"!=c){var e=b[c];"function"===typeof e&&(a[c]=e)}a.listenerCounts_={}},addEventListener:function(a,c,b){this.__proto__.addEventListener.call(this,
a,c,b);void 0===this.listenerCounts_[a]&&(this.listenerCounts_[a]=0);this.listenerCounts_[a]++},removeEventListener:function(a,c,b){this.__proto__.removeEventListener.call(this,a,c,b);this.listenerCounts_[a]--},hasEventListener:function(a){return 0<this.listenerCounts_[a]}};return{EventTarget:d,EventTargetHelper:b}});"use strict";base.require("base.event_target");
base.exportTo("base",function(){function d(b,a,c){var e=base.doc.createEvent("Event");e.initEvent(b,!!a,!!c);e.__proto__=global.Event.prototype;return e}d.prototype={__proto__:global.Event.prototype};return{Event:d,dispatchSimpleEvent:function(b,a,c,e){a=new d(a,c,e);return b.dispatchEvent(a)}}});"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(b){b.isEmpty||(this.addValue(b.min),this.addValue(b.max))},addValue:function(b){this.isEmpty_?(this.min_=this.max_=b,this.isEmpty_=!1):(this.max_=Math.max(this.max_,b),this.min_=Math.min(this.min_,b))},get min(){return this.isEmpty_?void 0:this.min_},get max(){return this.isEmpty_?
void 0:this.max_},get range(){return this.isEmpty_?void 0:this.max_-this.min_},get center(){return 0.5*(this.min_+this.max_)}};d.compareByMinTimes=function(b,a){return b.isEmpty||a.isEmpty?b.isEmpty&&!a.isEmpty?-1:!b.isEmpty&&a.isEmpty?1:0:b.min_-a.min_};return{Range:d}});"use strict";
base.exportTo("tracing",function(){function d(){}function b(a){this.text_=a.toLowerCase()}function a(a){this.categories_={};a=a||[];for(var b=0;b<a.length;b++)this.addCategory(a[b])}d.prototype={__proto__:Object.prototype,matchCounter:function(a){return!0},matchCpu:function(a){return!0},matchProcess:function(a){return!0},matchSlice:function(a){return!0},matchThread:function(a){return!0}};b.prototype={__proto__:d.prototype,matchCounter:function(a){return 0===this.text_.length||void 0===a.name?!1:-1!==
a.name.toLowerCase().indexOf(this.text_)},matchSlice:function(a){return 0===this.text_.length||void 0===a.title?!1:-1!==a.title.toLowerCase().indexOf(this.text_)}};a.prototype={__proto__:d.prototype,addCategory:function(a){this.categories_[a]=!0},matchCounter:function(a){return a.category?!this.categories_[a.category]:!0},matchSlice:function(a){return a.category?!this.categories_[a.category]:!0}};return{filterCounterArray:function(a,b){if(void 0===a)return b;for(var f=[],g=0;g<b.length;++g)a.matchCounter(b[g])&&
f.push(b[g]);return f},filterSliceArray:function(a,b){if(void 0===a)return b;for(var f=[],g=0;g<b.length;++g)a.matchSlice(b[g])&&f.push(b[g]);return f},Filter:d,TitleFilter:b,CategoryFilter:a}});"use strict";base.require("base.guid");base.require("base.range");base.require("tracing.trace_model.counter_series");
base.exportTo("tracing.trace_model",function(){function d(b,a,c,e){this.guid_=base.GUID.allocate();this.parent=b;this.id=a;this.category=c||"";this.name=e;this.series_=[];this.bounds=new base.Range}d.prototype={__proto__:Object.prototype,get guid(){return this.guid_},toJSON:function(){for(var b={},a=Object.keys(this),c=0;c<a.length;c++){var e=a[c];"function"!=typeof this[e]&&(b[e]="parent"==e?this[e].guid:this[e])}return b},set timestamps(b){throw Error("Bad counter API. No cookie.");},set seriesNames(b){throw Error("Bad counter API. No cookie.");
},set seriesColors(b){throw Error("Bad counter API. No cookie.");},set samples(b){throw Error("Bad counter API. No cookie.");},addSeries:function(b){this.series_.push(b)},getSeries:function(b){return this.series_[b]},get series(){return this.series_},get numSeries(){return this.series_.length},get numSamples(){return 0===this.series_.length?0:this.series_[0].length},get timestamps(){return 0===this.series_.length?[]:this.series_[0].timestamps},getSampleStatistics:function(b){b.sort();var a=[];this.series_.forEach(function(c){a.push(c.getStatistics(b))});
return a},shiftTimestampsForward:function(b){for(var a=0;a<this.series_.length;++a)this.series_[a].shiftTimestampsForward(b)},updateBounds:function(){this.totals=[];this.maxTotal=0;this.bounds.reset();if(0!==this.series_.length){var b=this.series_[0],a=this.series_[this.series_.length-1];this.bounds.addValue(b.getTimestamp(0));this.bounds.addValue(a.getTimestamp(a.length-1));this.maxTotal=-Infinity;for(var c=0;c<b.length;++c){var e=0;this.series_.forEach(function(a){e+=a.getSample(c).value;this.totals.push(e)}.bind(this));
this.maxTotal=Math.max(e,this.maxTotal)}}}};d.compare=function(b,a){var c=b.parent.compareTo(a);if(0!=c)return c;c=b.name.localeCompare(a.name);return 0==c?b.tid-a.tid:c};return{Counter:d}});"use strict";base.exportTo("tracing.trace_model",function(){function d(b,a,c,e,f){this.category=b||"";this.title=a;this.colorId=c;this.start=e;this.args=f;this.didNotFinish=!1}d.prototype={selected:!1,duration:0,get end(){return this.start}};return{TraceModelEvent:d}});"use strict";base.require("tracing.trace_model.trace_model_event");
base.exportTo("tracing.trace_model",function(){function d(b,a,c,e,f,g){tracing.trace_model.TraceModelEvent.call(this,b,a,c,e,f);void 0!==g&&(this.duration=g)}d.prototype={__proto__:tracing.trace_model.TraceModelEvent.prototype,get end(){return this.start+this.duration}};return{Slice:d}});"use strict";base.require("base.range");base.require("tracing.trace_model.slice");base.require("tracing.trace_model.counter");
base.exportTo("tracing.trace_model",function(){function d(a){this.cpuNumber=a;this.slices=[];this.counters={};this.bounds=new base.Range}var b=tracing.trace_model.Counter;d.prototype={getOrCreateCounter:function(a,c){var e;e=a.length?a+"."+c:c;this.counters[e]||(this.counters[e]=new b(this,e,a,c));return this.counters[e]},shiftTimestampsForward:function(a){for(var c=0;c<this.slices.length;c++)this.slices[c].start+=a;for(var b in this.counters)this.counters[b].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 c=0;c<this.slices.length;c++)a[this.slices[c].category]=!0;for(var b in this.counters)a[this.counters[b].category]=!0}};d.compare=function(a,c){return a.cpuNumber-c.cpuNumber};return{Cpu:d}});"use strict";
base.exportTo("base",function(){function d(a,c,b){if(0==a.length)return 1;for(var f=0,g=a.length-1,d,k,l=-1;f<=g;)d=Math.floor((f+g)/2),k=c(a[d])-b,0>k?f=d+1:(0<k||(l=d),g=d-1);return-1!=l?l:f}function b(a,c,b,f,g,h){if(0!=a.length&&!(f>g)){var k=d(a,c,f);if(-1!=k&&(0<k&&c(a[k-1])+b(a[k-1],k-1)>=f&&h(a[k-1]),k!=a.length))for(b=a.length;k<b&&!(c(a[k])>=g);k++)h(a[k])}}return{findLowIndexInSortedArray:d,findLowIndexInSortedIntervals:function(a,c,b,f){var g=d(a,c,f);return 0==g?f>=c(a[0])&&f<c(a[0])+
b(a[0],0)?0:-1:g<a.length?f>=c(a[g])&&f<c(a[g])+b(a[g],g)?g:f>=c(a[g-1])&&f<c(a[g-1])+b(a[g-1],g-1)?g-1:a.length:g==a.length?f>=c(a[g-1])&&f<c(a[g-1])+b(a[g-1],g-1)?g-1:a.length:a.length},iterateOverIntersectingIntervals:b,getIntersectingIntervals:function(a,c,e,f,g){var d=[];b(a,c,e,f,g,function(a){d.push(a)});return d}}});"use strict";
base.exportTo("base",function(){function d(b,a){if(b instanceof Object)if(b instanceof Array)for(var c=0;c<b.length;c++)a(b,c,b[c]),d(b[c],a);else for(c in b){var e=b[c];a(b,c,e);d(e,a)}}return{asArray:function(b){for(var a=[],c=0;c<b.length;c++)a.push(b[c]);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},compareArrays:function(b,a,c){for(var e=Math.min(b.length,
a.length),f=0;f<e;f++){var g=c(b[f],a[f]);if(g)return g}return b.length==a.length?0:void 0===b[f]?-1:1},comparePossiblyUndefinedValues:function(b,a,c){return void 0!==b&&void 0!==a?c(b,a):void 0!==b?-1:void 0!==a?1:0},dictionaryKeys:function(b){var a=[],c;for(c in b)a.push(c);return a},dictionaryValues:function(b){var a=[],c;for(c in b)a.push(b[c]);return a},iterItems:function(b,a,c){c=c||this;for(var e in b)a.call(c,e,b[e])},iterObjectFieldsRecursively:d}});"use strict";base.require("base.iteration_helpers");
base.exportTo("base",function(){return{addSingletonGetter:function(d){d.getInstance=function(){return d.instance_||(d.instance_=new d)}},tracedFunction:function(d,b,a){return function(){console.time(b);try{d.apply(a,arguments)}finally{console.timeEnd(b)}}},normalizeException:function(d){return"string"==typeof d?{message:d,stack:["<unknown>"]}:{message:d.message,stack:d.stack?d.stack:["<unknown>"]}},instantiateTemplate:function(d){return document.querySelector(d).content.cloneNode(!0)},stackTrace:function(){var d=
Error().stack+"",d=d.split("\n");return d.slice(2)}}});"use strict";
base.exportTo("tracing.trace_model",function(){function d(b,a,c){this.objectInstance=b;this.ts=a;this.args=c;this.selected=!1}d.prototype={__proto__:Object.prototype,preInitialize:function(){},initialize:function(){}};d.nameToConstructorMap_={};d.register=function(b,a){if(d.nameToConstructorMap_[b])throw Error("Constructor already registerd for "+b);d.nameToConstructorMap_[b]=a};d.unregister=function(b){delete d.nameToConstructorMap_[b]};d.getConstructor=function(b){return d.nameToConstructorMap_[b]?
d.nameToConstructorMap_[b]:d};return{ObjectSnapshot:d}});"use strict";base.require("base.range");base.require("base.sorted_array_utils");base.require("tracing.trace_model.object_snapshot");
base.exportTo("tracing.trace_model",function(){function d(b,a,c,e,f){this.parent=b;this.id=a;this.category=c;this.name=e;this.creationTs=f;this.creationTsWasExplicit=!1;this.deletionTs=Number.MAX_VALUE;this.selected=this.deletionTsWasExplicit=!1;this.colorId=0;this.bounds=new base.Range;this.snapshots=[];this.hasImplicitSnapshots=!1}d.prototype={__proto__:Object.prototype,get typeName(){return this.name},addSnapshot:function(b,a){if(b<this.creationTs)throw Error("Snapshots must be >= instance.creationTs");
if(b>=this.deletionTs)throw Error("Snapshots cannot be added after an objects deletion timestamp.");var c;if(0<this.snapshots.length){c=this.snapshots[this.snapshots.length-1];if(c.ts==b)throw Error("Snapshots already exists at this time!");if(b<c.ts)throw Error("Snapshots must be added in increasing timestamp order");}c=new (tracing.trace_model.ObjectSnapshot.getConstructor(this.name))(this,b,a);this.snapshots.push(c);return c},wasDeleted:function(b){var a;if(0<this.snapshots.length&&(a=this.snapshots[this.snapshots.length-
1],a.ts>b))throw Error("Instance cannot be deleted at ts="+b+". A snapshot exists that is older.");this.deletionTs=b;this.deletionTsWasExplicit=!0},preInitialize:function(){for(var b=0;b<this.snapshots.length;b++)this.snapshots[b].preInitialize()},initialize:function(){for(var b=0;b<this.snapshots.length;b++)this.snapshots[b].initialize()},getSnapshotAt:function(b){if(b<this.creationTs){if(this.creationTsWasExplicit)throw Error("ts must be within lifetime of this instance");return this.snapshots[0]}if(b>
this.deletionTs)throw Error("ts must be within lifetime of this instance");var a=this.snapshots;b=base.findLowIndexInSortedIntervals(a,function(a){return a.ts},function(c,b){return b==a.length-1?a[b].objectInstance.deletionTs:a[b+1].ts-a[b].ts},b);return 0>b?this.snapshots[0]:b>=this.snapshots.length?this.snapshots[this.snapshots.length-1]:this.snapshots[b]},updateBounds:function(){this.bounds.reset();this.bounds.addValue(this.creationTs);this.deletionTs!=Number.MAX_VALUE?this.bounds.addValue(this.deletionTs):
0<this.snapshots.length&&this.bounds.addValue(this.snapshots[this.snapshots.length-1].ts)},shiftTimestampsForward:function(b){this.creationTs+=b;this.deletionTs!=Number.MAX_VALUE&&(this.deletionTs+=b);this.snapshots.forEach(function(a){a.ts+=b})}};d.nameToConstructorMap_={};d.register=function(b,a){if(d.nameToConstructorMap_[b])throw Error("Constructor already registerd for "+b);d.nameToConstructorMap_[b]=a};d.unregister=function(b){delete d.nameToConstructorMap_[b]};d.getConstructor=function(b){return d.nameToConstructorMap_[b]?
d.nameToConstructorMap_[b]:d};return{ObjectInstance:d}});"use strict";base.require("base.range");base.require("base.sorted_array_utils");
base.exportTo("tracing.trace_model",function(){function d(b,a,c){this.createObjectInstanceFunction_=b;this.parent=a;this.id=c;this.instances=[]}d.prototype={idWasCreated:function(b,a,c){if(0==this.instances.length)return this.instances.push(this.createObjectInstanceFunction_(this.parent,this.id,b,a,c)),this.instances[0].creationTsWasExplicit=!0,this.instances[0];var e=this.instances[this.instances.length-1];if(c<e.deletionTs)throw Error("Mutation of the TimeToObjectInstanceMap must be done in ascending timestamp order.");
e=this.createObjectInstanceFunction_(this.parent,this.id,b,a,c);e.creationTsWasExplicit=!0;this.instances.push(e);return e},addSnapshot:function(b,a,c,e){0==this.instances.length&&this.instances.push(this.createObjectInstanceFunction_(this.parent,this.id,b,a,c));var f=base.findLowIndexInSortedIntervals(this.instances,function(a){return a.creationTs},function(a){return a.deletionTs-a.creationTs},c);if(0>f){f=this.instances[0];if(c>f.deletionTs||f.creationTsWasExplicit)throw Error("At the provided timestamp, no instance was still alive");
if(0!=f.snapshots.length)throw Error("Cannot shift creationTs forward, snapshots have been added. First snap was at ts="+f.snapshots[0].ts+" and creationTs was "+f.creationTs);f.creationTs=c}else if(f>=this.instances.length)if(f=this.instances[this.instances.length-1],c>=f.deletionTs)f=this.createObjectInstanceFunction_(this.parent,this.id,b,a,c),this.instances.push(f);else{for(var g,f=this.instances.length-1;0<=f;f--){b=this.instances[f];if(c>=b.deletionTs)break;!1==b.creationTsWasExplicit&&0==b.snapshots.length&&
(g=f)}if(void 0===g)throw Error("Cannot add snapshot. No instance was alive that was mutable.");f=this.instances[g];f.creationTs=c}else f=this.instances[f];return f.addSnapshot(c,e)},get lastInstance(){return 0==this.instances.length?void 0:this.instances[this.instances.length-1]},idWasDeleted:function(b,a,c){0==this.instances.length&&this.instances.push(this.createObjectInstanceFunction_(this.parent,this.id,b,a,c));var e=this.instances[this.instances.length-1];if(c<e.creationTs)throw Error("Cannot delete a id before it was crated");
if(e.deletionTs==Number.MAX_VALUE)return e.wasDeleted(c),e;if(c<e.deletionTs)throw Error("id was already deleted earlier.");e=this.createObjectInstanceFunction_(this.parent,this.id,b,a,c);this.instances.push(e);return e},getInstanceAt:function(b){b=base.findLowIndexInSortedIntervals(this.instances,function(a){return a.creationTs},function(a){return a.deletionTs-a.creationTs},b);return 0>b?this.instances[0].creationTsWasExplicit?void 0:this.instances[0]:b>=this.instances.length?void 0:this.instances[b]}};
return{TimeToObjectInstanceMap:d}});"use strict";base.require("base.utils");base.require("base.range");base.require("base.sorted_array_utils");base.require("tracing.trace_model.object_instance");base.require("tracing.trace_model.time_to_object_instance_map");
base.exportTo("tracing.trace_model",function(){function d(b){this.parent=b;this.bounds=new base.Range;this.instanceMapsById_={};this.instancesByTypeName_={};this.createObjectInstance_=this.createObjectInstance_.bind(this)}d.prototype={__proto__:Object.prototype,createObjectInstance_:function(b,a,c,e,f){b=new (tracing.trace_model.ObjectInstance.getConstructor(e))(b,a,c,e,f);a=b.typeName;c=this.instancesByTypeName_[a];c||(c=[],this.instancesByTypeName_[a]=c);c.push(b);return b},getOrCreateInstanceMap_:function(b){var a=
this.instanceMapsById_[b];if(a)return a;a=new tracing.trace_model.TimeToObjectInstanceMap(this.createObjectInstance_,this.parent,b);return this.instanceMapsById_[b]=a},idWasCreated:function(b,a,c,e){return this.getOrCreateInstanceMap_(b).idWasCreated(a,c,e)},addSnapshot:function(b,a,c,e,f){b=this.getOrCreateInstanceMap_(b,a,c,e).addSnapshot(a,c,e,f);if(b.objectInstance.category!=a)throw Error("Added snapshot with different category than when it was created");if(b.objectInstance.name!=c)throw Error("Added snapshot with different name than when it was created");
return b},idWasDeleted:function(b,a,c,e){if(b=this.getOrCreateInstanceMap_(b,a,c,e).idWasDeleted(a,c,e)){if(b.category!=a)throw Error("Deleting an object with a different category than when it was created");if(b.name!=c)throw Error("Deleting an object with a different name than when it was created");}},autoDeleteObjects:function(b){base.iterItems(this.instanceMapsById_,function(a,c){var e=c.lastInstance;e.deletionTs==Number.MAX_VALUE&&(c.idWasDeleted(e.category,e.name,b),e.deletionTsWasExplicit=!1)})},
getObjectInstanceAt:function(b,a){var c=this.instanceMapsById_[b];return c?c.getInstanceAt(a):void 0},getSnapshotAt:function(b,a){var c=this.getObjectInstanceAt(b,a);return c?c.getSnapshotAt(a):void 0},iterObjectInstances:function(b,a){a=a||this;base.iterItems(this.instanceMapsById_,function(c,e){e.instances.forEach(b,a)})},getAllObjectInstances:function(){var b=[];this.iterObjectInstances(function(a){b.push(a)});return b},getAllInstancesNamed:function(b){return this.instancesByTypeName_[b]},getAllInstancesByTypeName:function(){return this.instancesByTypeName_},
preInitializeAllObjects:function(){this.iterObjectInstances(function(b){b.preInitialize()})},initializeAllObjects:function(){this.iterObjectInstances(function(b){b.initialize()})},initializeInstances:function(){this.iterObjectInstances(function(b){b.initialize()})},updateBounds:function(){this.bounds.reset();this.iterObjectInstances(function(b){b.updateBounds();this.bounds.addRange(b.bounds)},this)},shiftTimestampsForward:function(b){this.iterObjectInstances(function(a){a.shiftTimestampsForward(b)})},
addCategoriesToDict:function(b){this.iterObjectInstances(function(a){b[a.category]=!0})},toJSON:function(){return{}}};return{ObjectCollection:d}});"use strict";base.require("tracing.trace_model.slice");
base.exportTo("tracing.trace_model",function(){function d(b,a,c,e,f){tracing.trace_model.Slice.apply(this,arguments)}d.prototype={__proto__:tracing.trace_model.Slice.prototype,toJSON:function(){for(var b={},a=Object.keys(this),c=0;c<a.length;c++){var e=a[c];"function"!=typeof this[e]&&(b[e]="startThread"==e||"endThread"==e?this[e].guid:this[e])}return b},id:void 0,startThread:void 0,endThread:void 0,subSlices:void 0};return{AsyncSlice:d}});"use strict";base.require("base.range");base.require("tracing.trace_model.async_slice");
base.exportTo("tracing.trace_model",function(){function d(){this.slices=[];this.bounds=new base.Range}d.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 c=this.slices[a];c.start+=b;for(var e=0;e<c.subSlices.length;e++)c.subSlices[e].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 c=this.slices[a],e=c.startThread.guid;b[e]||(b[e]=new d);b[e].slices.push(c)}var a=[],f;for(f in b)c=b[f],c.updateBounds(),a.push(c);return a}};return{AsyncSliceGroup:d}});"use strict";base.require("tracing.trace_model.trace_model_event");
base.exportTo("tracing.trace_model",function(){function d(b,a,c,e,f){tracing.trace_model.TraceModelEvent.apply(this,arguments)}d.prototype={__proto__:tracing.trace_model.TraceModelEvent.prototype};return{Sample:d}});"use strict";base.require("base.range");base.require("tracing.trace_model.slice");base.require("tracing.color_scheme");base.require("tracing.filter");
base.exportTo("tracing.trace_model",function(){function d(a){this.sliceConstructor=a||b;this.openPartialSlices_=[];this.slices=[];this.bounds=new base.Range}var b=tracing.trace_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)},pushInstantEvent:function(a){this.slices.push(a)},beginSlice:function(a,c,b,f){if(this.openPartialSlices_.length&&b<this.openPartialSlices_[this.openPartialSlices_.length-
1].start)throw Error("Slices must be added in increasing timestamp order");var g=tracing.getStringColorId(c);a=new this.sliceConstructor(a,c,g,b,f?f:{});this.openPartialSlices_.push(a);return a},isTimestampValidForBeginOrEnd:function(a){return this.openPartialSlices_.length?a>=this.openPartialSlices_[this.openPartialSlices_.length-1].start:!0},get openSliceCount(){return this.openPartialSlices_.length},get mostRecentlyOpenedPartialSlice(){return this.openPartialSlices_.length?this.openPartialSlices_[this.openPartialSlices_.length-
1]:void 0},endSlice:function(a){if(!this.openSliceCount)throw Error("endSlice called without an open slice");var c=this.openPartialSlices_[this.openSliceCount-1];this.openPartialSlices_.splice(this.openSliceCount-1,1);if(a<c.start)throw Error("Slice "+c.title+" end time is before its start.");c.duration=a-c.start;this.pushSlice(c);return c},autoCloseOpenSlices:function(a){a||(this.updateBounds(),a=this.bounds.max);for(;0<this.openSliceCount;)this.endSlice(a).didNotFinish=!0},shiftTimestampsForward:function(a){for(var c=
0;c<this.slices.length;c++){var b=this.slices[c];b.start+=a}for(c=0;c<this.openPartialSlices_.length;c++)b=this.openPartialSlices_[i],b.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 c=
new this.sliceConstructor(a.category,a.title,a.colorId,a.start,a.args,a.duration);c.didNotFinish=a.didNotFinish;return c}};d.merge=function(a,c){if(0<a.openPartialSlices_.length)throw Error("groupA has open partial slices");if(0<c.openPartialSlices_.length)throw Error("groupB has open partial slices");for(var b=new d,f=a.slices,g=c.slices,h=f.length-1,k=g.length-1,l=[],m=[],n=function(a){for(var c=0;c<m.length;c++){var f=m[c],g=f.end;if(a<f.start||g<a)throw Error("slice should not be split");var d=
b.copySlice(f);f.start=a;f.duration=g-a;f.title+=" (cont.)";d.duration=a-d.start;m[c]=d;b.pushSlice(d)}},p=function(a){for(;0<l.length||0<m.length;){var c=l[l.length-1],b=m[m.length-1],c=c&&c.start,b=b&&b.start;if((void 0===c||c<a)&&(void 0===b||b<a))break;void 0===b||c>b?(n(c),l.pop()):m.pop()}};0<=h||0<=k;){var q=f[h],t=g[k];void 0===q||void 0!==t&&q.end<t.end?(q=b.copySlice(t),t=!0,k--):(q=b.copySlice(q),t=!1,h--);p(q.end);b.pushSlice(q);t?m.push(q):(n(q.end),l.push(q))}p();b.slices.reverse();
return b};return{SliceGroup:d}});"use strict";base.require("base.guid");base.require("base.range");base.require("tracing.trace_model.slice");base.require("tracing.trace_model.slice_group");base.require("tracing.trace_model.async_slice_group");base.require("tracing.trace_model.sample");
base.exportTo("tracing.trace_model",function(){function d(c,b,e,d,l,m){a.call(this,c,b,e,d,l,m);this.subSlices=[]}function b(a,b){this.guid_=base.GUID.allocate();if(!a)throw Error("Parent must be provided.");this.parent=a;this.sortIndex=0;this.tid=b;this.sliceGroup=new c(d);this.cpuSlices=void 0;this.samples_=[];this.kernelSliceGroup=new c;this.asyncSliceGroup=new e;this.bounds=new base.Range;this.ephemeralSettings={}}var a=tracing.trace_model.Slice,c=tracing.trace_model.SliceGroup,e=tracing.trace_model.AsyncSliceGroup;
d.prototype={__proto__:a.prototype};b.prototype={get guid(){return this.guid_},compareTo:function(a){return b.compare(this,a)},toJSON:function(){for(var a={},c=Object.keys(this),b=0;b<c.length;b++){var e=c[b];"function"!=typeof this[e]&&(a[e]="parent"==e?this[e].guid:this[e])}return a},addSample:function(a,c,b,e){if(this.samples_.length&&b<this.samples_[this.samples_.length-1].start)throw Error("Samples must be added in increasing timestamp order.");var d=tracing.getStringColorId(c);a=new tracing.trace_model.Sample(a,
c,d,b,e?e:{});this.samples_.push(a);return a},get samples(){return this.samples_},name:void 0,shiftTimestampsForward:function(a){this.sliceGroup.shiftTimestampsForward(a);if(this.cpuSlices)for(var c=0;c<this.cpuSlices.length;c++)this.cpuSlices[c].start+=a;if(this.samples_.length)for(c=0;c<this.samples_.length;c++)this.samples_[c].start+=a;this.kernelSliceGroup.shiftTimestampsForward(a);this.asyncSliceGroup.shiftTimestampsForward(a)},get isEmpty(){return this.sliceGroup.length||this.sliceGroup.openSliceCount||
this.cpuSlices&&this.cpuSlices.length||this.kernelSliceGroup.length||this.asyncSliceGroup.length||this.samples_.length?!1:!0},updateBounds:function(){this.bounds.reset();this.sliceGroup.updateBounds();this.bounds.addRange(this.sliceGroup.bounds);this.kernelSliceGroup.updateBounds();this.bounds.addRange(this.kernelSliceGroup.bounds);this.asyncSliceGroup.updateBounds();this.bounds.addRange(this.asyncSliceGroup.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(a){for(var c=0;c<this.sliceGroup.length;c++)a[this.sliceGroup.slices[c].category]=!0;for(c=0;c<this.kernelSliceGroup.length;c++)a[this.kernelSliceGroup.slices[c].category]=!0;for(c=0;c<this.asyncSliceGroup.length;c++)a[this.asyncSliceGroup.slices[c].category]=!0;for(c=0;c<
this.samples_.length;c++)a[this.samples_[c].category]=!0},autoCloseOpenSlices:function(a){this.sliceGroup.autoCloseOpenSlices(a);this.kernelSliceGroup.autoCloseOpenSlices(a)},mergeKernelWithUserland:function(){if(0<this.kernelSliceGroup.length){var a=c.merge(this.sliceGroup,this.kernelSliceGroup);this.sliceGroup.slices=a.slices;this.kernelSliceGroup=new c;this.updateBounds()}},get userFriendlyName(){return this.name||this.tid},get userFriendlyDetails(){return"tid: "+this.tid+(this.name?", name: "+
this.name:"")},getSettingsKey:function(){if(this.name){var a=this.parent.getSettingsKey();return a?a+"."+this.name:void 0}}};b.compare=function(a,c){var b=a.parent.compareTo(c.parent);return b||(b=a.sortIndex-c.sortIndex)?b:(b=base.comparePossiblyUndefinedValues(a.name,c.name,function(a,c){return a.localeCompare(c)}))?b:a.tid-c.tid};return{ThreadSlice:d,Thread:b}});"use strict";
base.exportTo("base",function(){function d(){return d}var b=localStorage;d.get=function(a,c,e){a=d.namespace_(a,e);var f=b.getItem(a);if(null===f||void 0===f)return c;try{return JSON.parse(f).value}catch(g){return b.removeItem(d.namespace_(a,e)),c}};d.set=function(a,c,e){if(void 0===c)throw Error("Settings.set: value must not be undefined");c=JSON.stringify({value:c});b.setItem(d.namespace_(a,e),c)};d.keys=function(a){var c=[];a=a||"";for(var e=0;e<b.length;e++){var f=b.key(e);d.isnamespaced_(f,a)&&
c.push(d.unnamespace_(f,a))}return c};d.isnamespaced_=function(a,c){return 0==a.indexOf(d.normalize_(c))};d.namespace_=function(a,c){return d.normalize_(c)+a};d.unnamespace_=function(a,c){return a.replace(d.normalize_(c),"")};d.normalize_=function(a){return d.NAMESPACE+(a?a+".":"")};d.setAlternativeStorageInstance=function(a){b=a};d.getAlternativeStorageInstance=function(){return b===localStorage?void 0:b};d.NAMESPACE="trace-viewer";return{Settings:d}});"use strict";base.require("base.settings");
base.exportTo("tracing",function(){function d(a){this.model=a;this.objectsByKey_=[];this.nonuniqueKeys_=[];this.buildObjectsByKeyMap_();this.removeNonuniqueKeysFromSettings_()}var b=base.Settings;d.prototype={buildObjectsByKeyMap_:function(){var a=[this.model.kernel];a.push.apply(a,base.dictionaryValues(this.model.processes));a.push.apply(a,this.model.getAllThreads());for(var c={},b=0;b<a.length;b++){var f=a[b],g=f.getSettingsKey();g&&(c[g]=void 0===c[g]?f:"nonuniqueKey")}var d={};base.dictionaryKeys(c).forEach(function(a){"nonuniqueKey"===
c[a]&&(delete c[a],d[a]=!0)});this.nonuniqueKeys=d;this.objectsByKey_=c},removeNonuniqueKeysFromSettings_:function(){var a=b.get("trace_model_settings",{}),c=!1;base.dictionaryKeys(a).forEach(function(b){this.nonuniqueKeys[b]&&(c=!0,delete a[b])},this);c&&b.set("trace_model_settings",a)},hasUniqueSettingKey:function(a){return(a=a.getSettingsKey())?void 0!==this.objectsByKey_[a]:!1},getSettingFor:function(a,c,e){var f=a.getSettingsKey();if(!f||!this.objectsByKey_[f])return c=a.ephemeralSettings[c],
void 0!==c?c:e;a=b.get("trace_model_settings",{});a[f]||(a[f]={});c=a[f][c];return void 0!==c?c:e},setSettingFor:function(a,c,e){var f=a.getSettingsKey();f&&this.objectsByKey_[f]?(a=b.get("trace_model_settings",{}),a[f]||(a[f]={}),a[f][c]=e,b.set("trace_model_settings",a)):a.ephemeralSettings[c]=e}};return{TraceModelSettings:d}});"use strict";base.require("base.guid");base.require("base.range");base.require("tracing.trace_model.counter");base.require("tracing.trace_model.object_collection");base.require("tracing.trace_model.thread");
base.require("tracing.trace_model_settings");
base.exportTo("tracing.trace_model",function(){function d(a){if(!a)throw Error("Must provide a model");this.guid_=base.GUID.allocate();this.model=a;this.threads={};this.counters={};this.objects=new tracing.trace_model.ObjectCollection(this);this.bounds=new base.Range;this.sortIndex=0;this.ephemeralSettings={}}var b=tracing.trace_model.Thread,a=tracing.trace_model.Counter;d.compare=function(a,b){return a.sortIndex-b.sortIndex};d.prototype={get guid(){return this.guid_},get numThreads(){var a=0,b;for(b in this.threads)a++;
return a},toJSON:function(){for(var a={},b=Object.keys(this),f=0;f<b.length;f++){var g=b[f];"function"!=typeof this[g]&&"model"!=g&&(a[g]=this[g])}return a},shiftTimestampsForward:function(a){for(var b in this.threads)this.threads[b].shiftTimestampsForward(a);for(var f in this.counters)this.counters[f].shiftTimestampsForward(a);this.objects.shiftTimestampsForward(a)},autoCloseOpenSlices:function(a){for(var b in this.threads)this.threads[b].autoCloseOpenSlices(a)},autoDeleteObjects:function(a){this.objects.autoDeleteObjects(a)},
preInitializeObjects:function(){this.objects.preInitializeAllObjects()},initializeObjects:function(){this.objects.initializeAllObjects()},mergeKernelWithUserland:function(){for(var a in this.threads)this.threads[a].mergeKernelWithUserland()},updateBounds:function(){this.bounds.reset();for(var a in this.threads)this.threads[a].updateBounds(),this.bounds.addRange(this.threads[a].bounds);for(var b in this.counters)this.counters[b].updateBounds(),this.bounds.addRange(this.counters[b].bounds);this.objects.updateBounds();
this.bounds.addRange(this.objects.bounds)},addCategoriesToDict:function(a){for(var b in this.threads)this.threads[b].addCategoriesToDict(a);for(var f in this.counters)a[this.counters[f].category]=!0;this.objects.addCategoriesToDict(a)},findAllThreadsNamed:function(a){var b=[],f;for(f in this.threads){var g=this.threads[f];g.name==a&&b.push(g)}return b},pruneEmptyContainers:function(){var a={},b;for(b in this.threads){var f=this.threads[b];f.isEmpty||(a[b]=f)}this.threads=a},getOrCreateThread:function(a){this.threads[a]||
(this.threads[a]=new b(this,a));return this.threads[a]},getOrCreateCounter:function(c,b){var f=c+"."+b;this.counters[f]||(this.counters[f]=new a(this,f,c,b));return this.counters[f]},getSettingsKey:function(){throw Error("Not implemented");}};return{ProcessBase:d}});"use strict";base.require("tracing.trace_model.cpu");base.require("tracing.trace_model.process_base");
base.exportTo("tracing.trace_model",function(){function d(c){if(void 0===c)throw Error("model must be provided");a.call(this,c);this.cpus={}}var b=tracing.trace_model.Cpu,a=tracing.trace_model.ProcessBase;d.compare=function(a,b){return 0};d.prototype={__proto__:a.prototype,compareTo:function(a){return d.compare(this,a)},get userFriendlyName(){return"Kernel"},get userFriendlyDetails(){return"Kernel"},getOrCreateCpu:function(a){this.cpus[a]||(this.cpus[a]=new b(a));return this.cpus[a]},shiftTimestampsForward:function(c){a.prototype.shiftTimestampsForward.call(this);
for(var b in this.cpus)this.cpus[b].shiftTimestampsForward(c)},updateBounds:function(){a.prototype.updateBounds.call(this);for(var c in this.cpus){var b=this.cpus[c];b.updateBounds();this.bounds.addRange(b.bounds)}},addCategoriesToDict:function(c){a.prototype.addCategoriesToDict.call(this,c);for(var b in this.cpus)this.cpus[b].addCategoriesToDict(c)},getSettingsKey:function(){return"kernel"}};return{Kernel:d}});"use strict";base.require("tracing.trace_model.process_base");
base.exportTo("tracing.trace_model",function(){function d(b,a){if(void 0===b)throw Error("model must be provided");if(void 0===a)throw Error("pid must be provided");tracing.trace_model.ProcessBase.call(this,b);this.pid=a;this.name=void 0;this.labels=[];this.instantEvents=[]}d.compare=function(b,a){var c=tracing.trace_model.ProcessBase.compare(b,a);return c||(c=base.comparePossiblyUndefinedValues(b.name,a.name,function(a,c){return a.localeCompare(c)}))?c:(c=base.compareArrays(b.labels,a.labels,function(a,
c){return a.localeCompare(c)}))?c:b.pid-a.pid};d.prototype={__proto__:tracing.trace_model.ProcessBase.prototype,compareTo:function(b){return d.compare(this,b)},pushInstantEvent:function(b){this.instantEvents.push(b)},get userFriendlyName(){var b;b=this.name?this.name:"Process "+this.pid;this.labels.length&&(b+=": "+this.labels.join(", "));return b},get userFriendlyDetails(){return this.name?this.name+" (pid "+this.pid+")":"pid: "+this.pid},getSettingsKey:function(){return this.name?this.labels.length?
"processes."+this.name+"."+this.labels.join("."):"processes."+this.name:void 0},shiftTimestampsForward:function(b){for(var a in this.instantEvents)this.instantEvents[a].start+=b;tracing.trace_model.ProcessBase.prototype.shiftTimestampsForward.apply(this,arguments)}};return{Process:d}});"use strict";base.require("base.range");base.require("base.events");base.require("tracing.trace_model.process");base.require("tracing.trace_model.kernel");base.require("tracing.filter");
base.exportTo("tracing",function(){function d(a,b){this.kernel=new c(this);this.processes={};this.importErrors=[];this.metadata=[];this.categories=[];this.bounds=new base.Range;this.instantEvents=[];a&&this.importTraces([a],b)}function b(a){this.importPriority=0}var a=tracing.trace_model.Process,c=tracing.trace_model.Kernel;d.importerConstructors_=[];d.registerImporter=function(a){d.importerConstructors_.push(a)};d.prototype={__proto__:base.EventTarget.prototype,get numProcesses(){var a=0,c;for(c in this.processes)a++;
return a},getOrCreateProcess:function(c){this.processes[c]||(this.processes[c]=new a(this,c));return this.processes[c]},pushInstantEvent:function(a){this.instantEvents.push(a)},updateCategories_:function(){var a={};this.kernel.addCategoriesToDict(a);for(var c in this.processes)this.processes[c].addCategoriesToDict(a);this.categories=[];for(var b in a)""!=b&&this.categories.push(b)},updateBounds:function(){this.bounds.reset();this.kernel.updateBounds();this.bounds.addRange(this.kernel.bounds);for(var a in this.processes)this.processes[a].updateBounds(),
this.bounds.addRange(this.processes[a].bounds)},shiftWorldToZero:function(){if(!this.bounds.isEmpty){var a=this.bounds.min;this.kernel.shiftTimestampsForward(-a);for(var c in this.instantEvents)this.instantEvents[c].start-=a;for(var b in this.processes)this.processes[b].shiftTimestampsForward(-a);this.updateBounds()}},getAllThreads:function(){var a=[],c;for(c in this.kernel.threads)a.push(d.threads[c]);for(var b in this.processes){var d=this.processes[b];for(c in d.threads)a.push(d.threads[c])}return a},
getAllProcesses:function(){var a=[],c;for(c in this.processes)a.push(this.processes[c]);return a},getAllCounters:function(){var a=[];a.push.apply(a,base.dictionaryValues(this.kernel.counters));for(var c in this.processes){var b=this.processes[c],d;for(d in b.counters)a.push(b.counters[d])}return a},findAllThreadsNamed:function(a){var c=[];c.push.apply(c,this.kernel.findAllThreadsNamed(a));for(var b in this.processes)c.push.apply(c,this.processes[b].findAllThreadsNamed(a));return c},createImporter_:function(a){for(var c,
b=0;b<d.importerConstructors_.length;++b)if(d.importerConstructors_[b].canImport(a)){c=d.importerConstructors_[b];break}if(!c)throw Error("Could not find an importer for the provided eventData.");return new c(this,a)},importTraces:function(a,c,b){void 0===c&&(c=!0);void 0===b&&(b=!0);a=a.slice(0);for(var d=[],k=0;k<a.length;++k)d.push(this.createImporter_(a[k]));for(k=0;k<d.length;k++){var l=d[k].extractSubtrace();l&&(a.push(l),d.push(this.createImporter_(l)))}d.sort(function(a,c){return a.importPriority-
c.importPriority});for(k=0;k<d.length;k++)d[k].importEvents(0<k);this.updateBounds();this.kernel.autoCloseOpenSlices(this.bounds.max);for(var m in this.processes)this.processes[m].autoCloseOpenSlices(this.bounds.max);for(k=0;k<d.length;k++)d[k].finalizeImport();for(m in this.processes)this.processes[m].preInitializeObjects();if(b)for(m in this.kernel.pruneEmptyContainers(),this.processes)this.processes[m].pruneEmptyContainers();for(m in this.processes)this.processes[m].mergeKernelWithUserland();this.updateBounds();
this.updateCategories_();c&&this.shiftWorldToZero();for(k=0;k<d.length;k++)d[k].joinRefs();for(m in this.processes)this.processes[m].autoDeleteObjects(this.bounds.max);for(m in this.processes)this.processes[m].initializeObjects()}};b.canImport=function(a){return a instanceof Array&&0==a.length?!0:"string"===typeof a||a instanceof String?0==a.length:!1};b.prototype={__proto__:Object.prototype,extractSubtrace:function(){},importEvents:function(){},finalizeImport:function(){},joinRefs:function(){}};
d.registerImporter(b);return{TraceModel:d}});"use strict";base.require("tracing.trace_model");base.require("tracing.color_scheme");base.require("tracing.importer.linux_perf.bus_parser");base.require("tracing.importer.linux_perf.clock_parser");base.require("tracing.importer.linux_perf.cpufreq_parser");base.require("tracing.importer.linux_perf.disk_parser");base.require("tracing.importer.linux_perf.drm_parser");base.require("tracing.importer.linux_perf.exynos_parser");base.require("tracing.importer.linux_perf.gesture_parser");
base.require("tracing.importer.linux_perf.i915_parser");base.require("tracing.importer.linux_perf.mali_parser");base.require("tracing.importer.linux_perf.power_parser");base.require("tracing.importer.linux_perf.sched_parser");base.require("tracing.importer.linux_perf.sync_parser");base.require("tracing.importer.linux_perf.workqueue_parser");base.require("tracing.importer.linux_perf.android_parser");base.require("tracing.importer.linux_perf.kfunc_parser");
base.exportTo("tracing.importer",function(){function d(a){this.cpu=a}function b(a,c){this.importPriority=2;this.model_=a;this.events_=c;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"{"==a[0]?!1:e.test(a)?f:g.test(a)?h:k.test(a)?l:null}d.prototype={__proto__:Object.prototype,switchRunningLinuxPid:function(a,
c,b,e,f,g){if(void 0!==this.lastActivePid&&0!=this.lastActivePid){var d=b-this.lastActiveTs;a=(a=a.threadsByLinuxPid[this.lastActivePid])?a.userFriendlyName:this.lastActiveComm;c=new tracing.trace_model.Slice("",a,tracing.getStringColorId(a),this.lastActiveTs,{comm:this.lastActiveComm,tid:this.lastActivePid,prio:this.lastActivePrio,stateWhenDescheduled:c},d);this.cpu.slices.push(c)}this.lastActiveTs=b;this.lastActivePid=e;this.lastActiveComm=f;this.lastActivePrio=g}};var c={},e=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=e.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]}};c.lineParserWithTGID=f;var g=/^\s*(.+)-(\d+)\s+\[(\d+)\]\s+[dX.][N.][Hhs.][0-9a-f.]\s+(\d+\.\d+):\s+(\S+):\s(.*)$/,h=function(a){return(a=g.exec(a))?{threadName:a[1],pid:a[2],cpuNumber:a[3],timestamp:a[4],eventName:a[5],details:a[6]}:a};c.lineParserWithIRQInfo=h;var k=/^\s*(.+)-(\d+)\s+\[(\d+)\]\s*(\d+\.\d+):\s+(\S+):\s(.*)$/,
l=function(a){return(a=k.exec(a))?{threadName:a[1],pid:a[2],cpuNumber:a[3],timestamp:a[4],eventName:a[5],details:a[6]}:a};c.lineParserWithLegacyFmt=l;c.traceEventClockSyncRE=/trace_event_clock_sync: parent_ts=(\d+\.?\d*)/;c.autoDetectLineParser=a;b.canImport=function(c){if(!("string"===typeof c||c instanceof String))return!1;if(b._extractEventsFromSystraceHTML(c,!1).ok||/^# tracer:/.test(c))return!0;var e=/^(.+)\n/.exec(c);e&&(c=e[1]);return a(c)?!0:!1};b._extractEventsFromSystraceHTML=function(a,
c){function b(a){for(;d<g.length;d++)if(a.test(g[d]))return!0;return!1}function e(a,c){return-1===a.indexOf(c,a.length-c.length)?a:a.substring(a,a.length-c.length)}var f={ok:!1};void 0===c&&(c=!0);if(!1==/^<!DOCTYPE HTML>/.test(a))return f;var g=a.split("\n"),d=1;if(!b(/^  <script>$/)||!b(/^  var linuxPerfData = "\\$/))return f;var h=d+1;if(!b(/^  <\/script>$/))return f;var k=d;if(!b(/^<\/body>$/)||!b(/^<\/html>$/))return f;var l=g.slice(h,k),k=[];if(c)for(var x=0;x<l.length;x++){var y=l[x],y=e(y,
"\\n\\");k.push(y)}else k=[l[l.length-1]];l=k[k.length-1];x=e(l,'\\n";');if(x==l)return f;k[k.length-1]=x;return{ok:!0,lines:c?k:void 0,events_begin_at_line:h}};b.prototype={__proto__:Object.prototype,extractSubtrace:function(){},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 c=this.model_.kernel.getOrCreateCpu(a);
this.cpuStates_[a]=new d(c)}return this.cpuStates_[a]},getOrCreateKernelThread:function(a,c,b){this.kernelThreadStates_[a]||(b=this.model_.getOrCreateProcess(c).getOrCreateThread(b),b.name=a,this.kernelThreadStates_[a]={pid:c,thread:b,openSlice:void 0,openSliceTS:void 0},this.threadsByLinuxPid[c]=b);return this.kernelThreadStates_[a]},getOrCreatePseudoThread:function(a){var c=this.kernelThreadStates_[a];c||(c=this.getOrCreateKernelThread(a,0,this.pseudoThreadCounter),this.pseudoThreadCounter++);return c},
importEvents:function(a){this.createParsers();this.importCpuData();this.alignClocks(a)&&(this.buildMapFromLinuxPidsToThreads(),this.buildPerThreadCpuSlicesFromCpuState())},finalizeImport:function(){},joinRefs:function(){},buildPerThreadCpuSlicesFromCpuState:function(){for(var a in this.cpuStates_)for(var c=this.cpuStates_[a].cpu,b=0;b<c.slices.length;b++){var e=c.slices[b],f=this.threadsByLinuxPid[e.args.tid];f&&(f.tempCpuSlices||(f.tempCpuSlices=[]),f.tempCpuSlices.push(e))}for(b in this.wakeups_)if(a=
this.wakeups_[b],f=this.threadsByLinuxPid[a.tid])f.tempWakeups=f.tempWakeups||[],f.tempWakeups.push(a);var g=tracing.getColorIdByName("running"),d=tracing.getColorIdByName("runnable"),h=tracing.getColorIdByName("sleeping"),k=tracing.getColorIdByName("iowait");this.model_.getAllThreads().forEach(function(a){if(void 0!==a.tempCpuSlices){var c=a.tempCpuSlices;delete a.tempCpuSlices;c.sort(function(a,c){return a.start-c.start});var b=a.tempWakeups||[];delete a.tempWakeups;b.sort(function(a,c){return a.ts-
c.ts});var e=[];if(c.length){var f=c[0];if(b.length&&b[0].ts<f.start){var l=b.shift();e.push(new tracing.trace_model.Slice("","Runnable",d,l.ts,{"wakeup from tid":l.fromTid},f.start-l.ts))}e.push(new tracing.trace_model.Slice("","Running",g,f.start,{},f.duration))}l=void 0;for(f=1;f<c.length;f++){for(var m=c[f-1],n=c[f],p=n.start-m.end;b.length&&b[0].ts<n.start;){var q=b.shift();void 0===l&&q.ts>m.end&&(l=q)}q=function(a,c){void 0!==l&&(p=l.ts-m.end);e.push(new tracing.trace_model.Slice("",a,c,m.end,
{},p));void 0!==l&&(e.push(new tracing.trace_model.Slice("","Runnable",d,l.ts,{"wakeup from tid":l.fromTid},n.start-l.ts)),l=void 0)};"S"==m.args.stateWhenDescheduled?q("Sleeping",h):"R"==m.args.stateWhenDescheduled||"R+"==m.args.stateWhenDescheduled?e.push(new tracing.trace_model.Slice("","Runnable",d,m.end,{},p)):"D"==m.args.stateWhenDescheduled?q("Uninterruptible Sleep",k):"T"==m.args.stateWhenDescheduled?e.push(new tracing.trace_model.Slice("","__TASK_STOPPED",k,m.end,{},p)):"t"==m.args.stateWhenDescheduled?
e.push(new tracing.trace_model.Slice("","debug",k,m.end,{},p)):"Z"==m.args.stateWhenDescheduled?e.push(new tracing.trace_model.Slice("","Zombie",k,m.end,{},p)):"X"==m.args.stateWhenDescheduled?e.push(new tracing.trace_model.Slice("","Exit Dead",k,m.end,{},p)):"x"==m.args.stateWhenDescheduled?e.push(new tracing.trace_model.Slice("","Task Dead",k,m.end,{},p)):"K"==m.args.stateWhenDescheduled?e.push(new tracing.trace_model.Slice("","Wakekill",k,m.end,{},p)):"W"==m.args.stateWhenDescheduled?e.push(new tracing.trace_model.Slice("",
"Waking",k,m.end,{},p)):"D|K"==m.args.stateWhenDescheduled?q("Uninterruptible Sleep | WakeKill",k):"D|W"==m.args.stateWhenDescheduled?q("Uninterruptible Sleep | Waking",k):(e.push(new tracing.trace_model.Slice("","UNKNOWN",k,m.end,{},p)),this.model_.importErrors.push("Unrecognized sleep state: "+m.args.stateWhenDescheduled));e.push(new tracing.trace_model.Slice("","Running",g,n.start,{},n.duration))}a.cpuSlices=e}},this)},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 c in this.cpuStates_){for(var b=this.cpuStates_[c].cpu,e=0;e<b.slices.length;e++){var f=b.slices[e];f.start+=a;f.duration=f.duration}for(var g in b.counters)for(e=b.counters[g],f=0;f<e.timestamps.length;f++)e.timestamps[f]+=a}for(var d in this.kernelThreadStates_)this.kernelThreadStates_[d].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_.kernel.cpus[a];for(var c in this.kernelThreadStates_){a=this.kernelThreadStates_[c].thread;var b=a.parent;delete b.threads[a.tid];delete this.model_.processes[b.pid]}this.model_.importErrors.push("Cannot import kernel trace without a clock sync.")},createParsers:function(){for(var a=tracing.importer.linux_perf.Parser.getSubtypeConstructors(),c=0;c<a.length;++c)this.parsers_.push(new a[c](this));this.registerEventHandler("tracing_mark_write:trace_event_clock_sync",
b.prototype.traceClockSyncEvent.bind(this));this.registerEventHandler("tracing_mark_write",b.prototype.traceMarkingWriteEvent.bind(this));this.registerEventHandler("0:trace_event_clock_sync",b.prototype.traceClockSyncEvent.bind(this));this.registerEventHandler("0",b.prototype.traceMarkingWriteEvent.bind(this))},registerEventHandler:function(a,c){this.eventHandlers_[a]=c},markPidRunnable:function(a,c,b,e,f){this.wakeups_.push({ts:a,tid:c,fromTid:f})},importError:function(a){this.model_.importErrors.push("Line "+
(this.lineNumberBase+this.lineNumber+1)+": "+a)},traceClockSyncEvent:function(a,c,b,e,f){a=/parent_ts=(\d+\.?\d*)/.exec(f.details);if(!a)return!1;this.clockSyncRecords_.push({perfTS:e,parentTS:1E3*a[1]});return!0},traceMarkingWriteEvent:function(a,c,b,e,f,g){var d=/^\s*(\w+):\s*(.*)$/.exec(f.details);if(d)f.subEventName=d[1],f.details=d[2];else if(d=f.details.substring(0,2),"B|"==d||"E"==d||"E|"==d||"C|"==d||"S|"==d||"F|"==d)f.subEventName="android";else return!1;a=a+":"+f.subEventName;d=this.eventHandlers_[a];
return d?d(a,c,b,e,f,g):(this.importError("Unknown trace_marking_write event "+a),!0)},importCpuData:function(){var c=b._extractEventsFromSystraceHTML(this.events_,!0);c.ok?(this.lineNumberBase=c.events_begin_at_line,this.lines_=c.lines):(this.lineNumberBase=0,this.lines_=this.events_.split("\n"));c=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==c&&(c=a(e),null==c)){this.importError("Cannot parse line: "+
e);continue}var f=c(e);if(f){var g=parseInt(f.pid),d=parseInt(f.cpuNumber),h=1E3*parseFloat(f.timestamp),k=f.eventName,l=this.eventHandlers_[k];l?l(k,d,g,h,f)||this.importError("Malformed "+k+" event ("+e+")"):this.importError("Unknown event "+k+" ("+e+")")}else this.importError("Unrecognized line: "+e)}}}};tracing.TraceModel.registerImporter(b);return{LinuxPerfImporter:b,_LinuxPerfImporterTestExports:c}});"use strict";base.requireRawScript("../third_party/gl-matrix/src/gl-matrix/common.js");base.requireRawScript("../third_party/gl-matrix/src/gl-matrix/mat2d.js");
base.requireRawScript("../third_party/gl-matrix/src/gl-matrix/mat4.js");base.requireRawScript("../third_party/gl-matrix/src/gl-matrix/vec2.js");base.requireRawScript("../third_party/gl-matrix/src/gl-matrix/vec3.js");base.requireRawScript("../third_party/gl-matrix/src/gl-matrix/vec4.js");
base.exportTo("base",function(){var d=vec2.create(),b=vec2.create(),a=vec4.create();mat2d.create();vec2.createFromArray=function(a){if(2!=a.length)throw Error("Should be length 2");var b=vec2.create();vec2.set(b,a[0],a[1]);return b};vec2.createXY=function(a,b){var f=vec2.create();vec2.set(f,a,b);return f};vec2.toString=function(a){return"["+a[0]+", "+a[1]+"]"};vec2.addTwoScaledUnitVectors=function(a,e,f,g,h){vec2.scale(d,e,f);vec2.scale(b,g,h);vec2.add(a,d,b)};vec3.createXYZ=function(a,b,f){var g=
vec3.create();vec3.set(g,a,b,f);return g};vec3.toString=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};mat2d.translateXY=function(a,b,f){vec2.set(d,b,f);mat2d.translate(a,a,d)};mat2d.scaleXY=function(a,b,f){vec2.set(d,b,f);mat2d.scale(a,a,d)};vec4.unitize=function(a,b){a[0]=b[0]/b[3];a[1]=b[1]/b[3];a[2]=b[2]/b[3];a[3]=1;return a};vec2.copyFromVec4=function(c,b){vec4.unitize(a,b);vec2.copy(c,a)};return{}});"use strict";base.require("base.gl_matrix");
base.exportTo("base",function(){function d(a,c,b,e){vec2.scale(h,c,e);vec2.scale(k,b,1-e);vec2.add(a,h,k);vec2.normalize(a,a);return a}function b(){this.p1=vec2.create();this.p2=vec2.create();this.p3=vec2.create();this.p4=vec2.create()}function a(a,c,b){return(a[0]-b[0])*(c[1]-b[1])-(c[0]-b[0])*(a[1]-b[1])}function c(c,b,e,f){var g=0>a(c,b,e);e=0>a(c,e,f);c=0>a(c,f,b);return g==e&&e==c}for(var e=[],f=0;8>f;f++)e[f]=vec2.create();var g=vec4.create();vec4.create();vec4.create();mat4.create();mat4.create();
vec2.createXY(0,0);vec2.createXY(1,0);vec2.createXY(0,1);vec2.createXY(1,1);var h=vec2.create(),k=vec2.create();b.FromXYWH=function(a,c,e,f){var g=new b;vec2.set(g.p1,a,c);vec2.set(g.p2,a+e,c);vec2.set(g.p3,a+e,c+f);vec2.set(g.p4,a,c+f);return g};b.FromRect=function(a){return new b.FromXYWH(a.x,a.y,a.width,a.height)};b.From4Vecs=function(a,c,e,f){var g=new b;vec2.set(g.p1,a[0],a[1]);vec2.set(g.p2,c[0],c[1]);vec2.set(g.p3,e[0],e[1]);vec2.set(g.p4,f[0],f[1]);return g};b.From8Array=function(a){if(8!=
a.length)throw Error("Array must be 8 long");var c=new b;c.p1[0]=a[0];c.p1[1]=a[1];c.p2[0]=a[2];c.p2[1]=a[3];c.p3[0]=a[4];c.p3[1]=a[5];c.p4[0]=a[6];c.p4[1]=a[7];return c};b.prototype={vecInside:function(a){return c(a,this.p1,this.p2,this.p3)||c(a,this.p1,this.p3,this.p4)},boundingRect:function(){var a=Math.min(this.p1[0],this.p2[0],this.p3[0],this.p4[0]),c=Math.min(this.p1[1],this.p2[1],this.p3[1],this.p4[1]),b=Math.max(this.p1[0],this.p2[0],this.p3[0],this.p4[0]),e=Math.max(this.p1[1],this.p2[1],
this.p3[1],this.p4[1]);return new base.Rect.FromXYWH(a,c,b-a,e-c)},clone:function(){var a=new b;vec2.copy(a.p1,this.p1);vec2.copy(a.p2,this.p2);vec2.copy(a.p3,this.p3);vec2.copy(a.p4,this.p4);return a},scale:function(a){var c=new b;this.scaleFast(c,a);return c},scaleFast:function(a,c){vec2.copy(a.p1,this.p1,c);vec2.copy(a.p2,this.p2,c);vec2.copy(a.p3,this.p3,c);vec2.copy(a.p3,this.p3,c)},isRectangle:function(){var a=this.boundingRect();return a.x==this.p1[0]&&a.y==this.p1[1]&&a.width==this.p2[0]-
this.p1[0]&&a.y==this.p2[1]&&a.width==this.p3[0]-this.p1[0]&&a.height==this.p3[1]-this.p2[1]&&a.x==this.p4[0]&&a.height==this.p4[1]-this.p2[1]},projectUnitRect:function(a){var c=new b;this.projectUnitRectFast(c,a);return c},projectUnitRectFast:function(a,c){var b=e[0],f=e[1],h=e[2],k=e[3],v,w,s,r;vec2.sub(b,this.p2,this.p1);v=vec2.length(b);vec2.scale(b,b,1/v);vec2.sub(f,this.p4,this.p1);w=vec2.length(f);vec2.scale(f,f,1/w);vec2.sub(h,this.p3,this.p2);s=vec2.length(h);vec2.scale(h,h,1/s);vec2.sub(k,
this.p3,this.p4);r=vec2.length(k);vec2.scale(k,k,1/r);var u=e[0],x=e[1],y=e[2],z=e[3];d(u,b,k,c.y);d(z,b,k,1-c.bottom);d(x,f,h,c.x);d(y,f,h,1-c.right);vec2.addTwoScaledUnitVectors(g,u,v*c.x,x,w*c.y);vec2.add(a.p1,this.p1,g);vec2.addTwoScaledUnitVectors(g,u,v*-(1-c.right),y,s*c.y);vec2.add(a.p2,this.p2,g);vec2.addTwoScaledUnitVectors(g,z,r*-(1-c.right),y,s*-(1-c.bottom));vec2.add(a.p3,this.p3,g);vec2.addTwoScaledUnitVectors(g,z,r*c.left,x,w*-(1-c.bottom));vec2.add(a.p4,this.p4,g)},toString:function(){return"Quad("+
vec2.toString(this.p1)+", "+vec2.toString(this.p2)+", "+vec2.toString(this.p3)+", "+vec2.toString(this.p4)+")"}};return{vecInTriangle2:c,Quad:b}});"use strict";base.require("tracing.trace_model.trace_model_event");
base.exportTo("tracing.trace_model",function(){function d(a,c,b,e,d){tracing.trace_model.TraceModelEvent.apply(this,arguments);this.type=void 0}function b(a,c,b,k,l){d.apply(this,arguments);this.type=e.GLOBAL}function a(a,c,b,k,l){d.apply(this,arguments);this.type=e.PROCESS}function c(a,c,b,k,l){d.apply(this,arguments);this.type=e.THREAD}var e={GLOBAL:1,PROCESS:2,THREAD:3};d.prototype={__proto__:tracing.trace_model.TraceModelEvent.prototype};b.prototype={__proto__:d.prototype};a.prototype={__proto__:d.prototype};
c.prototype={__proto__:d.prototype};return{GlobalInstantEvent:b,ProcessInstantEvent:a,ThreadInstantEvent:c,InstantEventType:e}});"use strict";base.require("base.quad");base.require("tracing.trace_model");base.require("tracing.color_scheme");base.require("tracing.trace_model.instant_event");base.require("tracing.trace_model.counter_series");
base.exportTo("tracing.importer",function(){function d(a){if(!(a instanceof Object)){if(void 0===a||null===a)return a;if("string"==typeof a)return a.substring();if("boolean"==typeof a||"number"==typeof a)return a;throw Error("Unrecognized: "+typeof a);}if(a instanceof Array){for(var c=Array(a.length),b=0;b<a.length;b++)c[b]=d(a[b]);return c}if(a.__proto__!=Object.prototype)throw Error("Can only clone simple types");c={};for(b in a)c[b]=d(a[b]);return c}function b(a,c){this.importPriority=1;this.model_=
a;this.systemTraceEvents_=this.events_=void 0;this.eventsWereFromString_=!1;this.allAsyncEvents_=[];this.allObjectEvents_=[];"string"===typeof c||c instanceof String?("["===c[0]&&(c=c.replace(/[\r|\n]*$/,"").replace(/\s*,\s*$/,""),"]"!==c[c.length-1]&&(c+="]")),this.events_=JSON.parse(c),this.eventsWereFromString_=!0):this.events_=c;if(this.events_.traceEvents){var b=this.events_;this.events_=this.events_.traceEvents;this.systemTraceEvents_=b.systemTraceEvents;for(var f in b)"traceEvents"!==f&&"systemTraceEvents"!==
f&&this.model_.metadata.push({name:f,value:b[f]})}}b.canImport=function(a){return"string"===typeof a||a instanceof String?"{"==a[0]||"["==a[0]:a instanceof Array&&a.length&&a[0].ph?!0:a.traceEvents?a.traceEvents instanceof Array&&a.traceEvents[0].ph:!1};b.prototype={__proto__:Object.prototype,extractSubtrace:function(){var a=this.systemTraceEvents_;this.systemTraceEvents_=void 0;return a},deepCopyIfNeeded_:function(a){return this.eventsWereFromString_?a:d(a)},processAsyncEvent:function(a){var c=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid);
this.allAsyncEvents_.push({event:a,thread:c})},processCounterEvent:function(a){var c;c=void 0!==a.id?a.name+"["+a.id+"]":a.name;c=this.model_.getOrCreateProcess(a.pid).getOrCreateCounter(a.cat,c);if(0===c.numSeries){for(var b in a.args)c.addSeries(new tracing.trace_model.CounterSeries(b,tracing.getStringColorId(c.name+"."+b)));if(0===c.numSeries){this.model_.importErrors.push("Expected counter "+a.name+" to have at least one argument to use as a value.");delete c.parent.counters[c.name];return}}var f=
a.ts/1E3;c.series.forEach(function(c){c.addSample(f,a.args[c.name]?a.args[c.name]:0)})},processObjectEvent:function(a){var c=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid);this.allObjectEvents_.push({event:a,thread:c})},processDurationEvent:function(a){var c=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid);if(c.sliceGroup.isTimestampValidForBeginOrEnd(a.ts/1E3))if("B"==a.ph)c.sliceGroup.beginSlice(a.cat,a.name,a.ts/1E3,this.deepCopyIfNeeded_(a.args));else if(c.sliceGroup.openSliceCount){var c=
c.sliceGroup.endSlice(a.ts/1E3),b;for(b in a.args)void 0!==c.args[b]&&this.model_.importErrors.push("Both the B and E phases of "+c.name+"provided values for argument "+b+". The value of the E phase event will be used."),c.args[b]=this.deepCopyIfNeeded_(a.args[b])}else this.model_.importErrors.push("E phase event without a matching B phase event.");else this.model_.importErrors.push("Timestamps are moving backward.")},processMetadataEvent:function(a){if("process_name"==a.name){var c=this.model_.getOrCreateProcess(a.pid);
c.name=a.args.name}else"process_labels"==a.name?(c=this.model_.getOrCreateProcess(a.pid),c.labels.push.apply(c.labels,a.args.labels.split(","))):"process_sort_index"==a.name?(c=this.model_.getOrCreateProcess(a.pid),c.sortIndex=a.args.sort_index):"thread_name"==a.name?(c=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid),c.name=a.args.name):"thread_sort_index"==a.name?(c=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid),c.sortIndex=a.args.sort_index):this.model_.importErrors.push("Unrecognized metadata name: "+
a.name)},processInstantEvent:function(a){var c;switch(a.s){case "g":c=tracing.trace_model.GlobalInstantEvent;break;case "p":c=tracing.trace_model.ProcessInstantEvent;break;default:c=tracing.trace_model.ThreadInstantEvent}var b=tracing.getStringColorId(a.name);c=new c(a.cat,a.name,b,a.ts/1E3,this.deepCopyIfNeeded_(a.args));switch(c.type){case tracing.trace_model.InstantEventType.GLOBAL:this.model_.pushInstantEvent(c);break;case tracing.trace_model.InstantEventType.PROCESS:this.model_.getOrCreateProcess(a.pid).pushInstantEvent(c);
break;case tracing.trace_model.InstantEventType.THREAD:this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid).sliceGroup.pushInstantEvent(c);break;default:throw Error("Unknown instant event type: "+a.s);}},processSampleEvent:function(a){this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid).addSample(a.cat,a.name,a.ts/1E3,this.deepCopyIfNeeded_(a.args))},importEvents:function(){for(var a=this.events_,c=0;c<a.length;c++){var b=a[c];"B"===b.ph||"E"===b.ph?this.processDurationEvent(b):
"S"===b.ph||"F"===b.ph||"T"===b.ph?this.processAsyncEvent(b):"I"==b.ph||"i"==b.ph?this.processInstantEvent(b):"P"==b.ph?this.processSampleEvent(b):"C"==b.ph?this.processCounterEvent(b):"M"==b.ph?this.processMetadataEvent(b):"N"===b.ph||"D"===b.ph||"O"===b.ph?this.processObjectEvent(b):"s"!==b.ph&&("t"!==b.ph&&"f"!==b.ph)&&this.model_.importErrors.push("Unrecognized event phase: "+b.ph+" ("+b.name+")")}},finalizeImport:function(){this.createAsyncSlices_();this.createExplicitObjects_();this.createImplicitObjects_()},
joinRefs:function(){this.joinObjectRefs_()},createAsyncSlices_:function(){if(0!=this.allAsyncEvents_.length){this.allAsyncEvents_.sort(function(a,c){return a.event.ts-c.event.ts});for(var a={},c=this.allAsyncEvents_,b=0;b<c.length;b++){var f=c[b],g=f.event,d=g.name;if(void 0===d)this.model_.importErrors.push("Async events (ph: S, T or F) require an name parameter.");else{var k=g.id;if(void 0===k)this.model_.importErrors.push("Async events (ph: S, T or F) require an id parameter.");else if("S"==g.ph)void 0===
a[d]&&(a[d]={}),a[d][k]?this.model_.importErrors.push("At "+g.ts+", a slice of the same id "+k+" was alrady open."):(a[d][k]=[],a[d][k].push(f));else if(void 0===a[d])this.model_.importErrors.push("At "+g.ts+", no slice named "+d+" was open.");else if(void 0===a[d][k])this.model_.importErrors.push("At "+g.ts+", no slice named "+d+" with id="+k+" was open.");else{var l=a[d][k];l.push(f);if("F"==g.ph){var m=new tracing.trace_model.AsyncSlice(l[0].event.cat,d,tracing.getStringColorId(d),l[0].event.ts/
1E3);m.duration=g.ts/1E3-l[0].event.ts/1E3;m.startThread=l[0].thread;m.endThread=f.thread;m.id=k;m.args=this.deepCopyIfNeeded_(l[0].event.args);m.subSlices=[];for(f=1;f<l.length;++f){var n=d;"T"==l[f-1].event.ph&&(n=d+":"+l[f-1].event.args.step);n=new tracing.trace_model.AsyncSlice(l[0].event.cat,n,tracing.getStringColorId(d+f),l[f-1].event.ts/1E3);n.duration=l[f].event.ts/1E3-l[f-1].event.ts/1E3;n.startThread=l[f-1].thread;n.endThread=l[f].thread;n.id=k;n.args=this.deepCopyIfNeeded_(l[f-1].event.args);
m.subSlices.push(n)}var l=m.subSlices[m.subSlices.length-1],p;for(p in g.args)l.args[p]=this.deepCopyIfNeeded_(g.args[p]);m.startThread.asyncSliceGroup.push(m);delete a[d][k]}}}}}},createExplicitObjects_:function(){function a(a){var c=a.event;a=a.thread;void 0===c.name&&this.model_.importErrors.push("While processing "+JSON.stringify(c)+": Object events require an name parameter.");void 0===c.id&&this.model_.importErrors.push("While processing "+JSON.stringify(c)+": Object events require an id parameter.");
a=a.parent;var b=c.ts/1E3,e;if("N"==c.ph)try{e=a.objects.idWasCreated(c.id,c.cat,c.name,b)}catch(f){this.model_.importErrors.push("While processing create of "+c.id+" at ts="+b+": "+f);return}else if("O"==c.ph){if(void 0===c.args.snapshot){this.model_.importErrors.push("While processing "+c.id+" at ts="+b+": Snapshots must have args: {snapshot: ...}");return}var g;try{g=a.objects.addSnapshot(c.id,c.cat,c.name,b,this.deepCopyIfNeeded_(c.args.snapshot))}catch(d){this.model_.importErrors.push("While processing snapshot of "+
c.id+" at ts="+b+": "+d);return}e=g.objectInstance}else if("D"==c.ph)try{e=a.objects.idWasDeleted(c.id,c.cat,c.name,b)}catch(t){this.model_.importErrors.push("While processing delete of "+c.id+" at ts="+b+": "+t);return}e&&(e.colorId=tracing.getStringColorId(e.typeName))}if(0!=this.allObjectEvents_.length){this.allObjectEvents_.sort(function(a,c){return a.event.ts-c.event.ts});for(var c=this.allObjectEvents_,b=0;b<c.length;b++){var f=c[b];try{a.call(this,f)}catch(g){this.model_.importErrors.push(g.message)}}}},
createImplicitObjects_:function(){base.iterItems(this.model_.processes,function(a,c){this.createImplicitObjectsForProcess_(c)},this)},createImplicitObjectsForProcess_:function(a){function c(c,b,e,d){if(e&&void 0!==e.id&&!(e instanceof tracing.trace_model.ObjectSnapshot)){var l=e.id,m=/(.+)\/(.+)/.exec(l);if(!m)throw Error("Implicit snapshots must have names.");delete e.id;var n=m[1],m=m[2],p;try{p=a.objects.addSnapshot(m,d.objectInstance.category,n,d.ts,e)}catch(q){this.model_.importErrors.push("While processing implicit snapshot of "+
l+" at ts="+d.ts+": "+q);return}p.objectInstance.hasImplicitSnapshots=!0;p.containingSnapshot=d;c[b]=p;if(!(p instanceof tracing.trace_model.ObjectSnapshot))throw Error("Created object must be instanceof snapshot");return p.args}}function b(a,c,d,k){if(a instanceof Object)if(a instanceof Array)for(var l=0;l<a.length;l++){var m=c.call(k,a,l,a[l],d);m?b(m,c,d,k):b(a[l],c,d,k)}else for(l in a)(m=c.call(k,a,l,a[l],d))?b(m,c,d,k):b(a[l],c,d,k)}a.objects.iterObjectInstances(function(a){a.snapshots.forEach(function(a){if(void 0!==
a.args.id)throw Error("args cannot have an id field inside it");b(a.args,c,a,this)},this)},this)},joinObjectRefs_:function(){base.iterItems(this.model_.processes,function(a,c){this.joinObjectRefsForProcess_(c)},this)},joinObjectRefsForProcess_:function(a){var c=[];base.iterItems(a.threads,function(b,f){f.asyncSliceGroup.slices.forEach(function(b){this.searchItemForIDRefs_(c,a.objects,"start",b)},this);f.sliceGroup.slices.forEach(function(b){this.searchItemForIDRefs_(c,a.objects,"start",b)},this)},
this);a.objects.iterObjectInstances(function(b){b.snapshots.forEach(function(b){this.searchItemForIDRefs_(c,a.objects,"ts",b)},this)},this);c.forEach(function(a){a.object[a.field]=a.value})},searchItemForIDRefs_:function(a,c,b,f){function d(g,h,m){void 0!==m&&(m.id_ref||m.idRef)&&(m=c.getSnapshotAt(m.id_ref||m.idRef,f[b]))&&a.push({object:g,field:h,value:m})}function h(a){if(a instanceof Object&&!(a instanceof tracing.trace_model.ObjectSnapshot||a instanceof Float32Array||a instanceof base.Quad))if(a instanceof
Array)for(var c=0;c<a.length;c++)d(a,c,a[c]),h(a[c]);else for(c in a){var b=a[c];d(a,c,b);h(b)}}if(!f.args)throw Error("");h(f.args)}};tracing.TraceModel.registerImporter(b);return{TraceEventImporter:b}});"use strict";
base.exportTo("tracing.importer.v8",function(){function d(){}d.prototype.root_=null;d.prototype.isEmpty=function(){return!this.root_};d.prototype.insert=function(b,a){if(this.isEmpty())this.root_=new d.Node(b,a);else if(this.splay_(b),this.root_.key!=b){var c=new d.Node(b,a);b>this.root_.key?(c.left=this.root_,c.right=this.root_.right,this.root_.right=null):(c.right=this.root_,c.left=this.root_.left,this.root_.left=null);this.root_=c}};d.prototype.remove=function(b){if(this.isEmpty())throw Error("Key not found: "+
b);this.splay_(b);if(this.root_.key!=b)throw Error("Key not found: "+b);var a=this.root_;if(this.root_.left){var c=this.root_.right;this.root_=this.root_.left;this.splay_(b);this.root_.right=c}else this.root_=this.root_.right;return a};d.prototype.find=function(b){if(this.isEmpty())return null;this.splay_(b);return this.root_.key==b?this.root_:null};d.prototype.findMin=function(){if(this.isEmpty())return null;for(var b=this.root_;b.left;)b=b.left;return b};d.prototype.findMax=function(b){if(this.isEmpty())return null;
for(b=b||this.root_;b.right;)b=b.right;return b};d.prototype.findGreatestLessThan=function(b){if(this.isEmpty())return null;this.splay_(b);return this.root_.key<=b?this.root_:this.root_.left?this.findMax(this.root_.left):null};d.prototype.exportKeysAndValues=function(){var b=[];this.traverse_(function(a){b.push([a.key,a.value])});return b};d.prototype.exportValues=function(){var b=[];this.traverse_(function(a){b.push(a.value)});return b};d.prototype.splay_=function(b){if(!this.isEmpty()){var a,c,
e;a=c=e=new d.Node(null,null);for(var f=this.root_;;)if(b<f.key){if(!f.left)break;if(b<f.left.key){var g=f.left;f.left=g.right;g.right=f;f=g;if(!f.left)break}e=e.left=f;f=f.left}else if(b>f.key){if(!f.right)break;if(b>f.right.key&&(g=f.right,f.right=g.left,g.left=f,f=g,!f.right))break;c=c.right=f;f=f.right}else break;c.right=f.left;e.left=f.right;f.left=a.right;f.right=a.left;this.root_=f}};d.prototype.traverse_=function(b){for(var a=[this.root_];0<a.length;){var c=a.shift();null!=c&&(b(c),a.push(c.left),
a.push(c.right))}};d.Node=function(b,a){this.key=b;this.value=a};d.Node.prototype.left=null;d.Node.prototype.right=null;return{SplayTree:d}});"use strict";base.require("tracing.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(b,a){this.deleteAllCoveredNodes_(this.dynamics_,b,b+a.size);this.dynamics_.insert(b,a)};d.prototype.moveCode=function(b,a){var c=this.dynamics_.remove(b);
this.deleteAllCoveredNodes_(this.dynamics_,a,a+c.value.size);this.dynamics_.insert(a,c.value)};d.prototype.deleteCode=function(b){this.dynamics_.remove(b)};d.prototype.addLibrary=function(b,a){this.markPages_(b,b+a.size);this.libraries_.insert(b,a)};d.prototype.addStaticCode=function(b,a){this.statics_.insert(b,a)};d.prototype.markPages_=function(b,a){for(var c=b;c<=a;c+=d.PAGE_SIZE)this.pages_[c>>>d.PAGE_ALIGNMENT]=1};d.prototype.deleteAllCoveredNodes_=function(b,a,c){for(var e=[],f=c-1;f>=a;){var d=
b.findGreatestLessThan(f);if(!d)break;f=d.key;d=f+d.value.size;f<c&&a<d&&e.push(f);f-=1}a=0;for(c=e.length;a<c;++a)b.remove(e[a])};d.prototype.isAddressBelongsTo_=function(b,a){return b>=a.key&&b<a.key+a.value.size};d.prototype.findInTree_=function(b,a){var c=b.findGreatestLessThan(a);return c&&this.isAddressBelongsTo_(a,c)?c.value:null};d.prototype.findEntry=function(b){if(b>>>d.PAGE_ALIGNMENT in this.pages_)return this.findInTree_(this.statics_,b)||this.findInTree_(this.libraries_,b);var a=this.dynamics_.findMin(),
c=this.dynamics_.findMax();if(null!=c&&b<c.key+c.value.size&&b>=a.key){b=this.findInTree_(this.dynamics_,b);if(null==b)return null;b.nameUpdated_||(b.name=this.dynamicsNameGen_.getName(b.name),b.nameUpdated_=!0);return b}return null};d.prototype.findDynamicEntryByStartAddress=function(b){return(b=this.dynamics_.find(b))?b.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(b,a){this.size=b;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(b){if(!(b in this.knownNames_))return this.knownNames_[b]=
0,b;var a=++this.knownNames_[b];return b+" {"+a+"}"};return{CodeMap:d}});"use strict";
base.exportTo("tracing.importer.v8",function(){function d(){}function b(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 c=d.CSV_FIELD_RE_,b=d.DOUBLE_QUOTE_RE_,f=0,g=a.length,h=[];if(0<g){do{var k=c.exec(a.substr(f));"string"===typeof k[1]?(k=k[1],f+=k.length+3,h.push(k.replace(b,'"'))):(k=k[2],f+=k.length+1,h.push(k))}while(f<=g)}return h};b.prototype.printError=function(a){};
b.prototype.processLogChunk=function(a){this.processLog_(a.split("\n"))};b.prototype.processLogLine=function(a){this.processLog_([a])};b.prototype.processStack=function(a,c,b){c=c?[a,c]:[a];for(var f=0,d=b.length;f<d;++f){var h=b[f],k=h.charAt(0);"+"==k||"-"==k?(a+=parseInt(h,16),c.push(a)):"o"!=k&&c.push(parseInt(h,16))}return c};b.prototype.skipDispatch=function(a){return!1};b.prototype.dispatchLogRow_=function(a){var c=a[0];if(c in this.dispatchTable_&&(c=this.dispatchTable_[c],null!==c&&!this.skipDispatch(c))){for(var b=
[],f=0;f<c.parsers.length;++f){var d=c.parsers[f];if(null===d)b.push(a[1+f]);else if("function"==typeof d)b.push(d(a[1+f]));else{b.push(a.slice(1+f));break}}c.processor.apply(this,b)}};b.prototype.processLog_=function(a){for(var c=0,b=a.length;c<b;++c,++this.lineNum_){var f=a[c];if(f)try{var d=this.csvParser_.parseLine(f);this.dispatchLogRow_(d)}catch(h){this.printError("line "+(this.lineNum_+1)+": "+(h.message||h))}}};return{LogReader:b}});"use strict";base.require("tracing.trace_model");base.require("tracing.trace_model.slice");
base.require("tracing.color_scheme");base.require("tracing.importer.v8.log_reader");base.require("tracing.importer.v8.codemap");
base.exportTo("tracing.importer",function(){function d(a,b){this.importPriority=3;this.model_=a;this.logData_=b;this.code_map_=new tracing.importer.v8.CodeMap;this.v8_samples_thread_=this.v8_stack_thread_=this.v8_timer_thread_=void 0}var b=["/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?"timer-event,"==a.substring(0,12)||"tick,"==a.substring(0,5)||"shared-library,"==a.substring(0,15)||"profiler,"==a.substring(0,9):!1};d.prototype={__proto__:Object.prototype,
extractSubtrace:function(){},processTimerEvent_:function(c,b,f){var d=a[c];if(void 0!==d){b/=1E3;f/=1E3;var h=tracing.getStringColorId(c);c=new tracing.trace_model.Slice("v8",c,h,b,d,f);this.v8_timer_thread_.sliceGroup.pushSlice(c)}},processTimerEventStart_:function(c,b){var f=a[c];void 0!==f&&this.v8_timer_thread_.sliceGroup.beginSlice("v8",c,b/1E3,f)},processTimerEventEnd_:function(a,b){this.v8_timer_thread_.sliceGroup.endSlice(b/1E3)},processCodeCreateEvent_:function(a,b,f,d,h){a=new tracing.importer.v8.CodeMap.CodeEntry(d,
h);a.kind=b;this.code_map_.addCode(f,a)},processCodeMoveEvent_:function(a,b){this.code_map_.moveCode(a,b)},processCodeDeleteEvent_:function(a){this.code_map_.deleteCode(a)},processSharedLibrary_:function(a,e,f){f=new tracing.importer.v8.CodeMap.CodeEntry(f-e,a);f.kind=-3;for(var d=0;d<b.length;d++){var h=b[d];if(0<=a.indexOf(h,a.length-h.length)){f.kind=-1;break}}this.code_map_.addLibrary(e,f)},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,b,f,d,h,k,l){b=this.code_map_.findEntry(a);b=this.nameForCodeEntry_(b);f/=1E3;this.v8_samples_thread_.addSample("v8",b,f);if(l&&l.length)for(a=0;8>a&&l[a];a++)b=this.code_map_.findEntry(l[a]),b=this.nameForCodeEntry_(b),d=tracing.getStringColorId(b),b=new tracing.trace_model.Slice("v8",b,d,f,{},0),this.v8_stack_thread_.sliceGroup.pushSlice(b)},processDistortion_:function(a){distortion_per_entry=a/1E6},processPlotRange_:function(a,
b){xrange_start_override=a;xrange_end_override=b},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 b=this.logData_.split("\n"),f=0;f<b.length;f++)a.processLogLine(b[f])},finalizeImport:function(){},joinRefs:function(){}};tracing.TraceModel.registerImporter(d);
return{V8LogImporter:d}});"use strict";base.require("tracing.importer.linux_perf_importer");base.require("tracing.importer.trace_event_importer");base.require("tracing.importer.v8_log_importer");"use strict";base.exportTo("tracing.analysis",function(){return{tsRound:function(d){return Math.round(1E3*d)/1E3}}});"use strict";base.require("base.events");base.require("base.guid");base.require("base.range");
base.exportTo("tracing",function(){function d(a,c){this.track=a;this.slice=c}function b(a,c,b){this.track=a;this.counter=c;this.sampleIndex=b}function a(a,c){this.track=a;this.objectSnapshot=c}function c(a,c){this.track=a;this.objectInstance=c}function e(a){this.bounds_dirty_=!0;this.bounds_=new base.Range;this.length_=0;this.guid_=base.GUID.allocate();a&&this.pushHits(a)}d.prototype={get modelObject(){return this.slice},get selected(){return this.slice.selected},set selected(a){this.slice.selected=
a},addBoundsToRange:function(a){a.addValue(this.slice.start);a.addValue(this.slice.end)}};b.prototype={get modelObject(){return this.sampleIndex},get selected(){return!0==this.track.selectedSamples[this.sampleIndex]},set selected(a){this.track.selectedSamples[this.sampleIndex]=a?!0:!1},addBoundsToRange:function(a){this.track.timestamps&&a.addValue(this.track.timestamps[this.sampleIndex])}};a.prototype={get modelObject(){return this.objectSnapshot},get selected(){return this.objectSnapshot.selected},
set selected(a){this.objectSnapshot.selected=a},addBoundsToRange:function(a){a.addValue(this.objectSnapshot.ts)}};c.prototype={get modelObject(){return this.objectInstance},get selected(){return this.objectInstance.selected},set selected(a){this.objectInstance.selected=a},addBoundsToRange:function(a){a.addRange(this.objectInstance.bounds)}};var f=[{constructor:d,name:"slice",pluralName:"slices"},{constructor:b,name:"counterSample",pluralName:"counterSamples"},{constructor:a,name:"objectSnapshot",
pluralName:"objectSnapshots"},{constructor:c,name:"objectInstance",pluralName:"objectInstances"}];e.prototype={__proto__:Object.prototype,get bounds(){if(this.bounds_dirty_){this.bounds_.reset();for(var a=0;a<this.length_;a++)this[a].addBoundsToRange(this.bounds_);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_},get guid(){return this.guid_},clear:function(){for(var a=0;a<this.length_;++a)delete this[a];
this.length_=0;this.bounds_dirty_=!0},pushHit:function(a){this.push_(a)},pushHits:function(a){for(var c=0;c<a.length;c++)this.pushHit(a[c])},push_:function(a){this[this.length_++]=a;this.bounds_dirty_=!0;return a},addSlice:function(a,c){return this.push_(new d(a,c))},addCounterSample:function(a,c,e){return this.push_(new b(a,c,e))},addObjectSnapshot:function(c,b){return this.push_(new a(c,b))},addObjectInstance:function(a,b){return this.push_(new c(a,b))},addSelection:function(a){for(var c=0;c<a.length;c++)this.push_(a[c])},
subSelection:function(a,c){c=c||1;var b=new e;b.bounds_dirty_=!0;if(0>a||a+c>this.length_)throw Error("Index out of bounds");for(var f=a;f<a+c;f++)b.push_(this[f]);return b},getCounterSampleHitsAsSelection:function(){var a=new e;this.enumHitsOfType(b,a.push_.bind(a));return a},getSliceHitsAsSelection:function(){var a=new e;this.enumHitsOfType(d,a.push_.bind(a));return a},getHitsOrganizedByType:function(){var a={};f.forEach(function(c){a[c.pluralName]=new e});for(var c=0;c<this.length_;c++){var b=
this[c];f.forEach(function(c){b instanceof c.constructor&&a[c.pluralName].push_(b)})}return a},enumHitsOfType:function(a,c){for(var b=0;b<this.length_;b++)this[b]instanceof a&&c(this[b])},getNumSliceHits:function(){var a=0;this.enumHitsOfType(d,function(c){a++});return a},getNumCounterHits:function(){var a=0;this.enumHitsOfType(b,function(c){a++});return a},getNumObjectSnapshotHits:function(){var c=0;this.enumHitsOfType(a,function(a){c++});return c},getNumObjectInstanceHits:function(){var a=0;this.enumHitsOfType(c,
function(c){a++});return a},map:function(a){for(var c=0;c<this.length_;c++)a(this[c])},getShiftedSelection:function(a){for(var c=new e,b=0;b<this.length_;b++){var f=this[b];f.track.addItemNearToProvidedHitToSelection(f,a,c)}return 0==c.length?void 0:c}};return{SelectionSliceHit:d,SelectionCounterSampleHit:b,SelectionObjectSnapshotHit:a,SelectionObjectInstanceHit:c,Selection:e,createSelectionFromObjectAndView:function(a,c){var b=new e;if(a instanceof tracing.trace_model.Slice)b.addSlice(void 0,a);
else if(a instanceof tracing.trace_model.ObjectSnapshot)b.addObjectSnapshot(void 0,a);else if(a instanceof tracing.trace_model.ObjectInstance)b.addObjectInstance(void 0,a);else throw Error("Unrecognized selection type");return b}}});"use strict";
base.exportTo("ui",function(){return{decorate:function(d,b){var a;a="string"==typeof d?base.doc.querySelectorAll(d):[d];for(var c=0,e;e=a[c];c++)e instanceof b||b.decorate(e)},define:function(d,b){function a(){if(b&&a.prototype.__proto__!=b.prototype)throw Error(d+" prototye's __proto__ field is messed up. It MUST be the prototype of "+b.tagName);var c=d;if(b)for(var e=b;e&&e.tagName;)c=e.tagName,e=e.parentConstructor;c=base.doc.createElement(c);a.decorate.call(this,c,arguments);return c}if("function"==
typeof d)throw Error("Passing functions as tagName is deprecated. Please use (tagName, opt_parentConstructor) to subclass");d=d.toLowerCase();if(b&&!b.tagName)throw Error("opt_parentConstructor was not created by ui.define");a.decorate=function(c,b){c.__proto__=a.prototype;c.decorate.apply(c,b)};a.tagName=d;a.parentConstructor=b?b:void 0;a.toString=function(){return a.parentConstructor?a.parentConstructor.toString()+"::"+a.tagName:a.tagName};return a},elementIsChildOf:function(d,b){if(d==b)return!1;
for(var a=d;a.parentNode;){if(a==b)return!0;a=a.parentNode}return!1}}});"use strict";base.requireStylesheet("tracing.analysis.analysis_link");base.require("base.events");base.require("tracing.selection");base.require("tracing.analysis.util");base.require("ui");
base.exportTo("tracing.analysis",function(){var d=tracing.analysis.tsRound,b=base.Event.bind(void 0,"requestSelectionChange",!0,!1),a=ui.define("a");a.prototype={__proto__:HTMLAnchorElement.prototype,decorate:function(){this.classList.add("analysis-link");this.selectionGenerator;this.addEventListener("click",this.onClicked_.bind(this))},onClicked_:function(){var a=new b;a.selection=this.selectionGenerator();this.dispatchEvent(a)}};var c=ui.define("object-snapshot-link",a);c.prototype={__proto__:a.prototype,
decorate:function(){a.prototype.decorate.apply(this)},set objectSnapshot(a){this.textContent=a.objectInstance.typeName+" "+a.objectInstance.id+" @ "+d(a.ts)+" ms";this.selectionGenerator=function(){return tracing.createSelectionFromObjectAndView(a,this)}.bind(this)}};var e=ui.define("object-instance-link",a);e.prototype={__proto__:a.prototype,decorate:function(){a.prototype.decorate.apply(this)},set objectInstance(a){this.textContent=a.typeName+" "+a.id;this.selectionGenerator=function(){return tracing.createSelectionFromObjectAndView(a,
this)}.bind(this)}};return{RequestSelectionChangeEvent:b,AnalysisLink:a,ObjectSnapshotLink:c,ObjectInstanceLink:e}});"use strict";base.requireStylesheet("tracing.analysis.generic_object_view");base.require("base.utils");base.require("tracing.analysis.analysis_link");base.require("ui");
base.exportTo("tracing.analysis",function(){var d=ui.define("x-generic-object-view");d.prototype={__proto__:HTMLUnknownElement.prototype,decorate:function(){this.object_=void 0},get object(){return this.object_},set object(b){this.object_=b;this.updateContents_()},updateContents_:function(){this.textContent="";this.appendElementsForType_("",this.object_,0,0,5,"")},appendElementsForType_:function(b,a,c,e,f,d){e>f?this.appendSimpleText_(b,c,"<recursion limit reached>",d):void 0===a?this.appendSimpleText_(b,
c,"undefined",d):null===a?this.appendSimpleText_(b,c,"null",d):a instanceof Object?a instanceof tracing.trace_model.ObjectSnapshot?(e=new tracing.analysis.ObjectSnapshotLink(a),e.objectSnapshot=a,this.appendElementWithLabel_(b,c,e,d)):a instanceof tracing.trace_model.ObjectInstance?(e=new tracing.analysis.ObjectInstanceLink(a),e.objectInstance=a,this.appendElementWithLabel_(b,c,e,d)):a instanceof Array?this.appendElementsForArray_(b,a,c,e,f,d):this.appendElementsForObject_(b,a,c,e,f,d):"string"==
typeof a?this.appendSimpleText_(b,c,'"'+a+'"',d):this.appendSimpleText_(b,c,a,d)},appendElementsForArray_:function(b,a,c,e,f,d){if(0==a.length)this.appendSimpleText_(b,c,"[]",d);else{this.appendElementsForType_(b+"[",a[0],c,e+1,f,1<a.length?",":"]"+d);for(var h=1;h<a.length;h++)this.appendElementsForType_("",a[h],c+b.length+1,e+1,f,h<a.length-1?",":"]"+d)}},appendElementsForObject_:function(b,a,c,e,f,d){var h=base.dictionaryKeys(a);if(0==h.length)this.appendSimpleText_(b,c,"{}",d);else{this.appendElementsForType_(b+
"{"+h[0]+": ",a[h[0]],c,e,f,1<h.length?",":"}"+d);for(var k=1;k<h.length;k++)this.appendElementsForType_(h[k]+": ",a[h[k]],c+b.length+1,e+1,f,k<h.length-1?",":"}"+d)}},appendElementWithLabel_:function(b,a,c,e){var f=document.createElement("div"),d=document.createElement("span");d.style.whiteSpace="pre";for(var h=0;h<a;h++)d.textContent+=" ";f.appendChild(d);a=document.createElement("span");a.textContent=b;f.appendChild(a);f.appendChild(c);b=document.createElement("span");b.textContent=e;f.appendChild(b);
f.dataElement=c;this.appendChild(f)},appendSimpleText_:function(b,a,c,e){var f=this.ownerDocument.createElement("span");f.textContent=c;this.appendElementWithLabel_(b,a,f,e);return f}};return{GenericObjectView:d}});"use strict";base.requireStylesheet("tracing.analysis.analysis_results");base.require("tracing.analysis.util");base.require("tracing.analysis.analysis_link");base.require("tracing.analysis.generic_object_view");base.require("ui");
base.exportTo("tracing.analysis",function(){var d=ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="analysis-results"},clear:function(){this.textContent=""},createSelectionChangingLink:function(b,a,c){var e=this.ownerDocument.createElement("a");tracing.analysis.AnalysisLink.decorate(e);e.textContent=b;e.selectionGenerator=a;c&&(e.title=c);return e},appendElement_:function(b,a,c){a=b.ownerDocument.createElement(a);b.appendChild(a);void 0!=c&&(a.textContent=
c);return a},appendText_:function(b,a){b.ownerDocument.createTextNode(a);b.appendChild(textNode);return textNode},appendTableCell_:function(b,a,c,e){a=this.appendElement_(a,"td",e);a.className=b.className+"-col-"+c;return a},appendTableCell:function(b,a,c){return this.appendTableCell_(b,a,a.children.length,c)},appendTableCellWithTooltip_:function(b,a,c,e,f){if(f)return a=this.appendElement_(a,"td"),a.className=b.className+"-col-"+c,b=this.appendElement_(a,"span",e),b.className="tooltip",b.title=f,
a;this.appendTableCell_(b,a,c,e)},appendTable:function(b,a){var c=this.appendElement_(this,"table");c.headerRow=this.appendElement_(c,"tr");c.className=b+" analysis-table";c.numColumns=a;return c},appendTableHeader:function(b,a){this.appendElement_(b.headerRow,"th",a).className="analysis-table-header"},appendTableRow:function(b){return this.appendElement_(b,"tr")},appendSummaryRow:function(b,a,c){var e=this.appendElement_(b,"tr");e.className="analysis-table-row";this.appendTableCell_(b,e,0,a);void 0!==
c?(a=new tracing.analysis.GenericObjectView,a.object=c,a.classList.add("analysis-table-col-1"),a.style.display="table-cell",e.appendChild(a)):this.appendTableCell_(b,e,1,"");for(c=2;c<b.numColumns;c++)this.appendTableCell_(b,e,c,"")},appendSpacingRow:function(b){var a=this.appendElement_(b,"tr");a.className="analysis-table-row";for(var c=0;c<b.numColumns;c++)this.appendTableCell_(b,a,c," ")},appendSummaryRowTime:function(b,a,c){this.appendSummaryRow(b,a,tracing.analysis.tsRound(c)+" ms")},appendDataRow:function(b,
a,c,e,f,d){var h=void 0;f&&(h="Min Duration:\t"+tracing.analysis.tsRound(f.min)+" ms \rMax Duration:\t"+tracing.analysis.tsRound(f.max)+" ms \rAvg Duration:\t"+tracing.analysis.tsRound(f.avg)+" ms (\u03c3 = "+tracing.analysis.tsRound(f.avg_stddev)+")",f.start&&(h+="\rStart Time:\t"+tracing.analysis.tsRound(f.start)+" ms"),f.end&&(h+="\rEnd Time:\t"+tracing.analysis.tsRound(f.end)+" ms"),f.frequency&&f.frequency_stddev&&(h+="\rFrequency:\t"+tracing.analysis.tsRound(f.frequency)+" occurrences/s (\u03c3 = "+
tracing.analysis.tsRound(f.frequency_stddev)+")"));f=this.appendElement_(b,"tr");f.className="analysis-table-row";if(d){var k=this.appendTableCellWithTooltip_(b,f,0,a,h);k.textContent="";k.appendChild(this.createSelectionChangingLink(a,d,h))}else this.appendTableCellWithTooltip_(b,f,0,a,h);void 0!==c?c instanceof Array?this.appendTableCellWithTooltip_(b,f,1,"["+c.join(", ")+"]",h):this.appendTableCellWithTooltip_(b,f,1,tracing.analysis.tsRound(c)+" ms",h):this.appendTableCell_(b,f,1,"");void 0!==
e?this.appendTableCellWithTooltip_(b,f,2,String(e)+" occurrences",h):this.appendTableCell_(b,f,2,"")}};return{AnalysisResults:d}});"use strict";base.require("tracing.analysis.util");base.require("ui");
base.exportTo("tracing.analysis",function(){return{analyzeSingleCounterSampleHit:function(d,b){for(var a=b.counter,c=b.sampleIndex,e=[],f=0;f<a.numSeries;++f)e.push(a.getSeries(f).getSample(c).value);var g=d.appendTable("analysis-counter-table",2);d.appendTableHeader(g,"Selected counter:");d.appendSummaryRow(g,"Title",a.name);d.appendSummaryRowTime(g,"Timestamp",a.timestamps[c]);for(f=0;f<a.numSeries;f++)d.appendSummaryRow(g,a.getSeries(f).name,e[f])},analyzeMultipleCounterSampleHits:function(d,b){for(var a=
{},c=0;c<b.length;c++){var e=b[c].counter;a[e.guid]||(a[e.guid]=[]);a[e.guid].push(b[c])}var f=d.appendTable("analysis-counter-table",2);d.appendTableHeader(f,"Counters:");for(var g in a){for(var h=a[g],e=h[0].counter,k=[],c=0;c<h.length;c++)k.push(h[c].sampleIndex);h=e.getSampleStatistics(k);for(c=0;c<h.length;c++){for(var l=[],m=0;m<k.length;++m)l.push(e.getSeries(c).getSample(k[m]).value);d.appendDataRow(f,e.name+": series("+e.getSeries(c).name+")",l,l.length,h[c])}}}}});"use strict";base.requireStylesheet("tracing.analysis.analyze_slices");
base.require("tracing.analysis.util");base.require("ui");
base.exportTo("tracing.analysis",function(){function d(b,a){var c=a.slice,e=b.appendTable("analysis-slice-table",2);b.appendTableHeader(e,"Selected slice:");b.appendSummaryRow(e,"Title",c.title);c.category&&b.appendSummaryRow(e,"Category",c.category);b.appendSummaryRowTime(e,"Start",c.start);b.appendSummaryRowTime(e,"Duration",c.duration);c.durationInUserTime&&b.appendSummaryRowTime(e,"Duration (U)",c.durationInUserTime);var f=0,d;for(d in c.args)f+=1;if(0<f)for(d in b.appendSummaryRow(e,"Args"),
c.args)b.appendSummaryRow(e," "+d,c.args[d])}return{analyzeSingleSliceHit:d,analyzeMultipleSliceHits:function(b,a){var c=a.bounds.min,e=a.bounds.max;a.map(function(a){return a.slice.title});for(var f=0,g={},h=0;h<a.length;h++){var k=a[h].slice;g[k.title]||(g[k.title]={hits:[]},f++);g[k.title].hits.push(a[h])}var l;l=b.appendTable("analysis-slices-table",3);b.appendTableHeader(l,"Slices:");var m=0;base.iterItems(g,function(a,c){for(var e=0,g=0,h=Number.MAX_VALUE,k=-Number.MAX_VALUE,s=Number.MAX_VALUE,
r=-Number.MAX_VALUE,g=0;g<c.hits.length;g++)var u=c.hits[g].slice,e=e+u.duration,h=Math.min(u.start,h),k=Math.max(u.start,k),s=Math.min(u.duration,s),r=Math.max(u.duration,r);m+=e;0==c.hits.length&&(g=0);g=e/c.hits.length;s={min:s,max:r,avg:g,avg_stddev:void 0,frequency:void 0,frequency_stddev:void 0};for(g=r=0;g<c.hits.length;g++)u=s.avg-c.hits[g].slice.duration,r+=u*u;s.avg_stddev=Math.sqrt(r/(c.hits.length-1));k-=h;if(2<c.hits.length&&0<k){h=c.hits.length-1;s.frequency=1E3*h/k;r=0;for(g=1;g<c.hits.length;g++)u=
s.frequency-1E3/(c.hits[g].slice.start-c.hits[g-1].slice.start),r+=u*u;s.frequency_stddev=Math.sqrt(r/(h-1))}b.appendDataRow(l,a,e,c.hits.length,s,function(){return new tracing.Selection(c.hits)});if(1===f)for(g=0;g<c.hits.length;g++)d(b,c.hits[g])});1!==f&&(b.appendDataRow(l,"*Totals",m,a.length),b.appendSpacingRow(l));b.appendSummaryRowTime(l,"Selection start",c);b.appendSummaryRowTime(l,"Selection extent",e-c)}}});"use strict";base.require("tracing.analysis.analyze_counters");base.require("tracing.analysis.analyze_slices");
base.require("tracing.analysis.util");base.require("ui");
base.exportTo("tracing.analysis",function(){function d(a,c){var e=c.slices,f=c.counterSamples,d=new tracing.Selection;d.addSelection(c.objectSnapshots);d.addSelection(c.objectInstances);1==e.length?tracing.analysis.analyzeSingleSliceHit(a,e[0]):1<e.length&&tracing.analysis.analyzeMultipleSliceHits(a,e);1==f.length?tracing.analysis.analyzeSingleCounterSampleHit(a,f[0]):1<f.length&&tracing.analysis.analyzeMultipleCounterSampleHits(a,f);d.length&&b(a,d)}function b(a,c){c=base.asArray(c).sort(base.Range.compareByMinTimes);
var b=a.appendTable("analysis-object-sample-table",2);a.appendTableHeader(b,"Selected Objects:");c.forEach(function(c){var d=a.appendTableRow(b),h,k,l;if(c instanceof tracing.SelectionObjectSnapshotHit){var m=c.objectSnapshot;h=tracing.analysis.tsRound(m.ts);k=m.objectInstance.typeName+" "+m.objectInstance.id;l=function(){var a=new tracing.Selection;a.addObjectSnapshot(c.track,m);return a}}else{var n=c.objectInstance;h=n.deletionTs==Number.MAX_VALUE?"":tracing.analysis.tsRound(n.deletionTs);h=tracing.analysis.tsRound(n.creationTs)+
"-"+h;k=n.typeName+" "+n.id;l=function(){var a=new tracing.Selection;a.addObjectInstance(c.track,n);return a}}a.appendTableCell(b,d,h);a.appendTableCell(b,d,"").appendChild(a.createSelectionChangingLink(k,l))})}return{analyzeSelection:function(a,c){d(a,c.getHitsOrganizedByType())},analyzeHitsByType:d}});"use strict";base.require("ui");
base.exportTo("tracing.analysis",function(){var d=ui.define("object-instance-view");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.objectInstance_=void 0},set modelObject(b){this.objectInstance=b},get modelObject(){return this.objectInstance},get objectInstance(){return this.objectInstance_},set objectInstance(b){this.objectInstance_=b;this.updateContents()},updateContents:function(){throw Error("Not implemented");}};d.typeNameToViewInfoMap={};d.register=function(b,a,c){if(d.typeNameToViewInfoMap[b])throw Error("Handler already registerd for "+
b);d.typeNameToViewInfoMap[b]={constructor:a,options:c||{showInTrackView:!0}}};d.unregister=function(b){if(void 0===d.typeNameToViewInfoMap[b])throw Error(b+" not registered");delete d.typeNameToViewInfoMap[b]};d.getViewInfo=function(b){return d.typeNameToViewInfoMap[b]};return{ObjectInstanceView:d}});"use strict";base.require("ui");
base.exportTo("tracing.analysis",function(){var d=ui.define("object-snapshot-view");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.objectSnapshot_=void 0},set modelObject(b){this.objectSnapshot=b},get modelObject(){return this.objectSnapshot},get objectSnapshot(){return this.objectSnapshot_},set objectSnapshot(b){this.objectSnapshot_=b;this.updateContents()},updateContents:function(){throw Error("Not implemented");}};d.typeNameToViewInfoMap={};d.register=function(b,a,c){if(d.typeNameToViewInfoMap[b])throw Error("Handler already registered for "+
b);d.typeNameToViewInfoMap[b]={constructor:a,options:c||{showInTrackView:!0}}};d.unregister=function(b){if(void 0===d.typeNameToViewInfoMap[b])throw Error(b+" not registered");delete d.typeNameToViewInfoMap[b]};d.getViewInfo=function(b){return d.typeNameToViewInfoMap[b]};return{ObjectSnapshotView:d}});"use strict";base.requireStylesheet("tracing.analysis.default_object_view");base.require("tracing.analysis.analysis_link");base.require("tracing.analysis.object_instance_view");base.require("tracing.analysis.object_snapshot_view");
base.require("tracing.analysis.util");
base.exportTo("tracing.analysis",function(){var d=tracing.analysis.tsRound,b=ui.define("default-object-snapshot-view",tracing.analysis.ObjectSnapshotView);b.prototype={__proto__:tracing.analysis.ObjectSnapshotView.prototype,decorate:function(){tracing.analysis.ObjectSnapshotView.prototype.decorate.apply(this);this.classList.add("default-object-view");this.classList.add("default-object-snapshot-view")},updateContents:function(){var a=this.objectSnapshot;if(a){var b=a.objectInstance,f;f=""+('<div class="title">Snapshot of <a id="instance-link"></a> @ '+
d(a.ts)+"ms</div>\n");f+="<table><tr>";f+='<tr><td>args:</td><td id="args"></td></tr>\n';this.innerHTML=f+="</table>";f=new tracing.analysis.ObjectInstanceLink;f.objectInstance=b;b=this.querySelector("#instance-link");b.parentElement.replaceChild(f,b);this.querySelector("#args").textContent=JSON.stringify(a.args,null,2)}else this.textContent=""}};var a=ui.define("default-object-instance-view",tracing.analysis.ObjectInstanceView);a.prototype={__proto__:tracing.analysis.ObjectInstanceView.prototype,
decorate:function(){tracing.analysis.ObjectInstanceView.prototype.decorate.apply(this);this.classList.add("default-object-view");this.classList.add("default-object-instance-view")},updateContents:function(){var a=this.objectInstance;if(a){var b;b=""+('<div class="title">'+a.typeName+" "+a.id+"</div>\n");b+="<table><tr>";b+="<tr><td>creationTs:</td><td>"+a.creationTs+"</td></tr>\n";b=a.deletionTs!=Number.MAX_VALUE?b+("<tr><td>deletionTs:</td><td>"+a.deletionTs+"</td></tr>\n"):b+"<tr><td>deletionTs:</td><td>not deleted</td></tr>\n";
b+='<tr><td>snapshots:</td><td id="snapshots"></td></tr>\n';this.innerHTML=b+="</table>";var d=this.querySelector("#snapshots");a.snapshots.forEach(function(a){var c=new tracing.analysis.ObjectSnapshotLink;c.objectSnapshot=a;d.appendChild(c)})}else this.textContent=""}};return{DefaultObjectSnapshotView:b,DefaultObjectInstanceView:a}});"use strict";base.require("ui");
base.exportTo("tracing.analysis",function(){var d=ui.define("slice-view");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.objectInstance_=void 0},set modelObject(b){this.slice=b},get modelObject(){return this.slice},get slice(){return this.slice_},set slice(b){this.slice_=b;this.updateContents()},updateContents:function(){throw Error("Not implemented");}};d.titleToViewInfoMap={};d.register=function(b,a){if(d.titleToViewInfoMap[b])throw Error("Handler already registerd for "+
b);d.titleToViewInfoMap[b]={constructor:a}};d.unregister=function(b){if(void 0===d.titleToViewInfoMap[b])throw Error(b+" not registered");delete d.titleToViewInfoMap[b]};d.getViewInfo=function(b){return d.titleToViewInfoMap[b]};return{SliceView:d}});"use strict";base.requireStylesheet("tracing.analysis.analysis_view");base.require("base.guid");base.require("tracing.analysis.analysis_results");base.require("tracing.analysis.analyze_selection");base.require("tracing.analysis.default_object_view");base.require("tracing.analysis.object_instance_view");
base.require("tracing.analysis.object_snapshot_view");base.require("tracing.analysis.slice_view");base.require("tracing.analysis.util");base.require("ui");
base.exportTo("tracing.analysis",function(){var d=ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="analysis-view";this.currentSelection_=this.currentView_=void 0;this.selections_=[];this.guid_=base.GUID.allocate();window.addEventListener("popstate",this.onPopState.bind(this))},changeViewType:function(b){if(!(this.currentView_ instanceof b)){this.textContent="";try{this.currentView_=new b,this.appendChild(this.currentView_)}catch(a){throw this.currentView_=
void 0,a;}this.currentView_ instanceof tracing.analysis.AnalysisResults?this.classList.remove("viewing-object"):this.classList.add("viewing-object")}},get currentView(){return this.currentView_},get selection(){return this.currentSelection_},set selection(b){this.selections_.push(b);window.history.pushState({view_guid:this.guid_,selection_guid:b.guid});this.processSelection(b)},clearSelectionHistory:function(){this.selections_=[]},onPopState:function(b){if(null!==b.state&&b.state.view_guid===this.guid_){var a;
for(a=0;a<this.selections_.length&&this.selections_[a].guid!==b.state.selection_guid;++a);a>=this.selections_.length||(this.processSelection(this.selections_[a]),b.stopPropagation())}},processSelection:function(b){var a=b.getHitsOrganizedByType();1==b.length&&0==a.counterSamples.length&&this.tryToProcessSelectionUsingCustomViewer(b[0])||(this.changeViewType(tracing.analysis.AnalysisResults),this.currentView.clear(),this.currentSelection_=b,tracing.analysis.analyzeHitsByType(this.currentView,a))},
tryToProcessSelectionUsingCustomViewer:function(b){var a,c,e;a=b.modelObject;if(b instanceof tracing.SelectionObjectSnapshotHit)c=a.objectInstance.typeName,e=tracing.analysis.ObjectSnapshotView,b=tracing.analysis.DefaultObjectSnapshotView;else if(b instanceof tracing.SelectionObjectInstanceHit)c=a.typeName,e=tracing.analysis.ObjectInstanceView,b=tracing.analysis.DefaultObjectInstanceView;else if(b instanceof tracing.SelectionSliceHit)c=a.title,e=tracing.analysis.SliceView,b=void 0;else return!1;b=
(c=e.getViewInfo(c))?c.constructor:b;if(!b)return!1;this.changeViewType(b);this.currentView.modelObject=a;return!0}};return{AnalysisView:d}});"use strict";base.require("base.events");
base.exportTo("base",function(){function d(a,c,b,e,d,m){d=new base.Event(c+"Change",d,m);d.propertyName=c;d.newValue=b;d.oldValue=e;var n;d.throwError=function(a){n=a};a.dispatchEvent(d);if(n)throw n;}function b(a){return a.replace(/([A-Z])/g,"-$1").toLowerCase()}function a(a,c){switch(c){case e.JS:var d=a+"_base_";return function(){return this[d]};case e.ATTR:var k=b(a);return function(){return this.getAttribute(k)};case e.BOOL_ATTR:return k=b(a),function(){return this.hasAttribute(k)}}}function c(a,
c,h,k,l){switch(c){case e.JS:var m=a+"_base_";return function(c){var b=this[m];c!==b&&(this[m]=c,h&&h.call(this,c,b),d(this,a,c,b,k,l))};case e.ATTR:var n=b(a);return function(c){var b=this.getAttribute(n);c!==b&&(void 0==c?this.removeAttribute(n):this.setAttribute(n,c),h&&h.call(this,c,b),d(this,a,c,b,k,l))};case e.BOOL_ATTR:return n=b(a),function(c){var b=this.getAttribute(n)===a;c!==b&&(c?this.setAttribute(n,a):this.removeAttribute(n),h&&h.call(this,c,b),d(this,a,c,b,k,l))}}}var e={JS:"js",ATTR:"attr",
BOOL_ATTR:"boolAttr"};return{PropertyKind:e,defineProperty:function(b,d,h,k,l,m){console.error("Don't use base.defineProperty");"function"==typeof b&&(b=b.prototype);h=h||e.JS;b.__lookupGetter__(d)||b.__defineGetter__(d,a(d,h));b.__lookupSetter__(d)||b.__defineSetter__(d,c(d,h,k,l,m))},dispatchPropertyChange:d,setPropertyAndDispatchChange:function(a,c,b){var e=a[c];a[c+"_"]=b;e!==b&&base.dispatchPropertyChange(a,c,b,e,!0,!1)}}});"use strict";base.requireStylesheet("ui.overlay");base.require("base.properties");
base.require("base.events");base.require("ui");
base.exportTo("ui",function(){var d=ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("overlay-root");this.createToolBar_();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.onKeydown_=this.onKeydown_.bind(this);this.onFocusIn_=this.onFocusIn_.bind(this);this.addEventListener("mousedown",
this.onMousedown_.bind(this))},toggleToolbar:function(a){a?this.contentHost.firstChild?this.contentHost.insertBefore(this.contentHost.firstChild,this.toolbar_):this.contentHost.appendChild(this.toolbar_):this.toolbar_.parentElement&&this.contentHost.removeChild(this.toolbar_)},createToolBar_:function(){this.toolbar_=this.ownerDocument.createElement("div");this.toolbar_.className="tool-bar";this.exitButton_=this.ownerDocument.createElement("span");this.exitButton_.className="exit-button";this.exitButton_.textContent=
"x";this.exitButton_.title="Close Overlay (esc)";this.toolbar_.appendChild(this.exitButton_)},showOverlay:function(a){a.oldParent_=a.parentNode;this.contentHost.appendChild(a);this.contentHost.appendChild(this.tabCatcher);this.ownerDocument.body.classList.add("disabled-by-overlay");a.tabIndex=0;var c=a.querySelector("button, input, list, select, a");c||(c=a);c.focus();this.ownerDocument.addEventListener("focusin",this.onFocusIn_,!0);a.addEventListener("keydown",this.onKeydown_)},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.onKeydown_);this.ownerDocument.removeEventListener("focusin",this.onFocusIn_)}};var b=ui.define("div");b.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){if(!this.ownerDocument.querySelector(".overlay-root")){var a=this.ownerDocument.createElement("div");ui.decorate(a,d);this.ownerDocument.body.appendChild(a)}this.classList.add("overlay");this.obeyCloseEvents=this.visible_=!1;this.additionalCloseKeyCodes=
[];this.onKeyDown=this.onKeyDown.bind(this);this.onKeyPress=this.onKeyPress.bind(this);this.onDocumentClick=this.onDocumentClick.bind(this);this.addEventListener("visibleChange",b.prototype.onVisibleChange_.bind(this),!0);this.obeyCloseEvents=!0},get visible(){return this.visible_},set visible(a){base.setPropertyAndDispatchChange(this,"visible",a)},get obeyCloseEvents(){return this.obeyCloseEvents_},set obeyCloseEvents(a){base.setPropertyAndDispatchChange(this,"obeyCloseEvents",a);this.ownerDocument.querySelector(".overlay-root").toggleToolbar(a)},
get toolbar(){return this.ownerDocument.querySelector(".overlay-root .tool-bar")},onVisibleChange_:function(){var a=this.ownerDocument.querySelector(".overlay-root");this.visible?(a.setAttribute("visible","visible"),a.showOverlay(this),document.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("keypress",this.onKeyPress,!0),document.addEventListener("click",this.onDocumentClick,!0)):(a.removeAttribute("visible"),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.obeyCloseEvents&&27==a.keyCode&&(this.visible=!1,a.preventDefault())},onKeyPress:function(a){if(this.obeyCloseEvents)for(var c=0;c<this.additionalCloseKeyCodes.length;c++)if(a.keyCode==this.additionalCloseKeyCodes[c]){this.visible=!1;a.preventDefault();break}},onDocumentClick:function(a){if(this.obeyCloseEvents){for(var c=a.target;null!==c;){if(c===this)return;c=c.parentNode}this.visible=
!1;a.preventDefault()}}};return{Overlay:b}});"use strict";base.requireTemplate("tracing.category_filter_dialog");base.require("base.utils");base.require("tracing.filter");base.require("ui.overlay");
base.exportTo("tracing",function(){var d=ui.define("div");d.prototype={__proto__:ui.Overlay.prototype,decorate:function(){ui.Overlay.prototype.decorate.call(this);this.className="view-category-filter-overlay";this.obeyCloseEvents=!0;var b=base.instantiateTemplate("#view-category-filter-dialog-template");this.appendChild(b);this.formEl_=this.querySelector("form");this.categoriesEl_=this.querySelector(".categories");this.addEventListener("visibleChange",this.onVisibleChange_.bind(this))},set categories(b){this.categories_=
b},set settingUpdatedCallback(b){this.settingUpdatedCallback_=b},unselectedCategories_:function(){for(var b=this.formEl_.querySelectorAll("input"),a=[],c=0;c<b.length;++c){var e=b[c];!1===e.checked&&a.push(e.value)}return a},onVisibleChange_:function(){this.visible&&this.updateForm_()},updateForm_:function(){this.categoriesEl_.innerHTML="";for(var b=this.categories_.sort(),a=0;a<b.length;a++){var c=b[a],e=document.createElement("input");e.type="checkbox";e.id=c;e.value=c;e.checked=!0;e.onchange=this.updateSetting_.bind(this);
var d=document.createElement("label");d.textContent=c;d.setAttribute("for",c);c=document.createElement("div");c.appendChild(e);c.appendChild(d);this.categoriesEl_.appendChild(c)}},updateSetting_:function(b){void 0!==this.settingUpdatedCallback_&&this.settingUpdatedCallback_(this.unselectedCategories_())}};return{CategoryFilterDialog:d}});"use strict";base.exportTo("tracing",function(){return{mouseModeConstants:{MOUSE_MODE_SELECTION:1,MOUSE_MODE_PANSCAN:2,MOUSE_MODE_ZOOM:3}}});"use strict";base.require("base.events");
base.exportTo("tracing",function(){function d(a){this.parentEl_=a;this.modelTrackContainer_=null;this.scaleX_=1;this.gridTimebase_=this.panY_=this.panX_=0;this.gridStep_=1E3/60;this.hasCalledSetupFunction_=this.gridEnabled_=!1;this.onResize_=this.onResize_.bind(this);this.onModelTrackControllerScroll_=this.onModelTrackControllerScroll_.bind(this);this.checkForAttachInterval_=setInterval(this.checkForAttach_.bind(this),250);this.markers=[]}function b(a,c){this.viewport_=a;this.positionWorld_=c;this.selected_=
!1}d.prototype={__proto__:base.EventTarget.prototype,setWhenPossible:function(a){this.pendingSetFunction_=a},get isAttachedToDocument_(){var a=this.parentEl_;if(void 0!==a){for(;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.onResize_));var a=this.parentEl_.clientWidth+"x"+this.parentEl_.clientHeight;if(this.pendingSetFunction_){this.lastSize_=a;try{this.pendingSetFunction_()}catch(c){console.log("While running setWhenPossible:",c.message?c.message+"\n"+c.stack:c.stack)}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.onResize_),this.parentEl_.removeChild(this.iframe_))},getStateInViewCoordinates:function(){return{panX:this.xWorldVectorToView(this.panX),panY:this.panY,scaleX:this.scaleX}},setStateInViewCoordinates:function(a){this.panX=
this.xViewVectorToWorld(a.panX);this.panY=a.panY},onModelTrackControllerScroll_:function(a){this.panY_=this.modelTrackContainer_.scrollTop},set modelTrackContainer(a){this.modelTrackContainer_&&this.modelTrackContainer_.removeEventListener("scroll",this.onModelTrackControllerScroll_);this.modelTrackContainer_=a;this.modelTrackContainer_.addEventListener("scroll",this.onModelTrackControllerScroll_)},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())},get panY(){return this.panY_},set panY(a){this.panY_=a;this.modelTrackContainer_.scrollTop=a},setPanAndScale:function(a,c){if(this.scaleX_!=c||this.panX_!=a)this.scaleX_=c,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,c,b){if("string"==typeof c)if("left"==c)c=0;else if("center"==c)c=b/2;else if("right"==c)c=b-1;else throw Error("unrecognized string for viewPos. left|center|right");this.panX=c/this.scaleX_-a},xPanWorldBoundsIntoView:function(a,c,b){0>this.xWorldToView(a)?this.xPanWorldPosToViewPos(a,"left",b):this.xWorldToView(c)>b&&this.xPanWorldPosToViewPos(c,"right",b)},xSetWorldBounds:function(a,c,b){this.setPanAndScale(-a,b/(c-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,this.dispatchChangeEvent())},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 b(this,a);this.markers.push(a);this.dispatchChangeEvent();this.dispatchMarkersChangeEvent_();return a},removeMarker:function(a){for(var c=
0;c<this.markers.length;++c)if(this.markers[c]===a)return this.markers.splice(c,1),this.dispatchChangeEvent(),this.dispatchMarkersChangeEvent_(),!0},findMarkerNear:function(a,c){for(var b=this.xViewVectorToWorld(c),d=0;d<this.markers.length;++d)if(Math.abs(this.markers[d].positionWorld-a)<=b)return this.markers[d]},drawGridLines:function(a,c,b){if(this.gridEnabled){var d=this.gridTimebase;for(a.beginPath();d<b;){if(d>=c){var g=this.xWorldToView(d);a.moveTo(g,0);a.lineTo(g,a.canvas.height)}d+=this.gridStep}a.strokeStyle=
"rgba(255,0,0,0.25)";a.stroke()}},drawMarkerArrows:function(a,c,b,d){for(var g=0;g<this.markers.length;++g)this.markers[g].drawTriangle_(a,c,b,a.canvas.height,d,this)},drawMarkerLines:function(a,c,b){for(var d=0;d<this.markers.length;++d)this.markers[d].drawLine(a,c,b,a.canvas.height,this)}};b.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,c,b,d,g,h){a.beginPath();var k=this.positionWorld_;k<c||k>b||(c=h.xWorldToView(k),a.moveTo(c,g),a.lineTo(c-3,g/2),a.lineTo(c+3,g/2),a.lineTo(c,g),a.closePath(),a.fillStyle=this.color,a.fill(),g!==d&&(a.beginPath(),a.moveTo(c,g),a.lineTo(c,d),a.closePath(),a.strokeStyle=this.color,a.stroke()))},drawLine:function(a,c,b,d,g){a.beginPath();var h=this.positionWorld_;h>=c&&h<b&&(c=
g.xWorldToView(h),a.moveTo(c,0),a.lineTo(c,d));a.strokeStyle=this.color;a.stroke()}};return{TimelineViewport:d,ViewportMarker:b}});"use strict";base.require("base.utils");
base.exportTo("base",function(){function d(a){try{a.callback.call(a.context)}catch(c){base.onAnimationFrameError(c,a.stack)}}function b(){k=!1;var a=f;h=g;f=[];g=[];for(var c=0;c<a.length;c++)d(a[c]);for(;0<h.length;)d(h.shift());h=void 0}function a(){if(!e)return"";var a=base.stackTrace();a.shift();return a.join("\n")}function c(c,e){g.push({callback:c,context:e||window,stack:a()});k||(k=!0,window.webkitRequestAnimationFrame(b))}var e=!1,f=[],g=[],h=void 0,k=!1;return{onAnimationFrameError:function(a,
c){c&&console.log(c);a.message?console.error(a.message,a.stack):console.error(a)},requestPreAnimationFrame:function(c,e){f.push({callback:c,context:e||window,stack:a()});k||(k=!0,window.webkitRequestAnimationFrame(b))},requestAnimationFrame:c,requestAnimationFrameInThisFrameIfPossible:function(b,e){h?h.push({callback:b,context:e||window,stack:a()}):c(b,e)}}});"use strict";base.require("base.events");base.require("ui");
base.exportTo("ui",function(){var d=ui.define("div");d.prototype={__proto__:HTMLUnknownElement.prototype,decorate:function(){this.observer_=new WebKitMutationObserver(this.didMutate_.bind(this));this.observer_.observe(this,{childList:!0});Object.defineProperty(this,"textContent",{get:void 0,set:this.onSetTextContent_})},appendChild:function(b){HTMLUnknownElement.prototype.appendChild.call(this,b);this.didMutate_(this.observer_.takeRecords())},insertBefore:function(b,a){HTMLUnknownElement.prototype.insertBefore.call(this,
b,a);this.didMutate_(this.observer_.takeRecords())},removeChild:function(b){HTMLUnknownElement.prototype.removeChild.call(this,b);this.didMutate_(this.observer_.takeRecords())},replaceChild:function(b,a){HTMLUnknownElement.prototype.replaceChild.call(this,b,a);this.didMutate_(this.observer_.takeRecords())},onSetTextContent_:function(b){if(""!=b)throw Error("textContent can only be set to ''.");this.clear()},clear:function(){for(;this.lastChild;)HTMLUnknownElement.prototype.removeChild.call(this,this.lastChild);
this.didMutate_(this.observer_.takeRecords())},didMutate_:function(b){this.beginDecorating_();for(var a=0;a<b.length;a++){var c=b[a].addedNodes;if(c)for(var e=0;e<c.length;e++)this.decorateChild_(c[e]);if(c=b[a].removedNodes)for(e=0;e<c.length;e++)this.undecorateChild_(c[e])}this.doneDecoratingForNow_()},decorateChild_:function(b){throw Error("Not implemented");},undecorateChild_:function(b){throw Error("Not implemented");},beginDecorating_:function(){},doneDecoratingForNow_:function(){}};return{ContainerThatDecoratesItsChildren:d}});
"use strict";base.requireStylesheet("tracing.tracks.track");base.require("ui");base.require("ui.container_that_decorates_its_children");base.require("tracing.color_scheme");
base.exportTo("tracing.tracks",function(){var d=tracing.getColorPaletteHighlightIdBoost(),b=ui.define("track",ui.ContainerThatDecoratesItsChildren);b.prototype={__proto__:ui.ContainerThatDecoratesItsChildren.prototype,decorate:function(a){ui.ContainerThatDecoratesItsChildren.prototype.decorate.call(this);if(void 0===a)throw Error("viewport is required when creating a Track.");this.viewport_=a;this.classList.add("track");this.categoryFilter_=void 0},get viewport(){return this.viewport_},context:function(){if(this.parentNode){if(!this.parentNode.context)throw Error("Parent container does not support context() method.");
return this.parentNode.context()}},get categoryFilter(){return this.categoryFilter_},set categoryFilter(a){this.categoryFilter_!=a&&(this.categoryFilter_=a,this.updateContents_())},decorateChild_:function(a){a instanceof b&&(a.categoryFilter=this.categoryFilter)},undecorateChild_:function(a){a.detach&&a.detach()},updateContents_:function(){},drawTrack:function(a){var c=this.context();if(void 0!==c){c.save();var b=this.setupCanvasForDraw_();this.draw(a,b.left,b.right);c.restore()}},draw:function(a,
c,b){},setupCanvasForDraw_:function(){var a=this.context(),c=window.devicePixelRatio||1,b=this.getBoundingClientRect(),d=a.canvas.getBoundingClientRect();a.translate(0,c*(b.top-d.top));a=this.viewport.xViewToWorld(0);c=this.viewport.xViewToWorld(b.width*c);return{left:a,right:c}},decorateHit:function(a){},addIntersectingItemsInRangeToSelection:function(a,c,b,d,g){var h=window.devicePixelRatio||1,k=this.viewport.xViewVectorToWorld(1);a=this.viewport.xViewToWorld(a*h);c=this.viewport.xViewToWorld(c*
h);h=this.getBoundingClientRect();b=Math.max(b,h.top);d=Math.min(d,h.bottom);b>d||this.addIntersectingItemsInRangeToSelectionInWorldSpace(a,c,k,g)},addIntersectingItemsInRangeToSelectionInWorldSpace:function(a,c,b,d){},drawInstantEvents_:function(a,c,b){var f=this.context(),g=window.devicePixelRatio||1,g=this.getBoundingClientRect().height*g,h=this.viewport,k=h.xViewVectorToWorld(1),l=tracing.getColorPalette();f.save();h.applyTransformToCanvas(f);h=new tracing.FastRectRenderer(f,2*k,2*k,l);h.setYandH(0,
g);for(c=base.findLowIndexInSortedArray(a,function(a){return a.start},c);c<a.length;++c){var m=a[c],n=m.start;if(n>b)break;Math.max(m.duration,0.001);m=m.selected?m.colorId+d:m.colorId;0.001<k?h.fillRect(n,k,m):(f.fillStyle=l[m],f.beginPath(),f.moveTo(n-4*k,g),f.lineTo(n,0),f.lineTo(n+4*k,g),f.closePath(),f.fill())}h.flush();f.restore()}};return{Track:b}});"use strict";base.requireStylesheet("tracing.tracks.drawing_container");base.require("base.raf");base.require("tracing.tracks.track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d={SLICE:1,INSTANT_EVENT:2},b=ui.define("drawing-container",tracing.tracks.Track);b.prototype={__proto__:tracing.tracks.Track.prototype,decorate:function(a){tracing.tracks.Track.prototype.decorate.call(this,a);this.classList.add("drawing-container");this.canvas_=document.createElement("canvas");this.canvas_.className="drawing-container-canvas";this.canvas_.style.left=tracing.constants.HEADING_WIDTH+"px";this.appendChild(this.canvas_);this.ctx_=this.canvas_.getContext("2d");
this.viewportChange_=this.viewportChange_.bind(this);this.viewport.addEventListener("change",this.viewportChange_)},get canvas(){return this.canvas_},context:function(){return this.ctx_},viewportChange_:function(){this.invalidate()},invalidate:function(){this.rafPending_||(this.rafPending_=!0,base.requestPreAnimationFrame(function(){this.rafPending_=!1;this.ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height);this.updateCanvasSizeIfNeeded_();base.requestAnimationFrameInThisFrameIfPossible(function(){for(var a=
0;a<this.children.length;++a)this.children[a]instanceof tracing.tracks.Track&&this.children[a].drawTrack(d.INSTANT_EVENT);for(a=0;a<this.children.length;++a)this.children[a]instanceof tracing.tracks.Track&&this.children[a].drawTrack(d.SLICE);var c=window.devicePixelRatio||1,b=this.canvas_.getBoundingClientRect(),a=this.viewport.xViewToWorld(0),c=this.viewport.xViewToWorld(b.width*c);this.viewport.drawGridLines(this.ctx_,a,c);this.viewport.drawMarkerLines(this.ctx_,a,c)},this)},this))},updateCanvasSizeIfNeeded_:function(){var a=
base.asArray(this.children).filter(this.visibleFilter_),b=this.getBoundingClientRect(),e=a[0].getBoundingClientRect(),d=a[a.length-1].getBoundingClientRect(),a=e.width-tracing.constants.HEADING_WIDTH,d=d.bottom-e.top,g=window.devicePixelRatio||1;this.canvas_.width!=a*g&&(this.canvas_.width=a*g,this.canvas_.style.width=a+"px");this.canvas_.height!=d*g&&(this.canvas_.height=d*g,this.canvas_.style.height=d+"px");b=e.top-b.top+this.scrollTop;this.canvas_.style.top+"px"!==b&&(this.canvas_.style.top=b+
"px")},visibleFilter_:function(a){return a instanceof tracing.tracks.Track?"none"!==window.getComputedStyle(a).display:!1}};return{DrawingContainer:b,DrawType:d}});"use strict";base.exportTo("tracing",function(){return{constants:{HEADING_WIDTH:250}}});"use strict";base.requireStylesheet("tracing.tracks.heading_track");base.require("tracing.constants");base.require("tracing.tracks.track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=ui.define("heading-track",tracing.tracks.Track);d.prototype={__proto__:tracing.tracks.Track.prototype,decorate:function(b){tracing.tracks.Track.prototype.decorate.call(this,b);this.classList.add("heading-track");this.headingDiv_=document.createElement("heading");this.headingDiv_.style.width=tracing.constants.HEADING_WIDTH+"px";this.appendChild(this.headingDiv_)},get heading(){return this.headingDiv_.textContent},set heading(b){this.headingDiv_.textContent=
b},set tooltip(b){this.headingDiv_.title=b},draw:function(b,a,c){throw Error("draw implementation missing");}};return{HeadingTrack:d}});"use strict";base.requireStylesheet("tracing.tracks.ruler_track");base.require("tracing.constants");base.require("tracing.tracks.track");base.require("tracing.tracks.heading_track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=ui.define("ruler-track",tracing.tracks.HeadingTrack),b=Math.log(10);d.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,decorate:function(a){tracing.tracks.HeadingTrack.prototype.decorate.call(this,a);this.classList.add("ruler-track");this.strings_secs_=[];this.strings_msecs_=[];this.addEventListener("mousedown",this.onMouseDown);this.viewportMarkersChange_=this.viewportMarkersChange_.bind(this);a.addEventListener("markersChange",this.viewportMarkersChange_)},
detach:function(){tracing.tracks.HeadingTrack.prototype.detach.call(this);this.viewport.removeEventListener("markersChange",this.viewportMarkersChange_)},viewportMarkersChange_:function(){2>this.viewport.markers.length?this.classList.remove("ruler-track-with-distance-measurements"):this.classList.add("ruler-track-with-distance-measurements")},onMouseDown:function(a){0===a.button&&this.placeAndBeginDraggingMarker(a.clientX)},placeAndBeginDraggingMarker:function(a){var b=window.devicePixelRatio||1;
a=this.viewport.xViewToWorld((a-this.offsetLeft-tracing.constants.HEADING_WIDTH)*b);var e=this.viewport.findMarkerNear(a,6),d=!1,g=!1;e||(e=this.viewport.addMarker(a),d=!0);e.selected=!0;var h=function(a){a=this.viewport.xViewToWorld((a.clientX-this.offsetLeft-tracing.constants.HEADING_WIDTH)*b);e.positionWorld=a;g=!0}.bind(this),k=function(a){e.selected=!1;g||d||this.viewport.removeMarker(e);document.removeEventListener("mouseup",k);document.removeEventListener("mousemove",h)}.bind(this);document.addEventListener("mouseup",
k);document.addEventListener("mousemove",h)},drawLine_:function(a,b,e,d,g,h){a.beginPath();a.moveTo(b,e);a.lineTo(d,g);a.closePath();a.strokeStyle=h;a.stroke()},drawArrow_:function(a,b,e,d,g,h,k){this.drawLine_(a,b,e,d,g,k);var l=d-b,m=g-e,n=Math.sqrt(l*l+m*m),p=(n-10)/n;b+=p*l;e+=p*m;m=m/n*h;h*=-(l/n);a.beginPath();a.fillStyle=k;a.moveTo(b+m,e+h);a.lineTo(d,g);a.lineTo(b-m,e-h);a.lineTo(b+m,e+h);a.closePath();a.fill()},draw:function(a,b,e){switch(a){case tracing.tracks.DrawType.SLICE:this.drawSlices_(b,
e)}},drawSlices_:function(a,c){var e=this.context(),d=window.devicePixelRatio||1,g=this.getBoundingClientRect(),h=g.width*d,k=g.height*d,l=this.classList.contains("ruler-track-with-distance-measurements"),g=l?k/2:k,m=this.viewport;m.drawMarkerArrows(e,a,c,g);var d=150*d,n=m.xViewVectorToWorld(d),p,q,t,v;v=Math.pow(10,Math.ceil(Math.log(n)/b));q=[10,5,2,1];for(n=0;n<q.length;++n)if(!(m.xWorldVectorToView(v/q[n])<d)){p=v/q[n-1];break}v=void 0;100>p?(q="ms",t=1,v=this.strings_msecs_):(q="s",t=1E3,v=
this.strings_secs_);var w=m.xWorldVectorToView(p/5),n=Math.floor(a/p)*p,k=Math.floor(0.25*k);e.fillStyle="rgb(0, 0, 0)";e.strokeStyle="rgb(0, 0, 0)";e.textAlign="left";e.textBaseline="top";d=window.devicePixelRatio||1;e.font=9*d+"px sans-serif";for(var s=n;s<c;s+=p){var r=Math.floor(m.xWorldToView(s)),n=Math.floor(1E5*(s/t))/1E5;v[n]||(v[n]=n+" "+q);e.fillText(v[n],r+2*d,0);e.beginPath();e.moveTo(r,0);e.lineTo(r,g);for(n=1;5>n;++n){var u=Math.floor(r+w*n);e.moveTo(u,g-k);e.lineTo(u,g)}e.stroke()}e.moveTo(0,
g);e.lineTo(h,g);e.stroke();if(l){p=m.markers.slice();p.sort(function(a,b){return a.positionWorld_-b.positionWorld_});l=g+2;d=l+4;for(n=0;n<p.length-1;n++){k=p[n+1];s=p[n];r=k.positionWorld-s.positionWorld;w=m.xWorldVectorToView(r);v=m.xWorldToView(s.positionWorld+r/2);100>r?(q="ms",t=1):(q="s",t=1E3);t=r/t;q=Math.abs(Math.floor(1E3*t)/1E3)+" "+q;t=e.measureText(q).width;u=m.xViewVectorToWorld(t);t=t+26+10;var x=s.positionWorld+r/2-u/2,y=x+u,r=l,u=m.xWorldToView(x),x=m.xWorldToView(y),s=m.xWorldToView(s.positionWorld),
k=m.xWorldToView(k.positionWorld),y=!1;t<=w&&(e.fillStyle="rgb(0,0,0)",e.fillText(q,u,r),y=!0);26<=w&&(y?(q=u-10,v=x+10):q=v,this.drawArrow_(e,q,d,s,d,3,"rgb(128,121,121)"),this.drawArrow_(e,v,d,k,d,3,"rgb(128,121,121)"))}e.moveTo(0,2*g);e.lineTo(h,2*g);e.stroke()}},addIntersectingItemsInRangeToSelection:function(a,b,e,d,g){},addAllObjectsMatchingFilterToSelection:function(a,b){}};return{RulerTrack:d}});"use strict";
base.exportTo("base",function(){function d(){this.iframe_=void 0}d.prototype={__proto__:Object.prototype,measure:function(b){this.iframe_.contentDocument.body.appendChild(b);var a=this.iframe_.contentWindow.getComputedStyle(b),c=parseInt(a.width,10),a=parseInt(a.height,10);this.iframe_.contentDocument.body.removeChild(b);return{width:c,height:a}},attach:function(){var b=document.createElement("iframe");b.style.cssText="position:absolute;width:100%;height:0;border:0;visibility:hidden";document.body.appendChild(b);
this.iframe_=b;this.iframe_.contentDocument.body.style.cssText="padding:0;margin:0;overflow:hidden";for(var b=document.querySelectorAll("link[rel=stylesheet]"),a=0;a<b.length;a++){var c=b[a],e=this.iframe_.contentDocument.createElement("link");e.rel="stylesheet";e.href=c.href;this.iframe_.contentDocument.head.appendChild(e)}},detach:function(){document.body.removeChild(this.iframe_);this.iframe_=void 0}};return{MeasuringStick:d}});"use strict";base.require("tracing.tracks.track");base.require("tracing.filter");
base.require("ui");
base.exportTo("tracing.tracks",function(){var d=ui.define("container-track",tracing.tracks.Track);d.prototype={__proto__:tracing.tracks.Track.prototype,decorate:function(b){tracing.tracks.Track.prototype.decorate.call(this,b)},detach:function(){this.textContent=""},get tracks_(){for(var b=[],a=0;a<this.children.length;a++)this.children[a].classList.contains("track")&&b.push(this.children[a]);return b},drawTrack:function(b){for(var a=0;a<this.children.length;++a)this.children[a]instanceof tracing.tracks.Track&&
this.children[a].drawTrack(b)},addIntersectingItemsInRangeToSelection:function(b,a,c,e,d){for(var g=0;g<this.tracks_.length;g++){var h=this.tracks_[g].getBoundingClientRect(),k=Math.max(c,h.top),h=Math.min(e,h.bottom);k<=h&&this.tracks_[g].addIntersectingItemsInRangeToSelection(b,a,c,e,d)}tracing.tracks.Track.prototype.addIntersectingItemsInRangeToSelection.apply(this,arguments)},addAllObjectsMatchingFilterToSelection:function(b,a){for(var c=0;c<this.tracks_.length;c++)this.tracks_[c].addAllObjectsMatchingFilterToSelection(b,
a)}};return{ContainerTrack:d}});"use strict";
base.exportTo("tracing",function(){function d(b,a,c,e){this.ctx_=b;this.minRectSize_=a;this.maxMergeDist_=c;this.pallette_=e}d.prototype={y_:0,h_:0,merging_:!1,mergeStartX_:0,mergeCurRight_:0,setYandH:function(b,a){this.flush();this.y_=b;this.h_=a},fillRect:function(b,a,c){var e=b+a;a<this.minRectSize_?(e-this.mergeStartX_>this.maxMergeDist_&&this.flush(),this.merging_?(this.mergeCurRight_=e,this.mergedColorId=Math.max(this.mergedColorId,c)):(this.merging_=!0,this.mergeStartX_=b,this.mergeCurRight_=
e,this.mergedColorId=c)):(this.merging_&&this.flush(),this.ctx_.fillStyle=this.pallette_[c],this.ctx_.fillRect(b,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.requireStylesheet("tracing.tracks.slice_track");base.require("base.sorted_array_utils");base.require("tracing.tracks.heading_track");
base.require("tracing.fast_rect_renderer");base.require("tracing.color_scheme");base.require("ui");
base.exportTo("tracing.tracks",function(){function d(){}function b(a,b){this.string=a;this.width=b}var a=tracing.getColorPalette(),c=ui.define("slice-track",tracing.tracks.HeadingTrack);c.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,SHOULD_ELIDE_TEXT:!0,decorate:function(a){tracing.tracks.HeadingTrack.prototype.decorate.call(this,a);this.classList.add("slice-track");this.elidedTitleCache=new d;this.asyncStyle_=!1;this.slices_=null},get asyncStyle(){return this.asyncStyle_},set asyncStyle(a){this.asyncStyle_=
!!a},get slices(){return this.slices_},set slices(a){this.slices_=a||[]},get height(){return window.getComputedStyle(this).height},set height(a){this.style.height=a},get hasVisibleContent(){return 0<this.slices.length},labelWidth:function(a){var b=this.context(),c=f[a];c||(c=b.measureText(a).width,f[a]=c);return c+2},labelWidthWorld:function(a,b){return this.labelWidth(a)*b},draw:function(a,b,c){switch(a){case tracing.tracks.DrawType.SLICE:this.drawSlices_(b,c)}},drawSlices_:function(b,c){var d=this.context(),
f=window.devicePixelRatio||1,g=this.getBoundingClientRect().height*f,p=this.viewport,q=p.xViewVectorToWorld(1);d.save();p.applyTransformToCanvas(d);this.asyncStyle_&&(d.globalAlpha=0.25);var t=new tracing.FastRectRenderer(d,2*q,2*q,a);t.setYandH(0,g);for(var v=this.slices_,w=base.findLowIndexInSortedArray(v,function(a){return a.start+a.duration},b),s=w;s<v.length;++s){var r=v[s],u=r.start;if(u>c)break;var x=Math.max(r.duration,0.001),y=r.selected?r.colorId+e:r.colorId;x<q&&(x=q);0<r.duration?t.fillRect(u,
x,y):0.001<q?t.fillRect(u,q,y):(d.fillStyle=a[y],d.beginPath(),d.moveTo(u-4*q,g),d.lineTo(u,0),d.lineTo(u+4*q,g),d.closePath(),d.fill())}t.flush();d.restore();if(8<g)for(d.textAlign="center",d.textBaseline="top",d.font=10*f+"px sans-serif",d.strokeStyle="rgb(0,0,0)",d.fillStyle="rgb(0,0,0)",g=20*q,t=this.SHOULD_ELIDE_TEXT,s=w;s<v.length;++s){r=v[s];if(r.start>c)break;r.duration<=g||(w=r.title+(r.didNotFinish?" (Did Not Finish)":""),u=this.labelWidth(w),t&&this.labelWidthWorld(w,q)>r.duration&&(u=
this.elidedTitleCache.get(this,q,w,u,r.duration),w=u.string,u=u.width),u*q<r.duration&&(r=p.xWorldToView(r.start+0.5*r.duration),d.fillText(w,r,2.5*f,u)))}},addIntersectingItemsInRangeToSelectionInWorldSpace:function(a,b,c,e){base.iterateOverIntersectingIntervals(this.slices_,function(a){return a.start},function(a){return a.duration},a,b,function(a){a=e.addSlice(this,a);this.decorateHit(a)}.bind(this))},indexOfSlice_:function(a){for(var b=base.findLowIndexInSortedArray(this.slices_,function(a){return a.start},
a.start);b<this.slices_.length&&a.start==this.slices_[b].start&&a.colorId!=this.slices_[b].colorId;)b++;return b<this.slices_.length?b:void 0},addItemNearToProvidedHitToSelection:function(a,b,c){if(!a.slice)return!1;a=this.indexOfSlice_(a.slice);if(void 0===a)return!1;b=a+b;if(0>b||b>=this.slices_.length)return!1;a=c.addSlice(this,this.slices_[b]);this.decorateHit(a);return!0},addAllObjectsMatchingFilterToSelection:function(a,b){for(var c=0;c<this.slices_.length;++c)if(a.matchSlice(this.slices_[c])){var e=
b.addSlice(this,this.slices_[c]);this.decorateHit(e)}}};var e=tracing.getColorPaletteHighlightIdBoost(),f={},g={};d.prototype={get:function(a,c,e,d,f){var p=g[e];p||(p={},g[e]=p);d=p[c];d||(p[c]={},d=p[c]);p=d[f];if(void 0===p){for(p=!1;a.labelWidthWorld(e,c)>f&&!(1>0.75*e.length);)e=e.substring(0,0.75*e.length),p=!0;p&&3<e.length&&(e=e.substring(0,e.length-3)+"...");p=new b(e,a.labelWidth(e));d[f]=p}return p}};return{SliceTrack:c}});"use strict";base.require("tracing.tracks.container_track");base.require("tracing.tracks.slice_track");
base.require("tracing.filter");base.require("tracing.trace_model");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=ui.define("cpu-track",tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(b){tracing.tracks.ContainerTrack.prototype.decorate.call(this,b);this.classList.add("cpu-track")},get cpu(){return this.cpu_},set cpu(b){this.cpu_=b;this.updateContents_()},get tooltip(){return this.tooltip_},set tooltip(b){this.tooltip_=b;this.updateContents_()},get hasVisibleContent(){return 0<this.children.length},
updateContents_:function(){this.detach();if(this.cpu_){var b=tracing.filterSliceArray(this.categoryFilter_,this.cpu_.slices);if(b.length){var a=new tracing.tracks.SliceTrack(this.viewport);a.slices=b;a.heading="CPU "+this.cpu_.cpuNumber+":";this.appendChild(a)}for(var c in this.cpu_.counters){b=this.cpu_.counters[c];if(!this.categoryFilter_.matchCounter(b))break;a=new tracing.tracks.CounterTrack(this.viewport);a.heading="CPU "+this.cpu_.cpuNumber+" "+b.name+":";a.counter=b;a.categoryFilter=this.categoryFilter_;
this.appendChild(a)}}}};return{CpuTrack:d}});"use strict";base.requireStylesheet("tracing.tracks.object_instance_track");base.require("base.sorted_array_utils");base.require("tracing.tracks.heading_track");base.require("tracing.color_scheme");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.getColorPalette(),b=tracing.getColorPaletteHighlightIdBoost(),a=ui.define("object-instance-track",tracing.tracks.HeadingTrack);a.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,decorate:function(a){tracing.tracks.HeadingTrack.prototype.decorate.call(this,a);this.classList.add("object-instance-track");this.objectInstances_=[];this.objectSnapshots_=[]},get objectInstances(){return this.objectInstances_},set objectInstances(a){a&&0!=
a.length?(this.heading=a[0].typeName,this.objectInstances_=a,this.objectSnapshots_=[],this.objectInstances_.forEach(function(a){this.objectSnapshots_.push.apply(this.objectSnapshots_,a.snapshots)},this)):(this.heading="",this.objectInstances_=[],this.objectSnapshots_=[])},get height(){return window.getComputedStyle(this).height},set height(a){this.style.height=a},get snapshotRadiusView(){return 7*(window.devicePixelRatio||1)},draw:function(a,b,d){switch(a){case tracing.tracks.DrawType.SLICE:this.drawSlices_(b,
d)}},drawSlices_:function(a,e){var f=this.context(),g=window.devicePixelRatio||1,h=this.getBoundingClientRect().height*g,k=0.5*h,l=2*Math.PI,m=this.viewport,n=this.snapshotRadiusView,p=m.xViewVectorToWorld(h),q;f.save();m.applyTransformToCanvas(f);var t=this.objectInstances_;q=base.findLowIndexInSortedArray(t,function(a){return a.deletionTs},a);f.globalAlpha=0.25;for(f.strokeStyle="rgb(0,0,0)";q<t.length;++q){var v=t[q],w=v.creationTs;if(w>e)break;var s=v.selected?v.colorId+b:v.colorId,v=v.deletionTs==
Number.MAX_VALUE?e:v.deletionTs;f.fillStyle=d[s];f.fillRect(w,g,v-w,h-2*g)}f.globalAlpha=1;f.restore();g=this.objectSnapshots_;for(q=base.findLowIndexInSortedArray(g,function(a){return a.ts+p},a);q<g.length;++q){h=g[q];w=h.ts;if(w-p>e)break;w=m.xWorldToView(w);s=h.selected?h.objectInstance.colorId+b:h.objectInstance.colorId;f.fillStyle=d[s];f.beginPath();f.arc(w,k,n,0,l);f.fill();h.selected?(f.lineWidth=5,f.strokeStyle="rgb(100,100,0)",f.stroke(),f.beginPath(),f.arc(w,k,n-1,0,l),f.lineWidth=2,f.strokeStyle=
"rgb(255,255,0)"):(f.lineWidth=1,f.strokeStyle="rgb(0,0,0)");f.stroke()}f.lineWidth=1},addIntersectingItemsInRangeToSelectionInWorldSpace:function(a,b,d,g){function h(a){g.addObjectInstance(k,a)}var k=this,l=!1,m=d*this.snapshotRadiusView;base.iterateOverIntersectingIntervals(this.objectSnapshots_,function(a){return a.ts-m},function(a){return 2*m},a,b,function(a){g.addObjectSnapshot(k,a);l=!0});l||base.iterateOverIntersectingIntervals(this.objectInstances_,function(a){return a.creationTs},function(a){return a.deletionTs-
a.creationTs},a,b,h)},addItemNearToProvidedHitToSelection:function(a,b,d){if(a instanceof tracing.SelectionObjectSnapshotHit){if(a=this.objectSnapshots_.indexOf(a.objectSnapshot),b=a+b,0<=b&&b<this.objectSnapshots_.length)return d.addObjectSnapshot(this,this.objectSnapshots_[b]),!0}else if(a instanceof tracing.SelectionObjectInstanceHit){if(a=this.objectInstances_.indexOf(a.objectInstance),b=a+b,0<=b&&b<this.objectInstances_.length)return d.addObjectInstance(this,this.objectInstances_[b]),!0}else throw Error("Unrecognized hit");
return!1},addAllObjectsMatchingFilterToSelection:function(a,b){}};a.typeNameToTrackConstructorMap={};a.register=function(b,e){if(a.typeNameToTrackConstructorMap[b])throw Error("Handler already registered for "+b);a.typeNameToTrackConstructorMap[b]=e};a.getTrackConstructor=function(b){return a.typeNameToTrackConstructorMap[b]};return{ObjectInstanceTrack:a}});"use strict";base.requireStylesheet("tcmalloc.heap_instance_track");base.require("base.sorted_array_utils");base.require("tracing.tracks.heading_track");
base.require("tracing.tracks.object_instance_track");base.require("tracing.color_scheme");base.require("ui");
base.exportTo("tcmalloc",function(){var d=tracing.getColorPalette(),b=tracing.getColorPaletteHighlightIdBoost(),a=ui.define("heap-instance-track",tracing.tracks.HeadingTrack);a.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,decorate:function(a){tracing.tracks.HeadingTrack.prototype.decorate.call(this,a);this.classList.add("heap-instance-track");this.objectInstance_=null},set objectInstances(a){if(a){if(1!=a.length)throw Error("Bad object instance count.");this.objectInstance_=a[0];this.maxBytes_=
this.computeMaxBytes_(this.objectInstance_.snapshots)}else this.objectInstance_=[]},computeMaxBytes_:function(a){for(var b=0,d=0;d<a.length;d++){for(var g=a[d],h=Object.keys(g.heap_.children),k=0,l=0;l<h.length;l++)k+=g.heap_.children[h[l]].currentBytes;k>b&&(b=k)}return b},get height(){return window.getComputedStyle(this).height},set height(a){this.style.height=a},draw:function(a,b,d){switch(a){case tracing.tracks.DrawType.SLICE:this.drawSlices_(b,d)}},drawSlices_:function(a,e){var f=this.context(),
g=window.devicePixelRatio||1,h=this.getBoundingClientRect(),k=h.width*g,g=h.height*g,h=this.viewport,l=this.maxBytes_,m=this.objectInstance_.snapshots,n=base.findLowIndexInSortedArray(m,function(a){return a.ts},a);for(0<n&&(n-=1);n<m.length;++n){var p=m[n],q=p.ts;if(q>e)break;q=h.xWorldToView(q);0>q&&(q=0);var t=h.xWorldToView(n<m.length-1?m[n+1].ts:m[m.length-1].ts+5E3);t>k&&(t=k);for(var q=Math.floor(q),t=Math.floor(t),v=g,w=Object.keys(p.heap_.children),s=w.length-1;0<=s;s--){var r=p.heap_.children[w[s]];
f.fillStyle=this.objectInstance_.selectedTraces&&0<this.objectInstance_.selectedTraces.length&&this.objectInstance_.selectedTraces[0]==w[s]?"rgb(239, 248, 206)":d[(p.selected?p.objectInstance.colorId+b:p.objectInstance.colorId)+s];r=g*r.currentBytes/l;f.fillRect(q,v-r,Math.max(t-q,1),r);v-=r}}f.lineWidth=1},addIntersectingItemsInRangeToSelectionInWorldSpace:function(a,b,d,g){var h=this;base.iterateOverIntersectingIntervals(this.objectInstance_.snapshots,function(a){return a.ts},function(a){return 5E3},
a,b,function(a){g.addObjectSnapshot(h,a)})},addItemNearToProvidedHitToSelection:function(a,b,d){if(a instanceof tracing.SelectionObjectSnapshotHit){var g=this.objectInstance_.snapshots;a=g.indexOf(a.objectSnapshot)+b;if(0<=a&&a<g.length)return d.addObjectSnapshot(this,g[a]),!0}else throw Error("Unrecognized hit");return!1},addAllObjectsMatchingFilterToSelection:function(a,b){}};tracing.tracks.ObjectInstanceTrack.register("memory::Heap",a);return{HeapInstanceTrack:a}});"use strict";base.requireStylesheet("tracing.tracks.counter_track");
base.require("tracing.tracks.heading_track");base.require("tracing.color_scheme");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.getColorPalette(),b=ui.define("counter-track",tracing.tracks.HeadingTrack);b.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,decorate:function(a){tracing.tracks.HeadingTrack.prototype.decorate.call(this,a);this.classList.add("counter-track");this.selectedSamples_={};this.categoryFilter_=new tracing.Filter},decorateHit:function(a){},get counter(){return this.counter_},set counter(a){this.counter_=a;this.heading=a.name+": "},get categoryFilter(){return this.categoryFilter_},
set categoryFilter(a){this.categoryFilter_=a},get selectedSamples(){return this.selectedSamples_},draw:function(a,b,e){switch(a){case tracing.tracks.DrawType.SLICE:this.drawSlices_(b,e)}},drawSlices_:function(a,b){var e=this.context(),f=window.devicePixelRatio||1,f=this.getBoundingClientRect().height*f,g=this.counter_,h=this.viewport,k=h.xViewVectorToWorld(1),l=h.xViewVectorToWorld(1);e.save();h.applyTransformToCanvas(e);for(var h=g.numSeries,m=g.numSamples,n=base.findLowIndexInSortedArray(g.timestamps,
function(a){return a},a),n=0<n-1?n-1:0,p=f/g.maxTotal,q=g.numSeries-1;0<=q;q--){e.fillStyle=d[g.series[q].color];e.beginPath();for(var t=n-1,v=0<=t?g.timestamps[t]-l:-1,w=f,s=!1;;){var r=t+1;if(r>=m){e.lineTo(v,w);e.lineTo(v+8*k,w);e.lineTo(v+8*k,f);break}var u=g.timestamps[r],x=g.totals[r*h+q],x=f-p*x;if(u>b){e.lineTo(u,w);e.lineTo(u,f);break}if(r+1<m&&(t=g.timestamps[r+1],t-v<=l&&t<b)){t=r;continue}s||(e.moveTo(a,f),s=!0);u-v<l&&(u=v+l);e.lineTo(u,w);e.lineTo(u,x);t=r;v=u;w=x}e.closePath();e.fill()}e.fillStyle=
"rgba(255, 0, 0, 1)";for(r in this.selectedSamples_)if(this.selectedSamples_[r])for(u=g.timestamps[r],q=g.numSeries-1;0<=q;q--)x=g.totals[r*h+q],x=f-p*x,e.fillRect(u-k,x-1,3*k,3);e.restore()},addIntersectingItemsInRangeToSelectionInWorldSpace:function(a,b,e,d){function g(a,b){return b===h.timestamps.length-1?0:h.timestamps[b+1]-h.timestamps[b]}var h=this.counter_;a=base.findLowIndexInSortedIntervals(h.timestamps,function(a){return a},g,a);for(b=base.findLowIndexInSortedIntervals(h.timestamps,function(a){return a},
g,b);a<=b;a++)0>a||a>=h.timestamps.length||(e=d.addCounterSample(this,this.counter,a),this.decorateHit(e))},addAllObjectsMatchingFilterToSelection:function(a,b){}};return{CounterTrack:b}});"use strict";base.requireStylesheet("tracing.tracks.spacing_track");base.require("tracing.tracks.heading_track");
base.exportTo("tracing.tracks",function(){var d=ui.define("spacing-track",tracing.tracks.HeadingTrack);d.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,decorate:function(b){tracing.tracks.HeadingTrack.prototype.decorate.call(this,b);this.classList.add("spacing-track")},draw:function(b,a,c){},addAllObjectsMatchingFilterToSelection:function(b,a){}};return{SpacingTrack:d}});"use strict";base.require("base.sorted_array_utils");base.require("tracing.tracks.container_track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=ui.define("slice-group-track",tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(b){tracing.tracks.ContainerTrack.prototype.decorate.call(this,b);this.classList.add("slice-group-track");this.heading_=this.tooltip_=""},get group(){return this.group_},set group(b){this.group_=b;this.updateContents_()},get heading(){return this.heading_},set heading(b){this.heading_=b;this.updateContents_()},
get tooltip(){return this.tooltip_},set tooltip(b){this.tooltip_=b;this.updateContents_()},set decorateHit(b){this.decorateHit_=b;this.updateContents_()},addSliceTrack_:function(b){var a=new tracing.tracks.SliceTrack(this.viewport);a.slices=b;a.decorateHit=this.decorateHit_;a.categoryFilter_=this.categoryFilter;this.appendChild(a);return a},get subRows(){return base.asArray(this.children).map(function(b){return b.slices})},get hasVisibleContent(){return 0<this.children.length},updateContents_:function(){if(this.group_){var b=
tracing.filterSliceArray(this.categoryFilter,this.group_.slices);if(this.areArrayContentsSame_(this.filteredSlices_,b))this.updateHeadingAndTooltip_();else if(this.filteredSlices_=b,this.detach(),b.length){for(var b=this.buildSubRows_(b),a=0;a<b.length;a++){var c=b[a];c.length&&this.addSliceTrack_(c)}this.updateHeadingAndTooltip_()}}else this.updateHeadingAndTooltip_()},updateHeadingAndTooltip_:function(){this.firstChild&&(this.firstChild.heading=this.heading_,this.firstChild.tooltip=this.tooltip_)},
buildSubRows_:function(b){if(!b.length)return[];for(var a=[],c=0;c<b.length;c++)b[c].subSlices&&b[c].subSlices.splice(0,b[c].subSlices.length),a.push(c);a.sort(function(a,c){var e=b[a],d=b[c];return e.start!=d.start?e.start-d.start:c-a});var e=[[]];this.badSlices_=[];for(c=0;c<a.length;c++){for(var d=b[a[c]],g=!1,h=e.length-1;0<=h;h--)if(0!=e[h].length){var k=e[h][e[h].length-1];d.start<k.start&&(this.badSlices_.push(d),g=!0);if(d.start>=k.start&&d.end<=k.end){for(;e.length<=h+1;)e.push([]);e[h+1].push(d);
k.subSlices&&k.subSlices.push(d);g=!0;break}}g||e[0].push(d)}return e},areArrayContentsSame_:function(b,a){if(!(b&&a&&b.length&&a.length)||b.length!=a.length)return!1;for(var c=0;c<b.length;++c)if(b[c]!=a[c])return!1;return!0}};return{SliceGroupTrack:d}});"use strict";base.require("tracing.tracks.slice_group_track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=ui.define("async-slice-group-track",tracing.tracks.SliceGroupTrack);d.prototype={__proto__:tracing.tracks.SliceGroupTrack.prototype,decorate:function(b){tracing.tracks.SliceGroupTrack.prototype.decorate.call(this,b);this.classList.add("async-slice-group-track")},addSliceTrack_:function(b){b=tracing.tracks.SliceGroupTrack.prototype.addSliceTrack_.call(this,b);b.asyncStyle=!0;return b},buildSubRows_:function(){var b=tracing.filterSliceArray(this.categoryFilter,
this.group_.slices);b.sort(function(a,b){return a.start-b.start});for(var a=[],c=0;c<b.length;c++){for(var e=b[c],d=!1,g=0;g<a.length;g++){var h=a[g];if(e.start>=h[h.length-1].end){d=!0;if(void 0===e.subSlices||1>e.subSlices.length)throw Error("AsyncEvent missing subSlices: ")+e.name;for(g=0;g<e.subSlices.length;g++)h.push(e.subSlices[g]);break}}if(!d&&(h=[],void 0!==e.subSlices)){for(g=0;g<e.subSlices.length;g++)h.push(e.subSlices[g]);a.push(h)}}return a}};return{AsyncSliceGroupTrack:d}});"use strict";
base.requireStylesheet("tracing.tracks.thread_track");base.require("tracing.tracks.container_track");base.require("tracing.tracks.slice_track");base.require("tracing.tracks.slice_group_track");base.require("tracing.tracks.async_slice_group_track");base.require("tracing.filter");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=ui.define("thread-track",tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(b){tracing.tracks.ContainerTrack.prototype.decorate.call(this,b);this.classList.add("thread-track")},get thread(){return this.thread_},set thread(b){this.thread_=b;this.updateContents_()},get hasVisibleContent(){return 0<this.tracks_.length},updateContents_:function(){this.detach();if(this.thread_){this.heading=this.thread_.userFriendlyName+
": ";this.tooltip=this.thread_.userFriendlyDetails;if(this.thread_.asyncSliceGroup.length){var b=new tracing.tracks.AsyncSliceGroupTrack(this.viewport);b.categoryFilter=this.categoryFilter;b.decorateHit=function(a){};b.group=this.thread_.asyncSliceGroup;b.hasVisibleContent&&this.appendChild(b)}this.thread_.samples.length&&(b=new tracing.tracks.SliceTrack(this.viewport),b.categoryFilter=b,b.group=this.thread_,b.slices=this.thread_.samples,b.decorateHit=function(a){a.thread=this.thread_},this.appendChild(b));
this.thread_.cpuSlices&&(b=new tracing.tracks.SliceTrack(this.viewport),b.categoryFilter=this.categoryFilter,b.heading="",b.height="4px",b.decorateHit=function(a){a.thread=this.thread_},b.slices=this.thread_.cpuSlices,b.hasVisibleContent&&this.appendChild(b));this.thread_.sliceGroup.length&&(b=new tracing.tracks.SliceGroupTrack(this.viewport),b.categoryFilter=this.categoryFilter,b.heading=this.thread_.userFriendlyName,b.tooltip=this.thread_.userFriendlyDetails,b.decorateHit=function(a){a.thread=this.thread_},
b.group=this.thread_.sliceGroup,b.hasVisibleContent&&this.appendChild(b))}},collapsedDidChange:function(b){if(b){b=parseInt(this.tracks[0].height);for(var a=0;a<this.tracks.length;++a)2<b?this.tracks[a].height=Math.floor(b)+"px":this.tracks[a].style.display="none",b*=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("ui");base.require("base.settings");
base.exportTo("ui",function(){function d(a){var b=document.createElement("span");a&&(a.className&&(b.className=a.className),a.textContent&&(b.textContent=a.textContent),a.parent&&a.parent.appendChild(b));return b}var b=1;return{createSpan:d,createDiv:function(a){var b=document.createElement("div");a&&(a.className&&(b.className=a.className),a.parent&&a.parent.appendChild(b));return b},createScopedStyle:function(a){var b=document.createElement("style");b.scoped=!0;b.innerHTML=a;return b},createSelector:function(a,
b,e,d,g){function h(d){d=n.selectedOptions[0].targetPropertyValue;base.Settings.set(e,d);a[b]=d}for(var k,l=0;l<g.length;l++){var m=g[l];if(m.value==d){k=l;break}}if(void 0===k)throw Error("defaultValue must be in the items list");var n=document.createElement("select");n.addEventListener("change",h);for(l=0;l<g.length;l++){var m=g[l],p=document.createElement("option");p.textContent=m.label;p.targetPropertyValue=m.value;n.appendChild(p)}a.__lookupSetter__("selectedIndex");n.__defineGetter__("selectedValue",
function(a){return n.children[n.selectedIndex].targetPropertyValue});n.__defineSetter__("selectedValue",function(a){for(var b=0;b<n.children.length;b++)if(n.children[b].targetPropertyValue==a){n.selectedIndex=b;h();return}throw Error("Not a valid value");});g=base.Settings.get(e,d);m=!1;for(l=0;l<n.children.length;l++)if(n.children[l].targetPropertyValue==g){m=!0;a[b]=g;n.selectedIndex=l;break}m||(n.selectedIndex=k,a[b]=d);return n},createCheckBox:function(a,c,e,f,g){function h(){base.Settings.set(e,
k.checked);a[c]=k.checked}var k=document.createElement("input");k.type="checkbox";f=base.Settings.get(e,f);k.checked=!!f;a[c]=f;k.addEventListener("change",h);f="#checkbox-"+b++;var l=d({className:"labeled-checkbox"});k.setAttribute("id",f);var m=document.createElement("label");m.textContent=g;m.setAttribute("for",f);l.appendChild(k);l.appendChild(m);l.__defineSetter__("checked",function(a){k.checked=!!a;h()});l.__defineGetter__("checked",function(){return k.checked});return l}}});"use strict";base.require("tcmalloc.heap_instance_track");
base.require("tracing.analysis.object_snapshot_view");base.require("tracing.analysis.object_instance_view");base.require("tracing.tracks.container_track");base.require("tracing.tracks.counter_track");base.require("tracing.tracks.object_instance_track");base.require("tracing.tracks.spacing_track");base.require("tracing.tracks.thread_track");base.require("tracing.trace_model_settings");base.require("tracing.filter");base.require("ui");base.require("ui.dom_helpers");base.requireStylesheet("tracing.tracks.process_track_base");
base.exportTo("tracing.tracks",function(){var d=tracing.analysis.ObjectSnapshotView,b=tracing.analysis.ObjectInstanceView,a=tracing.TraceModelSettings,c=tracing.tracks.SpacingTrack,e=ui.define("process-track-base",tracing.tracks.ContainerTrack);e.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(a){tracing.tracks.ContainerTrack.prototype.decorate.call(this,a);this.processBase_=void 0;this.classList.add("process-track-base");this.classList.add("expanded");this.expandEl_=
document.createElement("expand-button");this.expandEl_.classList.add("expand-button-expanded");this.processNameEl_=ui.createSpan();this.headerEl_=ui.createDiv({className:"process-track-header"});this.headerEl_.appendChild(this.expandEl_);this.headerEl_.appendChild(this.processNameEl_);this.headerEl_.addEventListener("click",this.onHeaderClick_.bind(this));this.appendChild(this.headerEl_)},get processBase(){return this.processBase_},set processBase(b){if(this.processBase_=b)this.expanded=(new a(this.processBase_.model)).getSettingFor(this.processBase_,
"expanded",!0);this.updateContents_()},get expanded(){return this.expandEl_.classList.contains("expand-button-expanded")},set expanded(b){b=!!b;this.expandEl_.classList.contains("expand-button-expanded")!==b&&(b?(this.classList.add("expanded"),this.expandEl_.classList.add("expand-button-expanded")):(this.classList.remove("expanded"),this.expandEl_.classList.remove("expand-button-expanded")),this.viewport_.dispatchChangeEvent(),this.processBase_&&(new a(this.processBase_.model)).setSettingFor(this.processBase_,
"expanded",b))},get hasVisibleContent(){return this.expanded?1<this.children.length:!0},onHeaderClick_:function(a){a.stopPropagation();a.preventDefault();this.expanded=!this.expanded},updateContents_:function(){this.tracks_.forEach(function(a){this.removeChild(a)},this);this.processBase_&&(this.processNameEl_.textContent=this.processBase_.userFriendlyName,this.headerEl_.title=this.processBase_.userFriendlyDetails,this.willAppendTracks_(),this.appendObjectInstanceTracks_(),this.appendCounterTracks_(),
this.appendThreadTracks_(),this.didAppendTracks_())},willAppendTracks_:function(){},didAppendTracks_:function(){},appendObjectInstanceTracks_:function(){var a=this.processBase_.objects.getAllInstancesByTypeName(),e=base.dictionaryKeys(a);e.sort();var h=!1;e.forEach(function(c){var e=a[c],g=b.getViewInfo(c),n=d.getViewInfo(c);g&&!g.options.showInTrackView&&(g=void 0);n&&!n.options.showInTrackView&&(n=void 0);for(var n=g||n,g=[],p=0;p<e.length;p++){var q=e[p];0!==q.snapshots.length&&(q.hasImplicitSnapshots&&
!n||g.push(q))}0!==g.length&&(c=tracing.tracks.ObjectInstanceTrack.getTrackConstructor(c),c||(c=tracing.tracks.ObjectInstanceTrack),c=new c(this.viewport),c.categoryFilter=this.categoryFilter_,c.objectInstances=g,this.appendChild(c),h=!0)},this);h&&this.appendChild(new c(this.viewport))},appendCounterTracks_:function(){var a=base.dictionaryValues(this.processBase.counters).filter(this.categoryFilter.matchCounter,this.categoryFilter);a.sort(tracing.trace_model.Counter.compare);a.forEach(function(a){var b=
new tracing.tracks.CounterTrack(this.viewport);b.categoryFilter=this.categoryFilter_;b.counter=a;this.appendChild(b);this.appendChild(new c(this.viewport))}.bind(this))},appendThreadTracks_:function(){var a=base.dictionaryValues(this.processBase.threads).filter(function(a){return this.categoryFilter_.matchThread(a)},this);a.sort(tracing.trace_model.Thread.compare);a.forEach(function(a){var b=new tracing.tracks.ThreadTrack(this.viewport);b.categoryFilter=this.categoryFilter_;b.thread=a;b.hasVisibleContent&&
(this.appendChild(b),this.appendChild(new c(this.viewport)))}.bind(this))}};return{ProcessTrackBase:e}});"use strict";base.require("tracing.tracks.process_track_base");base.require("tracing.tracks.cpu_track");base.require("tracing.tracks.spacing_track");
base.exportTo("tracing.tracks",function(){var d=tracing.tracks.ProcessTrackBase,b=tracing.tracks.SpacingTrack,a=ui.define("kernel-track",d);a.prototype={__proto__:d.prototype,decorate:function(a){tracing.tracks.ProcessTrackBase.prototype.decorate.call(this,a)},set kernel(a){this.processBase=a},get kernel(){return this.processBase},willAppendTracks_:function(){var a=this.categoryFilter,d=base.dictionaryValues(this.kernel.cpus);d.sort(tracing.trace_model.Cpu.compare);for(var f=!1,g=0;g<d.length;++g){var h=
d[g];if(!a.matchCpu(h))return;var k=new tracing.tracks.CpuTrack(this.viewport);k.categoryFilter=a;k.cpu=h;k.hasVisibleContent&&(this.appendChild(k),f=!0)}f&&this.appendChild(new b(this.viewport))}};return{KernelTrack:a}});"use strict";base.require("tracing.tracks.process_track_base");
base.exportTo("tracing.tracks",function(){var d=tracing.tracks.ProcessTrackBase,b=ui.define("process-track",d);b.prototype={__proto__:d.prototype,decorate:function(a){tracing.tracks.ProcessTrackBase.prototype.decorate.call(this,a)},drawTrack:function(a){switch(a){case tracing.tracks.DrawType.INSTANT_EVENT:if(!this.processBase.instantEvents||0===this.processBase.instantEvents.length)break;var b=this.context();if(void 0===b)break;b.save();var d=this.setupCanvasForDraw_();this.drawInstantEvents_(this.processBase.instantEvents,
d.left,d.right);b.restore()}tracing.tracks.ContainerTrack.prototype.drawTrack.call(this,a)},set process(a){this.processBase=a},get process(){return this.processBase},addIntersectingItemsInRangeToSelectionInWorldSpace:function(a,b,d,f){base.iterateOverIntersectingIntervals(this.processBase.instantEvents,function(a){return a.start},function(a){return a.duration},a,b,function(a){a=f.addSlice(this,a);this.decorateHit(a)}.bind(this));tracing.tracks.ContainerTrack.prototype.addIntersectingItemsInRangeToSelectionInWorldSpace.apply(this,
arguments)}};return{ProcessTrack:b}});"use strict";base.requireStylesheet("tracing.tracks.trace_model_track");base.require("base.measuring_stick");base.require("tracing.tracks.container_track");base.require("tracing.tracks.kernel_track");base.require("tracing.tracks.process_track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=ui.define("trace-model-track",tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(b){tracing.tracks.ContainerTrack.prototype.decorate.call(this,b);this.classList.add("model-track")},detach:function(){tracing.tracks.ContainerTrack.prototype.detach.call(this)},get model(){return this.model_},set model(b){this.model_=b;this.updateContents_()},get hasVisibleContent(){return 0<this.children.length},
applyCategoryFilter_:function(){this.updateContents_()},updateContents_:function(){this.textContent="";if(this.model_&&this.categoryFilter){var b=this.categoryFilter;this.appendKernelTrack_();var a=this.model_.getAllProcesses();a.sort(tracing.trace_model.Process.compare);for(var c=0;c<a.length;++c){var d=a[c];if(!b.matchProcess(d))break;var f=new tracing.tracks.ProcessTrack(this.viewport);f.categoryFilter=b;f.process=d;f.hasVisibleContent&&this.appendChild(f)}}},appendKernelTrack_:function(){if(this.categoryFilter.matchProcess(this.model.kernel)){var b=
new tracing.tracks.KernelTrack(this.viewport);b.categoryFilter=this.categoryFilter;b.kernel=this.model.kernel;b.hasVisibleContent&&this.appendChild(b)}},drawTrack:function(b){switch(b){case tracing.tracks.DrawType.INSTANT_EVENT:if(!this.model_.instantEvents||0===this.model_.instantEvents.length)break;var a=this.context();if(void 0===a)break;a.save();var c=this.setupCanvasForDraw_();this.drawInstantEvents_(this.model_.instantEvents,c.left,c.right);a.restore()}tracing.tracks.ContainerTrack.prototype.drawTrack.call(this,
b)},addIntersectingItemsInRangeToSelectionInWorldSpace:function(b,a,c,d){base.iterateOverIntersectingIntervals(this.model_.instantEvents,function(a){return a.start},function(a){return a.duration},b,a,function(a){a=d.addSlice(this,a);this.decorateHit(a)}.bind(this));tracing.tracks.ContainerTrack.prototype.addIntersectingItemsInRangeToSelectionInWorldSpace.apply(this,arguments)}};return{TraceModelTrack:d}});"use strict";base.requireStylesheet("ui.tool_button");base.requireStylesheet("ui.mouse_mode_selector");
base.requireTemplate("ui.mouse_mode_selector");base.require("base.events");base.require("tracing.mouse_mode_constants");base.require("ui");
base.exportTo("ui",function(){var d=ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(b){this.classList.add("mouse-mode-selector");this.parentEl_=b;b=base.instantiateTemplate("#mouse-mode-selector-template");this.appendChild(b);this.buttonsEl_=this.querySelector(".buttons");this.dragHandleEl_=this.querySelector(".drag-handle");this.panScanModeButton_=this.buttonsEl_.querySelector(".pan-scan-mode-button");this.selectionModeButton_=this.buttonsEl_.querySelector(".selection-mode-button");
this.zoomModeButton_=this.buttonsEl_.querySelector(".zoom-mode-button");this.pos_={x:base.Settings.get("mouse_mode_selector.x",window.innerWidth-50),y:base.Settings.get("mouse_mode_selector.y",100)};this.constrainPositionToWindowBounds_();this.updateStylesFromPosition_();this.isDraggingModeSelectorDragHandle_=!1;this.initialRelativeMouseDownPos_={x:0,y:0};this.dragHandleEl_.addEventListener("mousedown",this.onDragHandleMouseDown_.bind(this));document.addEventListener("mousemove",this.onDragHandleMouseMove_.bind(this));
document.addEventListener("mouseup",this.onDragHandleMouseUp_.bind(this));window.addEventListener("resize",this.onWindowResize_.bind(this));this.buttonsEl_.addEventListener("mouseup",this.onButtonMouseUp_);this.buttonsEl_.addEventListener("mousedown",this.onButtonMouseDown_);this.buttonsEl_.addEventListener("click",this.onButtonPress_.bind(this));document.addEventListener("mousemove",this.onMouseMove_.bind(this));document.addEventListener("mouseup",this.onMouseUp_.bind(this));this.parentEl_.addEventListener("mousedown",
this.onMouseDown_.bind(this));document.addEventListener("keypress",this.onKeyPress_.bind(this));document.addEventListener("keydown",this.onKeyDown_.bind(this));document.addEventListener("keyup",this.onKeyUp_.bind(this));this.mode=base.Settings.get("mouse_mode_selector.mouseMode",tracing.mouseModeConstants.MOUSE_MODE_PANSCAN);this.isInteracting_=this.isInTemporaryAlternativeMouseMode_=!1},get mode(){return this.currentMode_},set mode(b){if(this.currentMode_!==b){var a=tracing.mouseModeConstants;this.currentMode_=
b;this.panScanModeButton_.classList.remove("active");this.selectionModeButton_.classList.remove("active");this.zoomModeButton_.classList.remove("active");switch(b){case a.MOUSE_MODE_PANSCAN:this.panScanModeButton_.classList.add("active");break;case a.MOUSE_MODE_SELECTION:this.selectionModeButton_.classList.add("active");break;case a.MOUSE_MODE_ZOOM:this.zoomModeButton_.classList.add("active");break;default:throw Error("Unknown selection mode: "+b);}base.Settings.set("mouse_mode_selector.mouseMode",
b)}},getCurrentModeEventNames_:function(){var b=tracing.mouseModeConstants,a={begin:"",update:"",end:""};switch(this.mode){case b.MOUSE_MODE_PANSCAN:a.begin="beginpan";a.update="updatepan";a.end="endpan";break;case b.MOUSE_MODE_SELECTION:a.begin="beginselection";a.update="updateselection";a.end="endselection";break;case b.MOUSE_MODE_ZOOM:a.begin="beginzoom";a.update="updatezoom";a.end="endzoom";break;default:throw Error("Unsupported interaction mode");}return a},onMouseDown_:function(b){var a=this.getCurrentModeEventNames_(),
a=new base.Event(a.begin,!0,!0);a.data=b;this.dispatchEvent(a);this.isInteracting_=!0},onMouseMove_:function(b){var a=this.getCurrentModeEventNames_(),a=new base.Event(a.update,!0,!0);a.data=b;this.dispatchEvent(a)},onMouseUp_:function(b){var a=this.getCurrentModeEventNames_(),a=new base.Event(a.end,!0,!0),c=!b.shiftKey,d=base.isMac&&!b.metaKey||!base.isMac&&!b.ctrlKey;a.data=b;this.dispatchEvent(a);this.isInteracting_=!1;this.isInTemporaryAlternativeMouseMode_&&(c&&d)&&(this.mode=tracing.mouseModeConstants.MOUSE_MODE_PANSCAN)},
onButtonMouseDown_:function(b){b.preventDefault();b.stopImmediatePropagation()},onButtonMouseUp_:function(b){b.preventDefault();b.stopImmediatePropagation()},onButtonPress_:function(b){var a=tracing.mouseModeConstants;switch(b.target){case this.panScanModeButton_:this.mode=a.MOUSE_MODE_PANSCAN;break;case this.selectionModeButton_:this.mode=a.MOUSE_MODE_SELECTION;break;case this.zoomModeButton_:this.mode=a.MOUSE_MODE_ZOOM;break;default:throw Error("Unknown mouse mode button pressed");}b.preventDefault();
this.isInTemporaryAlternativeMouseMode_=!1},onKeyPress_:function(b){if(!this.isInteracting_){var a=tracing.mouseModeConstants;switch(b.keyCode){case 49:this.mode=a.MOUSE_MODE_PANSCAN;break;case 50:this.mode=a.MOUSE_MODE_SELECTION;break;case 51:this.mode=a.MOUSE_MODE_ZOOM}}},onKeyDown_:function(b){if(!this.isInteracting_){var a=tracing.mouseModeConstants,c=base.isMac&&b.metaKey||!base.isMac&&b.ctrlKey,d=b.shiftKey;this.mode===a.MOUSE_MODE_PANSCAN&&(c||d)&&(this.mode=c?a.MOUSE_MODE_ZOOM:a.MOUSE_MODE_SELECTION,
this.isInTemporaryAlternativeMouseMode_=!0,b.preventDefault())}},onKeyUp_:function(b){if(!this.isInteracting_){var a=tracing.mouseModeConstants,c=base.isMac&&!b.metaKey||!base.isMac&&!b.ctrlKey;b=b.shiftKey;this.isInTemporaryAlternativeMouseMode_&&(c||b)&&(this.mode=a.MOUSE_MODE_PANSCAN);this.isInTemporaryAlternativeMouseMode_=!1}},constrainPositionToWindowBounds_:function(){var b=window.innerHeight-this.offsetHeight,a=window.innerWidth-this.offsetWidth;this.pos_.x=Math.max(this.pos_.x,0);this.pos_.x=
Math.min(this.pos_.x,a);this.pos_.y=Math.max(this.pos_.y,0);this.pos_.y=Math.min(this.pos_.y,b)},updateStylesFromPosition_:function(){this.style.left=this.pos_.x+"px";this.style.top=this.pos_.y+"px";base.Settings.set("mouse_mode_selector.x",this.pos_.x);base.Settings.set("mouse_mode_selector.y",this.pos_.y)},onDragHandleMouseDown_:function(b){b.preventDefault();b.stopImmediatePropagation();this.isDraggingModeSelectorDragHandle_=!0;this.initialRelativeMouseDownPos_.x=b.clientX-this.offsetLeft;this.initialRelativeMouseDownPos_.y=
b.clientY-this.offsetTop},onDragHandleMouseMove_:function(b){this.isDraggingModeSelectorDragHandle_&&(this.pos_.x=b.clientX-this.initialRelativeMouseDownPos_.x,this.pos_.y=b.clientY-this.initialRelativeMouseDownPos_.y,this.constrainPositionToWindowBounds_(),this.updateStylesFromPosition_())},onDragHandleMouseUp_:function(b){this.isDraggingModeSelectorDragHandle_=!1},onWindowResize_:function(b){this.constrainPositionToWindowBounds_();this.updateStylesFromPosition_()}};return{MouseModeSelector:d}});
"use strict";base.requireStylesheet("tracing.timeline_track_view");base.require("base.events");base.require("base.properties");base.require("base.settings");base.require("tracing.filter");base.require("tracing.selection");base.require("tracing.timeline_viewport");base.require("tracing.mouse_mode_constants");base.require("tracing.tracks.drawing_container");base.require("tracing.tracks.trace_model_track");base.require("tracing.tracks.ruler_track");base.require("ui");base.require("ui.mouse_mode_selector");
base.exportTo("tracing",function(){var d=tracing.Selection,b=tracing.TimelineViewport,a=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 b(this);this.viewportStateAtMouseDown_=null;this.rulerTrackContainer_=new tracing.tracks.DrawingContainer(this.viewport_);this.appendChild(this.rulerTrackContainer_);this.rulerTrackContainer_.invalidate();this.rulerTrack_=
new tracing.tracks.RulerTrack(this.viewport_);this.rulerTrackContainer_.appendChild(this.rulerTrack_);this.modelTrackContainer_=new tracing.tracks.DrawingContainer(this.viewport_);this.appendChild(this.modelTrackContainer_);this.modelTrackContainer_.style.display="block";this.modelTrackContainer_.invalidate();this.viewport_.modelTrackContainer=this.modelTrackContainer_;this.modelTrack_=new tracing.tracks.TraceModelTrack(this.viewport_);this.modelTrackContainer_.appendChild(this.modelTrack_);this.mouseModeSelector_=
new ui.MouseModeSelector(this);this.appendChild(this.mouseModeSelector_);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,"beginpan",this.onBeginPanScan_,this);this.bindEventListener_(document,"updatepan",this.onUpdatePanScan_,this);this.bindEventListener_(document,"endpan",this.onEndPanScan_,this);this.bindEventListener_(document,
"beginselection",this.onBeginSelection_,this);this.bindEventListener_(document,"updateselection",this.onUpdateSelection_,this);this.bindEventListener_(document,"endselection",this.onEndSelection_,this);this.bindEventListener_(document,"beginzoom",this.onBeginZoom_,this);this.bindEventListener_(document,"updatezoom",this.onUpdateZoom_,this);this.bindEventListener_(document,"endzoom",this.onEndZoom_,this);this.bindEventListener_(document,"keydown",this.onKeydown_,this);this.bindEventListener_(document,
"keyup",this.onKeyup_,this);this.addEventListener("mousemove",this.onMouseMove_);this.addEventListener("dblclick",this.onDblClick_);this.mouseViewPosAtMouseDown_={x:0,y:0};this.lastMouseViewPos_={x:0,y:0};this.selection_=new d;this.isZooming_=this.isPanningAndScanning_=!1},distanceCoveredInPanScan_:function(a){a=this.lastMouseViewPos_.x-this.mouseViewPosAtMouseDown_.x;var b=this.lastMouseViewPos_.y-this.mouseViewPosAtMouseDown_.y;return Math.sqrt(a*a+b*b)},bindEventListener_:function(a,b,d,g){this.boundListeners_||
(this.boundListeners_=[]);d=d.bind(g);this.boundListeners_.push({object:a,event:b,boundFunc:d});a.addEventListener(b,d)},detach:function(){this.modelTrack_.detach();for(var a=0;a<this.boundListeners_.length;a++){var b=this.boundListeners_[a];b.object.removeEventListener(b.event,b.boundFunc)}this.boundListeners_=void 0;this.viewport_.detach()},get viewport(){return this.viewport_},get categoryFilter(){return this.categoryFilter_},set categoryFilter(a){this.modelTrackContainer_.invalidate();this.categoryFilter_=
a;this.modelTrack_.categoryFilter=a},get model(){return this.model_},set model(a){if(!a)throw Error("Model cannot be null");var b=this.model_!=a;this.model_=a;this.modelTrack_.model=a;this.modelTrack_.categoryFilter=this.categoryFilter;b&&this.viewport_.setWhenPossible(this.setInitialViewport_.bind(this));base.setPropertyAndDispatchChange(this,"model",a)},get hasVisibleContent(){return this.modelTrack_.hasVisibleContent},setInitialViewport_:function(){var a=this.modelTrackContainer_.canvas.width,
b,d;this.model_.bounds.isEmpty?(b=0,d=1E3):0==this.model_.bounds.range?(b=this.model_.bounds.min,d=1E3):(b=this.model_.bounds.min,d=this.model_.bounds.range);var g=0.15*d;this.viewport_.xSetWorldBounds(b-g,b+d+g,a)},addAllObjectsMatchingFilterToSelection:function(a,b){this.modelTrack_.addAllObjectsMatchingFilterToSelection(a,b)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},set focusElement(a){this.focusElement_=a},get listenToKeys_(){return!this.viewport_.isAttachedToDocument_||
this.activeElement instanceof tracing.FindControl?!1:this.focusElement_?0<=this.focusElement.tabIndex?document.activeElement==this.focusElement?!0:ui.elementIsChildOf(document.activeElement,this.focusElement):!0:!0},onMouseMove_:function(a){this.isZooming_||this.storeLastMousePos_(a)},onKeypress_:function(a){var b=this.viewport_;if(this.listenToKeys_&&"INPUT"!=document.activeElement.nodeName){var d=this.modelTrackContainer_.canvas.clientWidth;switch(a.keyCode){case 119:case 44:this.zoomBy_(1.5);break;
case 115:case 111:this.zoomBy_(1/1.5);break;case 103:this.onGridToggle_(!0);break;case 71:this.onGridToggle_(!1);break;case 87:case 60:this.zoomBy_(10);break;case 83:case 79:this.zoomBy_(0.1);break;case 97:b.panX+=b.xViewVectorToWorld(0.1*d);break;case 100:case 101:b.panX-=b.xViewVectorToWorld(0.1*d);break;case 65:b.panX+=b.xViewVectorToWorld(0.5*d);break;case 68:b.panX-=b.xViewVectorToWorld(0.5*d);break;case 48:case 122:this.setInitialViewport_();break;case 102:this.zoomToSelection()}}},onKeydown_:function(a){if(this.listenToKeys_){var b,
d=this.viewport_,g=this.modelTrackContainer_.canvas.clientWidth;switch(a.keyCode){case 37:(b=this.selection.getShiftedSelection(-1))?(this.selection=b,this.panToSelection(),a.preventDefault()):d.panX+=d.xViewVectorToWorld(0.1*g);break;case 39:(b=this.selection.getShiftedSelection(1))?(this.selection=b,this.panToSelection(),a.preventDefault()):d.panX-=d.xViewVectorToWorld(0.1*g);break;case 9:-1==this.focusElement.tabIndex&&(a.shiftKey?this.selectPrevious_(a):this.selectNext_(a),a.preventDefault())}}},
onKeyup_:function(a){this.listenToKeys_&&(a.shiftKey||this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_))},zoomBy_:function(a){var b=this.viewport_,d=this.modelTrackContainer_.canvas.clientWidth,g=this.lastMouseViewPos_.x*(window.devicePixelRatio||1),h=b.xViewToWorld(g);b.scaleX*=a;b.xPanWorldPosToViewPos(h,g,d)},zoomToSelection:function(){if(this.selection&&this.selection.length){var a=this.selection.bounds;if(a.range){var b=
a.center,a=0.5*a.range,d=0.5*a;this.viewport_.xSetWorldBounds(b-a-d,b+a+d,this.modelTrackContainer_.canvas.width)}}},panToSelection:function(){if(this.selection&&this.selection.length){var a=this.selection.bounds,b=a.center,d=this.modelTrackContainer_.canvas.width;if(a.range){var g=0.5*a.range,h=0.5*g;this.viewport_.xPanWorldBoundsIntoView(b-g-h,b+g+h,d);this.viewport_.xPanWorldBoundsIntoView(a.min,a.max,d)}else(0>this.viewport_.xWorldToView(a.center)||this.viewport_.xWorldToView(a.center)>d)&&this.viewport_.xPanWorldPosToViewPos(b,
"center",d)}},get keyHelp(){var a="Qwerty Controls\n w/s                   : Zoom in/out     (with shift: go faster)\n a/d                   : Pan left/right\n\nDvorak Controls\n ,/o                   : Zoom in/out     (with shift: go faster)\n a/e                   : Pan left/right\n\nMouse Controls\n drag (Selection mode) : Select slices   (with "+(0==navigator.platform.indexOf("Mac")?"cmd":"ctrl")+": zoom to slices)\n drag (Pan mode)       : Pan left/right/up/down)\n\n",a=this.focusElement.tabIndex?
a+" <-                 : Select previous event on current timeline\n ->                 : Select next event on current timeline\n":a+"General Navigation\n g/General          : Shows grid at the start/end of the  selected task\n <-,^TAB            : Select previous event on current timeline\n ->, TAB            : Select next event on current timeline\n";return a+"\nSpace to switch between select / pan modes\nShift to temporarily switch between select / pan modes\nScroll to zoom in/out (in pan mode)\nDbl-click to add timing markers\nf to zoom into selection\nz to reset zoom and pan to initial view\n/ to search\n"},
get selection(){return this.selection_},set selection(a){if(!(a instanceof d))throw Error("Expected Selection");var b;for(b=0;b<this.selection_.length;b++)this.selection_[b].selected=!1;this.selection_.clear();this.selection_.addSelection(a);base.dispatchSimpleEvent(this,"selectionChange");for(b=0;b<this.selection_.length;b++)this.selection_[b].selected=!0;this.selection_.length&&this.selection_[0].track&&this.selection_[0].track.scrollIntoViewIfNeeded();this.viewport_.dispatchChangeEvent()},hideDragBox_:function(){this.dragBox_.style.left=
"-1000px";this.dragBox_.style.top="-1000px";this.dragBox_.style.width=0;this.dragBox_.style.height=0},setDragBoxPosition_:function(a,b,d,g){var h=Math.min(b,g);g=Math.max(b,g);b=Math.min(a,d);a=Math.max(a,d);this.modelTrack_.getBoundingClientRect();d=b+(a-b);g=h+(g-h);var k=this.modelTrackContainer_.getBoundingClientRect(),l=k.left,m=k.top,n=k.right,k=k.bottom,p=window.getComputedStyle(this.querySelector("heading")).width,p=parseInt(p),l=l+p;p={};b>n||d<l||h>k||g<m?h=!1:(p.left=Math.max(l,b),p.top=
Math.max(m,h),p.right=Math.min(n,d),p.bottom=Math.min(k,g),p.width=p.right-p.left,p.height=p.bottom-p.top,h=p);this.dragBox_.style.left=h.left+"px";this.dragBox_.style.width=h.width+"px";this.dragBox_.style.top=h.top+"px";this.dragBox_.style.height=h.height+"px";h=window.devicePixelRatio||1;d=this.modelTrackContainer_.canvas;b=this.viewport_.xViewToWorld((b-d.offsetLeft)*h);h=this.viewport_.xViewToWorld((a-d.offsetLeft)*h);a=Math.round(100*(h-b))/100;this.dragBox_.textContent=a+"ms";a=new base.Event("selectionChanging");
a.loWX=b;a.hiWX=h;this.dispatchEvent(a)},onGridToggle_:function(a){var b=a?this.selection_.bounds.min:this.selection_.bounds.max;if(this.viewport_.gridEnabled&&this.viewport_.gridSide===a&&this.viewport_.gridTimebase===b)this.viewport_.gridside=void 0,this.viewport_.gridEnabled=!1,this.viewport_.gridTimebase=void 0;else{var d=Math.ceil((b-this.model_.bounds.min)/this.viewport_.gridStep_);this.viewport_.gridTimebase=b-(d+1)*this.viewport_.gridStep_;this.viewport_.gridEnabled=!0;this.viewport_.gridSide=
a;this.viewport_.gridTimebase=b}},canBeginInteraction_:function(a){return 0!=a.button||ui.elementIsChildOf(a.target,this.rulerTrack_)?!1:!0},onDblClick_:function(a){if(this.isPanningAndScanning_){var b=new base.Event("endpan");b.data=a;this.onEndPanScan_(b)}this.isZooming_&&(b=new base.Event("endzoom"),b.data=a,this.onEndZoom_(b));this.rulerTrack_.placeAndBeginDraggingMarker(a.clientX);a.preventDefault()},storeLastMousePos_:function(a){this.lastMouseViewPos_=this.extractRelativeMousePosition_(a)},
extractRelativeMousePosition_:function(a){var b=this.modelTrackContainer_.canvas;return{x:a.clientX-b.offsetLeft,y:a.clientY-b.offsetTop}},storeInitialMouseDownPos_:function(a){a=this.extractRelativeMousePosition_(a);this.mouseViewPosAtMouseDown_.x=a.x;this.mouseViewPosAtMouseDown_.y=a.y},focusElements_:function(){document.activeElement&&document.activeElement.blur();0<=this.focusElement.tabIndex&&this.focusElement.focus()},storeInitialInteractionPositionsAndFocus_:function(a){this.storeInitialMouseDownPos_(a);
this.storeLastMousePos_(a);this.focusElements_()},onBeginPanScan_:function(a){var b=this.viewport_;a=a.data;this.canBeginInteraction_(a)&&(this.viewportStateAtMouseDown_=b.getStateInViewCoordinates(),this.isPanningAndScanning_=!0,this.storeInitialInteractionPositionsAndFocus_(a),a.preventDefault())},onUpdatePanScan_:function(a){this.isPanningAndScanning_&&(a=a.data,this.viewport_.setStateInViewCoordinates({panX:this.viewportStateAtMouseDown_.panX+(this.lastMouseViewPos_.x-this.mouseViewPosAtMouseDown_.x),
panY:this.viewportStateAtMouseDown_.panY-(this.lastMouseViewPos_.y-this.mouseViewPosAtMouseDown_.y)}),a.preventDefault(),a.stopPropagation(),this.storeLastMousePos_(a))},onEndPanScan_:function(a){var b=a.data;this.isPanningAndScanning_=!1;this.storeLastMousePos_(b);4<this.distanceCoveredInPanScan_(b)||(this.dragBeginEvent_=b,this.onEndSelection_(a))},onBeginSelection_:function(a){a=a.data;if(this.canBeginInteraction_(a)){var b=this.modelTrackContainer_.canvas,d=this.modelTrack_.getBoundingClientRect(),
b=b.getBoundingClientRect();d&&(a.clientX>=d.left&&a.clientX<d.right&&a.clientY>=d.top&&a.clientY<d.bottom&&a.clientX>=b.left&&a.clientX<b.right)&&(this.dragBeginEvent_=a,this.storeInitialInteractionPositionsAndFocus_(a),a.preventDefault())}},onUpdateSelection_:function(a){a=a.data;this.dragBeginEvent_&&(this.dragBoxXStart_=this.dragBeginEvent_.clientX,this.dragBoxXEnd_=a.clientX,this.dragBoxYStart_=this.dragBeginEvent_.clientY,this.dragBoxYEnd_=a.clientY,this.setDragBoxPosition_(this.dragBoxXStart_,
this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_))},onEndSelection_:function(a){if(this.dragBeginEvent_){var b=a.data;this.hideDragBox_();var f=this.dragBeginEvent_||b;this.dragBeginEvent_=null;var g=Math.min(f.clientY,b.clientY),h=Math.max(f.clientY,b.clientY),k=Math.min(f.clientX,b.clientX),b=Math.max(f.clientX,b.clientX);this.modelTrackContainer_.getBoundingClientRect();f=this.modelTrackContainer_.canvas;k-=f.offsetLeft;b-=f.offsetLeft;f=new d;this.modelTrack_.addIntersectingItemsInRangeToSelection(k,
b,g,h,f);this.selection=f;(base.isMac&&a.metaKey||!base.isMac&&a.ctrlKey)&&this.zoomToSelection_()}},onBeginZoom_:function(a){a=a.data;this.canBeginInteraction_(a)&&(this.isZooming_=!0,this.storeInitialInteractionPositionsAndFocus_(a),a.preventDefault())},onUpdateZoom_:function(a){if(this.isZooming_){a=a.data;var b=this.extractRelativeMousePosition_(a);this.zoomBy_(1+0.01*(this.lastMouseViewPos_.y-b.y));this.storeLastMousePos_(a)}},onEndZoom_:function(a){this.isZooming_=!1}};return{TimelineTrackView:a}});
"use strict";base.require("tracing.timeline_track_view");base.require("tracing.filter");base.require("ui.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_=-1}var b=ui.define("div");b.prototype={__proto__:ui.Overlay.prototype,decorate:function(){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",this.findPrevious_.bind(this));var b=document.createElement("div");b.className="button find-next";b.textContent="\u2192";b.addEventListener("click",this.findNext_.bind(this));this.filterEl_=document.createElement("input");this.filterEl_.type="input";this.filterEl_.addEventListener("input",this.filterTextChanged_.bind(this));this.filterEl_.addEventListener("keydown",function(a){13==a.keyCode?a.shiftKey?this.findPrevious_():
this.findNext_():27==a.keyCode&&(this.filterEl_.blur(),this.updateHitCountEl_())}.bind(this));this.filterEl_.addEventListener("blur",function(a){this.updateHitCountEl_()}.bind(this));this.filterEl_.addEventListener("focus",function(a){this.controller.reset();this.filterTextChanged_();this.filterEl_.select()}.bind(this));this.filterEl_.addEventListener("mouseup",function(a){a.preventDefault()});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_.focus()},filterTextChanged_:function(){this.controller.filterText=this.filterEl_.value;this.updateHitCountEl_()},findNext_:function(){this.controller&&this.controller.findNext();this.updateHitCountEl_()},findPrevious_:function(){this.controller&&this.controller.findPrevious();this.updateHitCountEl_()},updateHitCountEl_:function(){if(this.controller&&
document.activeElement==this.filterEl_){var a=this.controller.currentHitIndex,b=this.controller.filterHits.length;this.hitCountEl_.textContent=0==b?"0 of 0":a+1+" of "+b}else this.hitCountEl_.textContent=""}};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.showHits_(this.filterHits))},
get filterHits(){if(this.filterHitsDirty_&&(this.filterHitsDirty_=!1,this.filterHits_.clear(),this.currentHitIndex_=-1,this.timeline_&&this.filterText.length)){var a=new tracing.TitleFilter(this.filterText);this.timeline.addAllObjectsMatchingFilterToSelection(a,this.filterHits_)}return this.filterHits_},get currentHitIndex(){return this.currentHitIndex_},showHits_:function(a,b,d){this.timeline&&(this.timeline.selection=a,b?this.timeline.zoomToSelection():d&&this.timeline.panToSelection())},find_:function(a){var b=
-1===this.currentHitIndex_;b&&0>a&&(this.currentHitIndex_=0);var d=this.filterHits.length;this.currentHitIndex_=(this.currentHitIndex_+a+d)%d;a=this.filterHits.subSelection(this.currentHitIndex_);this.showHits_(a,b,!0)},findNext:function(){this.find_(1)},findPrevious:function(){this.find_(-1)},reset:function(){this.filterText_="";this.filterHitsDirty_=!0}};return{FindControl:b,FindController:d}});"use strict";base.require("ui");base.requireStylesheet("ui.drag_handle");
base.exportTo("ui",function(){var d=ui.define("x-drag-handle");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.lastMousePos_=0;this.onMouseMove_=this.onMouseMove_.bind(this);this.onMouseUp_=this.onMouseUp_.bind(this);this.addEventListener("mousedown",this.onMouseDown_);this.target_=void 0;this.horizontal=!0;this.observer_=new WebKitMutationObserver(this.didTargetMutate_.bind(this));this.targetSizesByModeKey_={}},get modeKey_(){return""==this.target_.className?".":this.target_.className},
get target(){return this.target_},set target(b){this.observer_.disconnect();(this.target_=b)&&this.observer_.observe(this.target_,{attributes:!0,attributeFilter:["class"]})},get horizontal(){return this.horizontal_},set horizontal(b){this.className=(this.horizontal_=b)?"horizontal-drag-handle":"vertical-drag-handle"},get vertical(){return!this.horizontal_},set vertical(b){this.horizontal=!b},forceMutationObserverFlush_:function(){var b=this.observer_.takeRecords();b.length&&this.didTargetMutate_(b)},
didTargetMutate_:function(b){b=this.targetSizesByModeKey_[this.modeKey_];void 0!==b?this.setTargetSize_(b):this.target_.style[this.targetStyleKey_]=""},get targetStyleKey_(){return this.horizontal_?"height":"width"},getTargetSize_:function(){var b=this.targetStyleKey_;this.target_.style[b]||(this.target_.style[b]=window.getComputedStyle(this.target_)[b]);b=parseInt(this.target_.style[b]);return this.targetSizesByModeKey_[this.modeKey_]=b},setTargetSize_:function(b){this.target_.style[this.targetStyleKey_]=
b+"px";this.targetSizesByModeKey_[this.modeKey_]=b},applyDelta_:function(b){var a=this.getTargetSize_();if(this.target_==this.nextSibling)b=a+b;else{if(this.target_!=this.previousSibling)throw Error("Must be next sibling");b=a-b}this.setTargetSize_(b)},onMouseMove_:function(b){var a=this.horizontal_?b.clientY:b.clientX;this.applyDelta_(this.lastMousePos_-a);this.lastMousePos_=a;b.preventDefault();return!0},onMouseDown_:function(b){if(this.target_)return this.forceMutationObserverFlush_(),this.lastMousePos_=
this.horizontal_?b.clientY:b.clientX,document.addEventListener("mousemove",this.onMouseMove_),document.addEventListener("mouseup",this.onMouseUp_),b.preventDefault(),!0},onMouseUp_:function(b){document.removeEventListener("mousemove",this.onMouseMove_);document.removeEventListener("mouseup",this.onMouseUp_);b.preventDefault()}};return{DragHandle:d}});"use strict";base.requireStylesheet("tracing.timeline_view");base.requireTemplate("tracing.timeline_view");base.require("base.utils");base.require("base.settings");
base.require("tracing.analysis.analysis_view");base.require("tracing.category_filter_dialog");base.require("tracing.filter");base.require("tracing.find_control");base.require("tracing.timeline_track_view");base.require("ui.overlay");base.require("ui.drag_handle");
base.exportTo("tracing",function(){var d=ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("timeline-view");var b=base.instantiateTemplate("#timeline-view-template");this.appendChild(b);this.titleEl_=this.querySelector(".title");this.leftControlsEl_=this.querySelector("#left-controls");this.rightControlsEl_=this.querySelector("#right-controls");this.timelineContainer_=this.querySelector(".container");this.categoryFilterButton_=this.createCategoryFilterButton_();
this.categoryFilterButton_.callback=this.updateCategoryFilter_.bind(this);this.findCtl_=new tracing.FindControl;this.findCtl_.controller=new tracing.FindController;this.rightControls.appendChild(this.createImportErrorsButton_());this.rightControls.appendChild(this.categoryFilterButton_);this.rightControls.appendChild(this.createMetadataButton_());this.rightControls.appendChild(this.findCtl_);this.rightControls.appendChild(this.createHelpButton_());this.dragEl_=new ui.DragHandle;this.appendChild(this.dragEl_);
this.analysisEl_=new tracing.analysis.AnalysisView;this.analysisEl_.addEventListener("requestSelectionChange",this.onRequestSelectionChange_.bind(this));this.appendChild(this.analysisEl_);this.onSelectionChanged_=this.onSelectionChanged_.bind(this);document.addEventListener("keypress",this.onKeypress_.bind(this),!0);this.dragEl_.target=this.analysisEl_},createImportErrorsButton_:function(){var b=base.instantiateTemplate("#import-errors-btn-template"),a=b.querySelector(".view-import-errors-button"),
b=b.querySelector(".info-button-container"),c=b.querySelector(".info-button-text"),d=new ui.Overlay;d.classList.add("view-import-errors-overlay");d.obeyCloseEvents=!0;d.appendChild(b);a.addEventListener("click",function(){d.visible=!0;c.textContent=this.model.importErrors.join("\n")}.bind(this));b=function(){a.style.display=this.model&&this.model.importErrors.length?"":"none"}.bind(this);b();this.addEventListener("modelChange",b);return a},updateCategoryFilter_:function(b){this.timeline_&&(this.timeline_.categoryFilter=
new tracing.CategoryFilter(b))},createCategoryFilterButton_:function(){var b=base.instantiateTemplate("#category-filter-btn-template").querySelector(".view-info-button");b.addEventListener("click",function(){var a=new tracing.CategoryFilterDialog;a.categories=this.model.categories;a.settings_key="categories";a.settingUpdatedCallback=this.updateCategoryFilter_.bind(this);a.visible=!0}.bind(this));var a=function(){b.style.display=this.model?"":"none"}.bind(this);a();this.addEventListener("modelChange",
a);return b},createHelpButton_:function(){var b=base.instantiateTemplate("#help-btn-template"),a=b.querySelector(".view-help-button"),c=b.querySelector(".view-help-text"),d=new ui.Overlay;d.classList.add("view-help-overlay");d.obeyCloseEvents=!0;d.additionalCloseKeyCodes.push(63);d.appendChild(c);a.addEventListener("click",function(a){d.visible=!0;c.textContent=this.timeline_?this.timeline_.keyHelp:"No content loaded. For interesting help, load something.";a.stopPropagation();return!1}.bind(this));
return a},createMetadataButton_:function(){var b=base.instantiateTemplate("#metadata-btn-template"),a=b.querySelector(".view-metadata-button"),b=b.querySelector(".info-button-container"),c=b.querySelector(".info-button-text"),d=new ui.Overlay;d.classList.add("view-metadata-overlay");d.obeyCloseEvents=!0;d.appendChild(b);a.addEventListener("click",function(){d.visible=!0;var a=[],b=this.model,h;for(h in b.metadata){var k=b.metadata[h],l=JSON.stringify(k.name),k=JSON.stringify(k.value,void 0," ");a.push(l+
": "+k)}c.textContent=a.join("\n")}.bind(this));b=function(){a.style.display=this.model&&this.model.metadata.length?"":"none"}.bind(this);b();this.addEventListener("modelChange",b);return a},get leftControls(){return this.leftControlsEl_},get rightControls(){return this.rightControlsEl_},get viewTitle(){return this.titleEl_.textContent.substring(this.titleEl_.textContent.length-2)},set viewTitle(b){void 0===b?(this.titleEl_.textContent="",this.titleEl_.hidden=!0):(this.titleEl_.hidden=!1,this.titleEl_.textContent=
b)},set traceData(b){this.model=new tracing.TraceModel(b)},get model(){if(this.timeline_)return this.timeline_.model},set model(b){var a=b!=this.model,c=b&&!b.bounds.isEmpty;a&&(this.timelineContainer_.textContent="",this.timeline_&&(this.timeline_.removeEventListener("selectionChange",this.onSelectionChanged_),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.onSelectionChanged_),this.analysisEl_.clearSelectionHistory());c&&(this.timeline_.model=b);base.dispatchSimpleEvent(this,"modelChange");if(a)this.onSelectionChanged_()},get timeline(){return this.timeline_},get settings(){this.settings_||(this.settings_=new base.Settings);return this.settings_},set focusElement(b){this.focusElement_=
b;this.timeline_&&(this.timeline_.focusElement=b)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},get isAttachedToDocument_(){for(var b=this;b.parentNode;)b=b.parentNode;return b==this.ownerDocument},get listenToKeys_(){if(this.isAttachedToDocument_)return this.focusElement_?0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0:!0},onKeypress_:function(b){this.listenToKeys_&&(47==event.keyCode?(this.findCtl_.focus(),event.preventDefault()):
63==b.keyCode&&(this.querySelector(".view-help-button").click(),b.preventDefault()))},beginFind:function(){if(!this.findInProgress_){this.findInProgress_=!0;var b=tracing.FindControl();b.controller=new tracing.FindController;b.controller.timeline=this.timeline;b.visible=!0;b.addEventListener("close",function(){this.findInProgress_=!1}.bind(this));b.addEventListener("findNext",function(){});b.addEventListener("findPrevious",function(){})}},onSelectionChanged_:function(b){b=this.timelineContainer_.scrollTop;
var a=this.timeline_?this.timeline_.selection:new tracing.Selection;this.analysisEl_.selection=a;this.timelineContainer_.scrollTop=b},onRequestSelectionChange_:function(b){this.timeline_.selection=b.selection;b.stopPropagation()}};return{TimelineView:d}});"use strict";base.require("tracing.timeline_view");base.require("tracing.importer");
