systrace: update to trace-viewer rev 173

Change-Id: I1dabf423e49ae2fbafbe967f16c1a05484d19463
diff --git a/UPSTREAM_REVISION b/UPSTREAM_REVISION
index b34c321..c4597e5 100644
--- a/UPSTREAM_REVISION
+++ b/UPSTREAM_REVISION
@@ -1 +1 @@
-171
+173
diff --git a/script.js b/script.js
index 063918f..fff5c6e 100644
--- a/script.js
+++ b/script.js
@@ -3,14 +3,14 @@
 window.FLATTENED["tracks.timeline_counter_track"]=!0;window.FLATTENED["tracks.timeline_slice_group_track"]=!0;window.FLATTENED["tracks.timeline_async_slice_group_track"]=!0;window.FLATTENED["tracks.timeline_thread_track"]=!0;window.FLATTENED["tracks.timeline_process_track"]=!0;window.FLATTENED["tracks.timeline_model_track"]=!0;window.FLATTENED["tracks.timeline_viewport_track"]=!0;window.FLATTENED.timeline=!0;window.FLATTENED.timeline_analysis=!0;window.FLATTENED.overlay=!0;
 window.FLATTENED.timeline_category_filter_dialog=!0;window.FLATTENED.timeline_find_control=!0;window.FLATTENED.trace_event_importer=!0;window.FLATTENED.linux_perf_parser=!0;window.FLATTENED.linux_perf_cpufreq_parser=!0;window.FLATTENED.linux_perf_drm_parser=!0;window.FLATTENED.linux_perf_exynos_parser=!0;window.FLATTENED.linux_perf_gesture_parser=!0;window.FLATTENED.linux_perf_i915_parser=!0;window.FLATTENED.linux_perf_mali_parser=!0;window.FLATTENED.linux_perf_power_parser=!0;
 window.FLATTENED.linux_perf_sched_parser=!0;window.FLATTENED.linux_perf_workqueue_parser=!0;window.FLATTENED.linux_perf_android_parser=!0;window.FLATTENED.linux_perf_importer=!0;window.FLATTENED.settings=!0;window.FLATTENED[".usr.local.android.jb1.external.chromium-trace.trace-viewer.src.timeline_view"]=!0;"use strict";var global=this;
-this.base=function(){function e(a){"/"==a[a.length-1]&&(a=a.substring(0,a.length-1));p=a}function d(a,b){o[a]||(o[a]=[]);for(var c=o[a],f=!1,g=0;g<c.length;g++)c[g]==b&&(f=!0);f||c.push(b)}function a(a,b){r[a]||(r[a]=[]);for(var c=r[a],f=!1,g=0;g<c.length;g++)c[g]==b&&(f=!0);f||c.push(b)}function b(){if(!m){m=!0;var b=new XMLHttpRequest;b.open("GET",p+"/deps.js",!1);b.send(null);if(200!=b.status)throw Error("Could not find "+deps+". Run calcdeps.py and try again.");base.addModuleStylesheet=a;base.addModuleDependency=
-d;try{eval(b.responseText)}catch(c){throw Error("When loading deps, got "+c.stack?c.stack:c);}delete base.addModuleDependency;delete base.addModuleStylesheet}}function c(a,g){var d=g||0;if(window.FLATTENED){if(!window.FLATTENED[a])throw Error("Somehow, module "+a+" didn't get flattened!");}else if(b(),"APPENDED"!=s[a]){if("RESOLVING"==s[a])throw Error("Circular dependency betwen modules. Cannot continue!");s[a]="RESOLVING";for(var l=r[a]||[],h=0;h<l.length;h++)f(l[h]);l=o[a]||[];for(h=0;h<l.length;h++)c(l[h],
-d+1);d=a.replace(/\./g,"/")+".js";base.doc.write('<script type="text/javascript" src="'+(p+"/"+d)+'"><\/script>');s[a]="APPENDED"}}function f(a){if(!window.FLATTENED&&!t[a]){t[a]=!0;var a=a.replace(/\./g,"/")+".css",a=p+"/"+a,b=document.createElement("link");b.setAttribute("rel","stylesheet");b.setAttribute("href",a);base.doc.head.appendChild(b)}}function g(a,b,c,f){var g=new base.Event(b+"Change");g.propertyName=b;g.newValue=c;g.oldValue=f;a.dispatchEvent(g)}function l(a){return a.replace(/([A-Z])/g,
-"-$1").toLowerCase()}function h(a,b){switch(b){case q.JS:var c=a+"_";return function(){return this[c]};case q.ATTR:var f=l(a);return function(){return this.getAttribute(f)};case q.BOOL_ATTR:return f=l(a),function(){return this.hasAttribute(f)}}}function j(a,b,c){switch(b){case q.JS:var f=a+"_";return function(b){var d=this[f];b!==d&&(this[f]=b,c&&c.call(this,b,d),g(this,a,b,d))};case q.ATTR:var d=l(a);return function(b){var f=this[d];b!==f&&(void 0==b?this.removeAttribute(d):this.setAttribute(d,b),
-c&&c.call(this,b,f),g(this,a,b,f))};case q.BOOL_ATTR:return d=l(a),function(b){var f=this[d];b!==f&&(b?this.setAttribute(d,a):this.removeAttribute(d),c&&c.call(this,b,f),g(this,a,b,f))}}}function k(a,b,c){var f=base.doc.createEvent("Event");f.initEvent(a,!!b,!!c);f.__proto__=global.Event.prototype;return f}var p=".",m=!1,o={},r={},s={},t={},q={JS:"js",ATTR:"attr",BOOL_ATTR:"boolAttr"},v=1;return{set moduleBasePath(a){e(a)},get moduleBasePath(){return p},require:c,requireStylesheet:f,exportTo:function(a,
-b){var c;c=a.split(".");for(var f=global,g;c.length&&(g=c.shift());)f=g in f?f[g]:f[g]={};c=f;try{var d=b()}catch(l){console.log("While running exports for ",name,":");console.log(l.stack||l);return}for(var h in d)(f=Object.getOwnPropertyDescriptor(d,h))&&Object.defineProperty(c,h,f)},addSingletonGetter:function(a){a.getInstance=function(){return a.instance_||(a.instance_=new a)}},createUid:function(){return v++},defineProperty:function(a,b,c,f){"function"==typeof a&&(a=a.prototype);c=c||q.JS;a.__lookupGetter__(b)||
-a.__defineGetter__(b,h(b,c));a.__lookupSetter__(b)||a.__defineSetter__(b,j(b,c,f))},dispatchPropertyChange:g,dispatchSimpleEvent:function(a,b,c,f){b=new base.Event(b,c,f);return a.dispatchEvent(b)},Event:k,getUid:function(a){return a.hasOwnProperty("uid")?a.uid:a.uid=v++},initialize:function(){if(global.document)k.prototype={__proto__:global.Event.prototype},base.doc=document,base.isMac=/Mac/.test(navigator.platform),base.isWindows=/Win/.test(navigator.platform),base.isChromeOS=/CrOS/.test(navigator.userAgent),
-base.isLinux=/Linux/.test(navigator.userAgent),base.isGTK=/GTK/.test(chrome.toolkit),base.isViews=/views/.test(chrome.toolkit),e("/src");else{var a=cr;Object.defineProperty(global,"cr",{get:function(){Object.defineProperty(global,"cr",{value:a});originalBase.initialize();return a},configurable:!0})}},PropertyKind:q}}();base.initialize();
+this.base=function(){function e(a){"/"==a[a.length-1]&&(a=a.substring(0,a.length-1));q=a}function d(a,b){p[a]||(p[a]=[]);for(var c=p[a],f=!1,g=0;g<c.length;g++)c[g]==b&&(f=!0);f||c.push(b)}function a(a,b){s[a]||(s[a]=[]);for(var c=s[a],f=!1,g=0;g<c.length;g++)c[g]==b&&(f=!0);f||c.push(b)}function b(){if(!m){m=!0;var b=new XMLHttpRequest;b.open("GET",q+"/deps.js",!1);b.send(null);if(200!=b.status)throw Error("Could not find "+deps+". Run calcdeps.py and try again.");base.addModuleStylesheet=a;base.addModuleDependency=
+d;try{eval(b.responseText)}catch(c){throw Error("When loading deps, got "+c.stack?c.stack:c);}delete base.addModuleDependency;delete base.addModuleStylesheet}}function c(a,g){var d=g||0;if(window.FLATTENED){if(!window.FLATTENED[a])throw Error("Somehow, module "+a+" didn't get flattened!");}else if(b(),"APPENDED"!=t[a]){if("RESOLVING"==t[a])throw Error("Circular dependency betwen modules. Cannot continue!");t[a]="RESOLVING";for(var l=s[a]||[],h=0;h<l.length;h++)f(l[h]);l=p[a]||[];for(h=0;h<l.length;h++)c(l[h],
+d+1);d=a.replace(/\./g,"/")+".js";base.doc.write('<script type="text/javascript" src="'+(q+"/"+d)+'"><\/script>');t[a]="APPENDED"}}function f(a){if(!window.FLATTENED&&!u[a]){u[a]=!0;var a=a.replace(/\./g,"/")+".css",a=q+"/"+a,b=document.createElement("link");b.setAttribute("rel","stylesheet");b.setAttribute("href",a);base.doc.head.appendChild(b)}}function g(a,b,c,f){var g=new base.Event(b+"Change");g.propertyName=b;g.newValue=c;g.oldValue=f;a.dispatchEvent(g)}function l(a){return a.replace(/([A-Z])/g,
+"-$1").toLowerCase()}function h(a,b){switch(b){case r.JS:var c=a+"_";return function(){return this[c]};case r.ATTR:var f=l(a);return function(){return this.getAttribute(f)};case r.BOOL_ATTR:return f=l(a),function(){return this.hasAttribute(f)}}}function j(a,b,c){switch(b){case r.JS:var f=a+"_";return function(b){var d=this[f];b!==d&&(this[f]=b,c&&c.call(this,b,d),g(this,a,b,d))};case r.ATTR:var d=l(a);return function(b){var f=this[d];b!==f&&(void 0==b?this.removeAttribute(d):this.setAttribute(d,b),
+c&&c.call(this,b,f),g(this,a,b,f))};case r.BOOL_ATTR:return d=l(a),function(b){var f=this[d];b!==f&&(b?this.setAttribute(d,a):this.removeAttribute(d),c&&c.call(this,b,f),g(this,a,b,f))}}}function k(a,b,c){var f=base.doc.createEvent("Event");f.initEvent(a,!!b,!!c);f.__proto__=global.Event.prototype;return f}var q=".",m=!1,p={},s={},t={},u={},r={JS:"js",ATTR:"attr",BOOL_ATTR:"boolAttr"},w=1;return{set moduleBasePath(a){e(a)},get moduleBasePath(){return q},require:c,requireStylesheet:f,exportTo:function(a,
+b){var c;c=a.split(".");for(var f=global,g;c.length&&(g=c.shift());)f=g in f?f[g]:f[g]={};c=f;try{var d=b()}catch(l){console.log("While running exports for ",name,":");console.log(l.stack||l);return}for(var h in d)(f=Object.getOwnPropertyDescriptor(d,h))&&Object.defineProperty(c,h,f)},addSingletonGetter:function(a){a.getInstance=function(){return a.instance_||(a.instance_=new a)}},createUid:function(){return w++},defineProperty:function(a,b,c,f){"function"==typeof a&&(a=a.prototype);c=c||r.JS;a.__lookupGetter__(b)||
+a.__defineGetter__(b,h(b,c));a.__lookupSetter__(b)||a.__defineSetter__(b,j(b,c,f))},dispatchPropertyChange:g,dispatchSimpleEvent:function(a,b,c,f){b=new base.Event(b,c,f);return a.dispatchEvent(b)},Event:k,getUid:function(a){return a.hasOwnProperty("uid")?a.uid:a.uid=w++},initialize:function(){if(global.document)k.prototype={__proto__:global.Event.prototype},base.doc=document,base.isMac=/Mac/.test(navigator.platform),base.isWindows=/Win/.test(navigator.platform),base.isChromeOS=/CrOS/.test(navigator.userAgent),
+base.isLinux=/Linux/.test(navigator.userAgent),base.isGTK=/GTK/.test(chrome.toolkit),base.isViews=/views/.test(chrome.toolkit),e("/src");else{var a=cr;Object.defineProperty(global,"cr",{get:function(){Object.defineProperty(global,"cr",{value:a});originalBase.initialize();return a},configurable:!0})}},PropertyKind:r}}();base.initialize();
 base.exportTo("base",function(){function e(){}e.prototype={addEventListener:function(d,a){this.listeners_||(this.listeners_=Object.create(null));if(d in this.listeners_){var b=this.listeners_[d];0>b.indexOf(a)&&b.push(a)}else this.listeners_[d]=[a]},removeEventListener:function(d,a){if(this.listeners_&&d in this.listeners_){var b=this.listeners_[d],c=b.indexOf(a);0<=c&&(1==b.length?delete this.listeners_[d]:b.splice(c,1))}},dispatchEvent:function(d){if(!this.listeners_)return!0;var a=this;d.__defineGetter__("target",
 function(){return a});d.preventDefault=function(){this.returnValue=!1};var b=d.type,c=0;if(b in this.listeners_)for(var b=this.listeners_[b].concat(),f=0,g;g=b[f];f++)c=g.handleEvent?c|!1===g.handleEvent.call(g,d):c|!1===g.call(this,d);return!c&&d.returnValue}};return{EventTarget:e}});
 base.exportTo("tracing",function(){function e(){this.iframe_=void 0}e.prototype={__proto__:Object.prototype,measure:function(d){this.iframe_.contentDocument.body.appendChild(d);var a=this.iframe_.contentWindow.getComputedStyle(d),b=parseInt(a.width,10),a=parseInt(a.height,10);this.iframe_.contentDocument.body.removeChild(d);return{width:b,height:a}},attach:function(){var d=document.createElement("iframe");d.style.cssText="width:100%;height:0;border:0;visibility:hidden";document.body.appendChild(d);
@@ -57,22 +57,22 @@
 0:-1:g<=a.length&&f>=b(a[g-1])&&f<b(a[g-1])+c(a[g-1])?g-1:a.length},iterateOverIntersectingIntervals:d,getIntersectingIntervals:function(a,b,c,f,g){var l=[];d(a,b,c,f,g,function(a){l.push(a)});return l}}});"use strict";base.requireStylesheet("tracks.timeline_slice_track");base.require("tracks.timeline_canvas_based_track");base.require("sorted_array_utils");base.require("fast_rect_renderer");base.require("timeline_color_scheme");base.require("ui");
 base.exportTo("tracks",function(){function e(){}function d(a,b){this.string=a;this.width=b}var a=tracing.getColorPalette(),b=base.ui.define(tracks.TimelineCanvasBasedTrack);b.prototype={__proto__:tracks.TimelineCanvasBasedTrack.prototype,SHOULD_ELIDE_TEXT:!0,decorate:function(){this.classList.add("timeline-slice-track");this.elidedTitleCache=new e;this.asyncStyle_=!1},decorateHit:function(){},get asyncStyle(){return this.asyncStyle_},set asyncStyle(a){this.asyncStyle_=!!a;this.invalidate()},get slices(){return this.slices_},
 set slices(a){this.slices_=a||[];a||(this.visible=!1);this.invalidate()},get height(){return window.getComputedStyle(this).height},set height(a){this.style.height=a;this.invalidate()},labelWidth:function(a){var b=f[a];b||(b=this.ctx_.measureText(a).width,f[a]=b);return b+2},labelWidthWorld:function(a,b){return this.labelWidth(a)*b},redraw:function(){var b=this.ctx_,f=this.canvas_.width,g=this.canvas_.height;b.clearRect(0,0,f,g);var d=this.viewport_,e=d.xViewVectorToWorld(1),m=d.xViewToWorld(0),f=
-d.xViewToWorld(f);d.drawUnderContent(b,m,f,g);b.save();d.applyTransformToCanvas(b);this.asyncStyle_&&(b.globalAlpha=0.25);var o=new tracing.FastRectRenderer(b,2*e,2*e,a);o.setYandH(0,g);for(var r=this.slices_,s=tracing.findLowIndexInSortedArray(r,function(a){return a.start+a.duration},m),t=s;t<r.length;++t){var q=r[t],v=q.start;if(v>f)break;var w=Math.max(q.duration,0.001),u=q.selected?q.colorId+c:q.colorId;w<e&&(w=e);0<q.duration?o.fillRect(v,w,u):0.001<e?o.fillRect(v,e,u):(b.fillStyle=a[u],b.beginPath(),
-b.moveTo(v-4*e,g),b.lineTo(v,0),b.lineTo(v+4*e,g),b.closePath(),b.fill())}o.flush();b.restore();o=window.devicePixelRatio||1;if(8<g){b.textAlign="center";b.textBaseline="top";b.font=10*o+"px sans-serif";b.strokeStyle="rgb(0,0,0)";b.fillStyle="rgb(0,0,0)";v=20*e;w=this.SHOULD_ELIDE_TEXT;for(t=s;t<r.length;++t){q=r[t];if(q.start>f)break;if(q.duration>v&&(s=q.title,q.didNotFinish&&(s+=" (Did Not Finish)"),u=this.labelWidth(s),w&&this.labelWidthWorld(s,e)>q.duration&&(u=this.elidedTitleCache.get(this,
-e,s,u,q.duration),s=u.string,u=u.width),u*e<q.duration))q=d.xWorldToView(q.start+0.5*q.duration),b.fillText(s,q,2.5*o,u)}}d.drawOverContent(b,m,f,g)},addIntersectingItemsToSelection:function(a,b,c){var f=this.getBoundingClientRect();if(b<f.top||b>=f.bottom)return!1;a=this.viewport_.xViewVectorToWorld(a*devicePixelRatio);a=tracing.findLowIndexInSortedIntervals(this.slices_,function(a){return a.start},function(a){return a.duration},a);return 0<=a&&a<this.slices_.length?(c=c.addSlice(this,this.slices_[a]),
-this.decorateHit(c),!0):!1},addIntersectingItemsInRangeToSelection:function(a,b,c,f,g){function d(a){a=g.addSlice(r,a);r.decorateHit(a)}var e=window.devicePixelRatio||1,a=this.viewport_.xViewToWorld(a*e),b=this.viewport_.xViewToWorld(b*e),e=this.getBoundingClientRect(),c=Math.max(c,e.top),f=Math.min(f,e.bottom);if(!(c>f)){var r=this;tracing.iterateOverIntersectingIntervals(this.slices_,function(a){return a.start},function(a){return a.duration},a,b,d)}},indexOfSlice_:function(a){for(var b=tracing.findLowIndexInSortedArray(this.slices_,
+d.xViewToWorld(f);d.drawUnderContent(b,m,f,g);b.save();d.applyTransformToCanvas(b);this.asyncStyle_&&(b.globalAlpha=0.25);var p=new tracing.FastRectRenderer(b,2*e,2*e,a);p.setYandH(0,g);for(var s=this.slices_,t=tracing.findLowIndexInSortedArray(s,function(a){return a.start+a.duration},m),u=t;u<s.length;++u){var r=s[u],w=r.start;if(w>f)break;var x=Math.max(r.duration,0.001),v=r.selected?r.colorId+c:r.colorId;x<e&&(x=e);0<r.duration?p.fillRect(w,x,v):0.001<e?p.fillRect(w,e,v):(b.fillStyle=a[v],b.beginPath(),
+b.moveTo(w-4*e,g),b.lineTo(w,0),b.lineTo(w+4*e,g),b.closePath(),b.fill())}p.flush();b.restore();p=window.devicePixelRatio||1;if(8<g){b.textAlign="center";b.textBaseline="top";b.font=10*p+"px sans-serif";b.strokeStyle="rgb(0,0,0)";b.fillStyle="rgb(0,0,0)";w=20*e;x=this.SHOULD_ELIDE_TEXT;for(u=t;u<s.length;++u){r=s[u];if(r.start>f)break;r.duration>w&&(t=r.title,r.didNotFinish&&(t+=" (Did Not Finish)"),v=this.labelWidth(t),x&&this.labelWidthWorld(t,e)>r.duration&&(v=this.elidedTitleCache.get(this,e,
+t,v,r.duration),t=v.string,v=v.width),v*e<r.duration&&(r=d.xWorldToView(r.start+0.5*r.duration),b.fillText(t,r,2.5*p,v)))}}d.drawOverContent(b,m,f,g)},addIntersectingItemsToSelection:function(a,b,c){var f=this.getBoundingClientRect();if(b<f.top||b>=f.bottom)return!1;a=this.viewport_.xViewVectorToWorld(a*devicePixelRatio);a=tracing.findLowIndexInSortedIntervals(this.slices_,function(a){return a.start},function(a){return a.duration},a);return 0<=a&&a<this.slices_.length?(c=c.addSlice(this,this.slices_[a]),
+this.decorateHit(c),!0):!1},addIntersectingItemsInRangeToSelection:function(a,b,c,f,g){function d(a){a=g.addSlice(s,a);s.decorateHit(a)}var e=window.devicePixelRatio||1,a=this.viewport_.xViewToWorld(a*e),b=this.viewport_.xViewToWorld(b*e),e=this.getBoundingClientRect(),c=Math.max(c,e.top),f=Math.min(f,e.bottom);if(!(c>f)){var s=this;tracing.iterateOverIntersectingIntervals(this.slices_,function(a){return a.start},function(a){return a.duration},a,b,d)}},indexOfSlice_:function(a){for(var b=tracing.findLowIndexInSortedArray(this.slices_,
 function(a){return a.start},a.start);b<this.slices_.length&&a.start==this.slices_[b].start&&a.colorId!=this.slices_[b].colorId;)b++;return b<this.slices_.length?b:void 0},addItemNearToProvidedHitToSelection:function(a,b,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 f=
 b.addSlice(this,this.slices_[c]);this.decorateHit(f)}}};var c=tracing.getColorPaletteHighlightIdBoost(),f={},g={};e.prototype={get:function(a,b,c,f,e){var m=g[c];m||(m={},g[c]=m);f=m[b];f||(m[b]={},f=m[b]);m=f[e];if(void 0===m){for(m=!1;a.labelWidthWorld(c,b)>e;)c=c.substring(0,0.75*c.length),m=!0;m&&3<c.length&&(c=c.substring(0,c.length-3)+"...");m=new d(c,a.labelWidth(c));f[e]=m}return m}};return{TimelineSliceTrack:b}});"use strict";
 base.exportTo("tracing",function(){function e(d,a,b,c,f,g){this.category=d||"";this.title=a;this.start=c;this.colorId=b;this.args=f;this.didNotFinish=!1;void 0!==g&&(this.duration=g)}e.prototype={selected:!1,duration:void 0,get end(){return this.start+this.duration}};return{TimelineSlice:e}});"use strict";base.require("timeline_slice");base.require("timeline_color_scheme");base.require("timeline_filter");
 base.exportTo("tracing",function(){function e(a){this.sliceConstructor=a||d;this.openPartialSlices_=[];this.slices=[]}var d=tracing.TimelineSlice;e.prototype={__proto__:Object.prototype,pushSlice:function(a){this.slices.push(a);return a},pushSlices:function(a){this.slices.push.apply(this.slices,a)},beginSlice:function(a,b,c,f){if(this.openPartialSlices_.length&&c<this.openPartialSlices_[this.openPartialSlices_.length-1].start)throw Error("Slices must be added in increasing timestamp order");var g=
 tracing.getStringColorId(b),a=new this.sliceConstructor(a,b,g,c,f?f:{});this.openPartialSlices_.push(a);return a},isTimestampValidForBeginOrEnd:function(a){return!this.openPartialSlices_.length?!0:a>=this.openPartialSlices_[this.openPartialSlices_.length-1].start},get openSliceCount(){return this.openPartialSlices_.length},endSlice:function(a){if(!this.openSliceCount)throw Error("endSlice called without an open slice");var b=this.openPartialSlices_[this.openSliceCount-1];this.openPartialSlices_.splice(this.openSliceCount-
 1,1);if(a<b.start)throw Error("Slice "+b.name+" end time is before its start.");b.duration=a-b.start;this.pushSlice(b);return b},autoCloseOpenSlices:function(a){a||(this.updateBounds(),a=this.maxTimestamp);for(;0<this.openSliceCount;)this.endSlice(a).didNotFinish=!0},shiftTimestampsForward:function(a){for(var b=0;b<this.slices.length;b++){var c=this.slices[b];c.start+=a}for(b=0;b<this.openPartialSlices_.length;b++)c=this.openPartialSlices_[i],c.start+=a},updateBounds:function(){var a=[];if(this.slices.length){for(var b=
-Number.MAX_VALUE,c=-Number.MAX_VALUE,f=0;f<this.slices.length;f++)if(this.slices[f].start<b&&(b=this.slices[f].start),this.slices[f].end>c)c=this.slices[f].end;a.push(b);a.push(c)}this.openPartialSlices_.length&&(a.push(this.openPartialSlices_[0].start),a.push(this.openPartialSlices_[this.openPartialSlices_.length-1].start));a.length?(this.minTimestamp=Math.min.apply(Math,a),this.maxTimestamp=Math.max.apply(Math,a)):this.maxTimestamp=this.minTimestamp=void 0}};return{TimelineSliceGroup:e}});"use strict";
+Number.MAX_VALUE,c=-Number.MAX_VALUE,f=0;f<this.slices.length;f++)this.slices[f].start<b&&(b=this.slices[f].start),this.slices[f].end>c&&(c=this.slices[f].end);a.push(b);a.push(c)}this.openPartialSlices_.length&&(a.push(this.openPartialSlices_[0].start),a.push(this.openPartialSlices_[this.openPartialSlices_.length-1].start));a.length?(this.minTimestamp=Math.min.apply(Math,a),this.maxTimestamp=Math.max.apply(Math,a)):this.maxTimestamp=this.minTimestamp=void 0}};return{TimelineSliceGroup:e}});"use strict";
 base.require("timeline_slice");
 base.exportTo("tracing",function(){function e(b,c,f,g,d){a.call(this,b,c,f,g,d)}function d(a){this.name=a;this.slices=[]}var a=tracing.TimelineSlice;e.prototype={__proto__:a.prototype,toJSON:function(){for(var a={},c=Object.keys(this),f=0;f<c.length;f++){var g=c[f];"function"!=typeof this[g]&&(a[g]="startThread"==g||"endThread"==g?this[g].ptid:this[g])}return a},id:void 0,startThread:void 0,endThread:void 0,subSlices:void 0};d.prototype={__proto__:Object.prototype,push:function(a){this.slices.push(a)},get length(){return this.slices.length},
-shiftTimestampsForward:function(a){for(var c=0;c<this.slices.length;c++){var f=this.slices[c];f.start+=a;for(var g=0;g<f.subSlices.length;g++)f.subSlices[g].start+=a}},updateBounds:function(){if(this.slices.length){for(var a=Number.MAX_VALUE,c=-Number.MAX_VALUE,f=0;f<this.slices.length;f++)if(this.slices[f].start<a&&(a=this.slices[f].start),this.slices[f].end>c)c=this.slices[f].end;this.minTimestamp=a;this.maxTimestamp=c}else this.maxTimestamp=this.minTimestamp=void 0},computeSubGroups:function(){for(var a=
+shiftTimestampsForward:function(a){for(var c=0;c<this.slices.length;c++){var f=this.slices[c];f.start+=a;for(var g=0;g<f.subSlices.length;g++)f.subSlices[g].start+=a}},updateBounds:function(){if(this.slices.length){for(var a=Number.MAX_VALUE,c=-Number.MAX_VALUE,f=0;f<this.slices.length;f++)this.slices[f].start<a&&(a=this.slices[f].start),this.slices[f].end>c&&(c=this.slices[f].end);this.minTimestamp=a;this.maxTimestamp=c}else this.maxTimestamp=this.minTimestamp=void 0},computeSubGroups:function(){for(var a=
 {},c=0;c<this.slices.length;++c){var f=this.slices[c],g=f.startThread.ptid;a[g]||(a[g]=new d(this.name));a[g].slices.push(f)}var c=[],l;for(l in a)f=a[l],f.updateBounds(),c.push(f);return c}};return{TimelineAsyncSlice:e,TimelineAsyncSliceGroup:d}});"use strict";base.require("timeline_slice");base.require("timeline_slice_group");base.require("timeline_async_slice_group");
-base.exportTo("tracing",function(){function e(b,c,f,d,e,p){a.call(this,b,c,f,d,e,p);this.subSlices=[]}function d(a,f){b.call(this,e);if(!a)throw Error("Parent must be provided.");this.pid=a.pid;this.tid=f;this.cpuSlices=void 0;this.asyncSlices=new c(this.ptid)}var a=tracing.TimelineSlice,b=tracing.TimelineSliceGroup,c=tracing.TimelineAsyncSliceGroup;e.prototype={__proto__:a.prototype};var f={};d.getPTIDFromPidAndTid=function(a,b){f[a]||(f[a]={});f[a][b]||(f[a][b]=a+":"+b);return f[a][b]};d.prototype=
+base.exportTo("tracing",function(){function e(b,c,f,d,e,q){a.call(this,b,c,f,d,e,q);this.subSlices=[]}function d(a,f){b.call(this,e);if(!a)throw Error("Parent must be provided.");this.pid=a.pid;this.tid=f;this.cpuSlices=void 0;this.asyncSlices=new c(this.ptid)}var a=tracing.TimelineSlice,b=tracing.TimelineSliceGroup,c=tracing.TimelineAsyncSliceGroup;e.prototype={__proto__:a.prototype};var f={};d.getPTIDFromPidAndTid=function(a,b){f[a]||(f[a]={});f[a][b]||(f[a][b]=a+":"+b);return f[a][b]};d.prototype=
 {__proto__:b.prototype,name:void 0,get ptid(){return d.getPTIDFromPidAndTid(this.tid,this.pid)},shiftTimestampsForward:function(a){b.prototype.shiftTimestampsForward.call(this,a);if(this.cpuSlices)for(var c=0;c<this.cpuSlices.length;c++)this.cpuSlices[c].start+=a;this.asyncSlices.shiftTimestampsForward(a)},get isEmpty(){return this.slices.length||this.openSliceCount||this.cpuSlices&&this.cpuSlices.length||this.asyncSlices.length?!1:!0},updateBounds:function(){b.prototype.updateBounds.call(this);var a=
 [];void 0!==this.minTimestamp&&a.push(this.minTimestamp,this.maxTimestamp);this.asyncSlices.slices.length&&(this.asyncSlices.updateBounds(),a.push(this.asyncSlices.minTimestamp),a.push(this.asyncSlices.maxTimestamp));this.cpuSlices&&this.cpuSlices.length&&(a.push(this.cpuSlices[0].start),a.push(this.cpuSlices[this.cpuSlices.length-1].end));a.length?(this.minTimestamp=Math.min.apply(Math,a),this.maxTimestamp=Math.max.apply(Math,a)):this.maxTimestamp=this.minTimestamp=void 0},get userFriendlyName(){return this.pid+
 ": "+(this.name||this.tid)},get userFriendlyDetails(){return"pid: "+this.pid+", tid: "+this.tid+(this.name?", name: "+this.name:"")}};d.compare=function(a,b){if(a.pid!=b.pid)return a.pid-b.pid;if(a.name&&b.name){var c=a.name.localeCompare(b.name);return 0==c?a.tid-b.tid:c}return a.name?-1:b.name?1:a.tid-b.tid};return{TimelineThreadSlice:e,TimelineThread:d}});"use strict";
@@ -86,8 +86,8 @@
 this.slices[0].start,this.maxTimestamp=this.slices[this.slices.length-1].end):this.maxTimestamp=this.minTimestamp=void 0}};e.compare=function(a,b){return a.cpuNumber-b.cpuNumber};return{TimelineCpu:e}});"use strict";base.require("event_target");base.require("timeline_process");base.require("timeline_cpu");base.require("timeline_filter");
 base.exportTo("tracing",function(){function e(a,b){this.cpus={};this.processes={};this.importErrors=[];this.metadata=[];this.categories=[];a&&this.importTraces([a],b)}function d(){this.importPriority=0}var a=tracing.TimelineProcess,b=tracing.TimelineCpu,c=[];e.registerImporter=function(a){c.push(a)};d.canImport=function(a){return a instanceof Array&&0==a.length?!0:"string"===typeof a||a instanceof String?0==a.length:!1};d.prototype={__proto__:Object.prototype,importEvents:function(){},finalizeImport:function(){}};
 e.registerImporter(d);e.prototype={__proto__:base.EventTarget.prototype,get numProcesses(){var a=0,b;for(b in this.processes)a++;return a},getOrCreateCpu:function(a){this.cpus[a]||(this.cpus[a]=new b(a));return this.cpus[a]},getOrCreateProcess:function(b){this.processes[b]||(this.processes[b]=new a(b));return this.processes[b]},autoCloseOpenSlices_:function(){this.updateBounds();var a=this.maxTimestamp,b;for(b in this.processes){var c=this.processes[b],d;for(d in c.threads)c.threads[d].autoCloseOpenSlices(a)}},
-updateCategories_:function(){for(var a in this.processes){var b=this.processes[a],c;for(c in b.threads)for(var d=b.threads[c].slices,e=0;e<d.length;e++){var k=d[e].category;k&&-1==this.categories.indexOf(k)&&this.categories.push(k)}}for(var p in this.cpus){d=this.cpus[p].slices;for(e=0;e<d.length;e++)(k=d[e].category)&&-1==this.categories.indexOf(k)&&this.categories.push(k)}},pruneEmptyThreads_:function(){for(var a in this.processes){var b=this.processes[a],c={},d;for(d in b.threads){var e=b.threads[d];
-e.isEmpty||(c[d]=e)}b.threads=c}},updateBounds:function(){for(var a=Infinity,b=-a,c=!1,d=this.getAllThreads(),e=0;e<d.length;e++){var k=d[e];k.updateBounds();void 0!=k.minTimestamp&&void 0!=k.maxTimestamp&&(a=Math.min(a,k.minTimestamp),b=Math.max(b,k.maxTimestamp),c=!0)}d=this.getAllCounters();for(e=0;e<d.length;e++)k=d[e],k.updateBounds(),void 0!=k.minTimestamp&&void 0!=k.maxTimestamp&&(c=!0,a=Math.min(a,k.minTimestamp),b=Math.max(b,k.maxTimestamp));for(var p in this.cpus)e=this.cpus[p],e.updateBounds(),
+updateCategories_:function(){for(var a in this.processes){var b=this.processes[a],c;for(c in b.threads)for(var d=b.threads[c].slices,e=0;e<d.length;e++){var k=d[e].category;k&&-1==this.categories.indexOf(k)&&this.categories.push(k)}}for(var q in this.cpus){d=this.cpus[q].slices;for(e=0;e<d.length;e++)(k=d[e].category)&&-1==this.categories.indexOf(k)&&this.categories.push(k)}},pruneEmptyThreads_:function(){for(var a in this.processes){var b=this.processes[a],c={},d;for(d in b.threads){var e=b.threads[d];
+e.isEmpty||(c[d]=e)}b.threads=c}},updateBounds:function(){for(var a=Infinity,b=-a,c=!1,d=this.getAllThreads(),e=0;e<d.length;e++){var k=d[e];k.updateBounds();void 0!=k.minTimestamp&&void 0!=k.maxTimestamp&&(a=Math.min(a,k.minTimestamp),b=Math.max(b,k.maxTimestamp),c=!0)}d=this.getAllCounters();for(e=0;e<d.length;e++)k=d[e],k.updateBounds(),void 0!=k.minTimestamp&&void 0!=k.maxTimestamp&&(c=!0,a=Math.min(a,k.minTimestamp),b=Math.max(b,k.maxTimestamp));for(var q in this.cpus)e=this.cpus[q],e.updateBounds(),
 void 0!=e.minTimestamp&&void 0!=e.maxTimestamp&&(c=!0,a=Math.min(a,e.minTimestamp),b=Math.max(b,e.maxTimestamp));c?(this.minTimestamp=a,this.maxTimestamp=b):this.minTimestamp=this.maxTimestamp=void 0},shiftWorldToZero:function(){if(void 0!==this.minTimestamp){var a=this.minTimestamp,b;for(b in this.processes)this.processes[b].shiftTimestampsForward(-a);for(var c in this.cpus)this.cpus[c].shiftTimestampsForward(-a);this.updateBounds()}},getAllThreads:function(){var a=[],b;for(b in this.processes){var c=
 this.processes[b],d;for(d in c.threads)a.push(c.threads[d])}return a},getAllCpus:function(){var a=[],b;for(b in this.cpus)a.push(this.cpus[b]);return a},getAllProcesses:function(){var a=[],b;for(b in this.processes)a.push(this.processes[b]);return a},getAllCounters:function(){var a=[],b;for(b in this.processes){var c=this.processes[b],d;for(d in c.counters)a.push(c.counters[d])}for(var e in this.cpus){b=this.cpus[e];for(var k in b.counters)a.push(b.counters[k])}return a},findAllThreadsNamed:function(a){for(var b=
 [],c=this.getAllThreads(),d=0;d<c.length;d++){var e=c[d];e.name==a&&b.push(e)}return b},createImporter_:function(a){for(var b,d=0;d<c.length;++d)if(c[d].canImport(a)){b=c[d];break}if(!b)throw Error("Could not find an importer for the provided eventData.");return new b(this,a)},importTraces:function(a,b){void 0===b&&(b=!0);for(var c=[],d=0;d<a.length;++d)c.push(this.createImporter_(a[d]));c.sort(function(a,b){return a.importPriority-b.importPriority});for(d=0;d<c.length;d++)c[d].importEvents(0<d);
@@ -97,13 +97,13 @@
 return{TimelineCpuTrack:e}});"use strict";base.requireStylesheet("tracks.timeline_counter_track");base.require("tracks.timeline_canvas_based_track");base.require("timeline_color_scheme");base.require("ui");
 base.exportTo("tracks",function(){var e=tracing.getColorPalette(),d=base.ui.define(tracks.TimelineCanvasBasedTrack);d.prototype={__proto__:tracks.TimelineCanvasBasedTrack.prototype,decorate:function(){this.classList.add("timeline-counter-track");this.addControlButtonElements_(!1);this.selectedSamples_={};this.categoryFilter_=new tracing.TimelineFilter},decorateHit:function(){},get counter(){return this.counter_},set counter(a){this.counter_=a;this.invalidate();this.updateVisibility_()},set categoryFilter(a){this.categoryFilter_=
 a;this.updateVisibility_()},get selectedSamples(){return this.selectedSamples_},updateVisibility_:function(){this.visible=this.counter_&&this.categoryFilter_.matchCounter(this.counter_)},redraw:function(){var a=this.counter_,b=this.ctx_,c=this.canvas_.width,f=this.canvas_.height;b.clearRect(0,0,c,f);var d=this.viewport_,l=d.xViewVectorToWorld(1),h=d.xViewToWorld(0),c=d.xViewToWorld(c);d.drawUnderContent(b,h,c,f);var j=d.xViewVectorToWorld(1);b.save();d.applyTransformToCanvas(b);for(var k=a.numSeries,
-p=a.numSamples,m=tracing.findLowIndexInSortedArray(a.timestamps,function(a){return a},h),m=0<m-1?m-1:0,o=f/a.maxTotal,r=a.numSeries-1;0<=r;r--){b.fillStyle=e[a.seriesColors[r]];b.beginPath();for(var s=m-1,t=0<=s?a.timestamps[s]-j:-1,q=f,v=!1;;){var w=s+1;if(w>=p){b.lineTo(t,q);b.lineTo(t+8*l,q);b.lineTo(t+8*l,f);break}var u=a.timestamps[w],s=a.totals[w*k+r],x=f-o*s;if(u>c){b.lineTo(u,q);b.lineTo(u,f);break}u-t<j?s=w:(v||(b.moveTo(h,f),v=!0),b.lineTo(u,q),b.lineTo(u,x),s=w,t=u,q=x)}b.closePath();b.fill()}b.fillStyle=
-"rgba(255, 0, 0, 1)";for(w in this.selectedSamples_)if(this.selectedSamples_[w]){u=a.timestamps[w];for(r=a.numSeries-1;0<=r;r--)s=a.totals[w*k+r],x=f-o*s,b.fillRect(u-l,x-1,3*l,3)}b.restore();d.drawOverContent(b,h,c,f)},addIntersectingItemsToSelection:function(a,b,c){var f=this.getBoundingClientRect();if(b<f.top||b>=f.bottom)return!1;b=this.viewport_.xViewVectorToWorld(a*devicePixelRatio);f=this.counter_;if(a<this.counter_.timestamps[0])return!1;a=tracing.findLowIndexInSortedArray(f.timestamps,function(a){return a},
+q=a.numSamples,m=tracing.findLowIndexInSortedArray(a.timestamps,function(a){return a},h),m=0<m-1?m-1:0,p=f/a.maxTotal,s=a.numSeries-1;0<=s;s--){b.fillStyle=e[a.seriesColors[s]];b.beginPath();for(var t=m-1,u=0<=t?a.timestamps[t]-j:-1,r=f,w=!1;;){var x=t+1;if(x>=q){b.lineTo(u,r);b.lineTo(u+8*l,r);b.lineTo(u+8*l,f);break}var v=a.timestamps[x],t=a.totals[x*k+s],y=f-p*t;if(v>c){b.lineTo(v,r);b.lineTo(v,f);break}v-u<j?t=x:(w||(b.moveTo(h,f),w=!0),b.lineTo(v,r),b.lineTo(v,y),t=x,u=v,r=y)}b.closePath();b.fill()}b.fillStyle=
+"rgba(255, 0, 0, 1)";for(x in this.selectedSamples_)if(this.selectedSamples_[x]){v=a.timestamps[x];for(s=a.numSeries-1;0<=s;s--)t=a.totals[x*k+s],y=f-p*t,b.fillRect(v-l,y-1,3*l,3)}b.restore();d.drawOverContent(b,h,c,f)},addIntersectingItemsToSelection:function(a,b,c){var f=this.getBoundingClientRect();if(b<f.top||b>=f.bottom)return!1;b=this.viewport_.xViewVectorToWorld(a*devicePixelRatio);f=this.counter_;if(a<this.counter_.timestamps[0])return!1;a=tracing.findLowIndexInSortedArray(f.timestamps,function(a){return a},
 b);if(0>a||a>=f.timestamps.length)return!1;0<a&&b>this.counter_.timestamps[a-1]&&a--;this.getBoundingClientRect();c=c.addCounterSample(this,this.counter,a);this.decorateHit(c);return!0},addIntersectingItemsInRangeToSelection:function(a,b,c,f,d){var e=this.getBoundingClientRect(),c=Math.max(c,e.top),f=Math.min(f,e.bottom);if(!(c>f)){f=this.counter_;e=window.devicePixelRatio||1;a=this.viewport_.xViewToWorld(a*e);e=this.viewport_.xViewToWorld(b*e);c=tracing.findLowIndexInSortedArray(f.timestamps,function(a){return a},
 a);b=tracing.findLowIndexInSortedArray(f.timestamps,function(a){return a},e);0<c&&a>f.timestamps[c-1]&&c--;0<b&&e>f.timestamps[b-1]&&b--;for(a=c;a<=b;a++)a>=f.timestamps.length||(e=d.addCounterSample(this,this.counter,a),this.decorateHit(e))}},addAllObjectsMatchingFilterToSelection:function(){}};return{TimelineCounterTrack:d}});"use strict";base.require("tracks.timeline_container_track");base.require("sorted_array_utils");base.require("ui");
 base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineContainerTrack);e.prototype={__proto__:tracks.TimelineContainerTrack.prototype,decorate:function(){this.classList.add("timeline-slice-group-track")},get group(){return this.group_},set group(d){this.group_=d;this.updateChildTracks_()},set heading(d){this.tracks_.length&&(this.tracks_[0].heading=d)},set tooltip(d){this.tracks_.length&&(this.tracks_[0].tooltip=d)},set decorateHit(d){this.decorateHit_=d;this.updateChildTracks_()},
 applyCategoryFilter_:function(){this.updateChildTracks_()},addSliceTrack_:function(d){var a=new tracks.TimelineSliceTrack;a.slices=d;a.decorateHit=this.decorateHit_;this.addTrack_(a);return a},updateChildTracks_:function(){if(this.group_){var d=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);if(d.length){if(this.visible=!0,!this.areArrayContentsSame_(this.filteredSlices_,d)){this.filteredSlices_=d;this.detach();this.subRows_=this.buildSubRows_(d);for(d=0;d<this.subRows_.length;d++)this.subRows_[d].length&&
-this.addSliceTrack_(this.subRows_[d])}}else this.visible=!1}else this.visible=!1},buildSubRows_:function(d){if(!d.length)return[];for(var a=[],b=0;b<d.length;b++)d[b].subSlices&&d[b].subSlices.splice(0,d[b].subSlices.length),a.push(b);a.sort(function(a,b){var c=d[a],f=d[b];return c.start!=f.start?c.start-f.start:a-b});var c=[[]];this.badSlices_=[];for(b=0;b<a.length;b++){for(var f=d[a[b]],g=!1,e=c.length-1;0<=e;e--)if(0!=c[e].length){var h=c[e][c[e].length-1];f.start<h.start&&(this.badSlices_.push(f),
+this.addSliceTrack_(this.subRows_[d])}}else this.visible=!1}else this.visible=!1},buildSubRows_:function(d){if(!d.length)return[];for(var a=[],b=0;b<d.length;b++)d[b].subSlices&&d[b].subSlices.splice(0,d[b].subSlices.length),a.push(b);a.sort(function(a,b){var c=d[a],f=d[b];return c.start!=f.start?c.start-f.start:b-a});var c=[[]];this.badSlices_=[];for(b=0;b<a.length;b++){for(var f=d[a[b]],g=!1,e=c.length-1;0<=e;e--)if(0!=c[e].length){var h=c[e][c[e].length-1];f.start<h.start&&(this.badSlices_.push(f),
 g=!0);if(f.start>=h.start&&f.end<=h.end){for(;c.length<=e+1;)c.push([]);c[e+1].push(f);h.subSlices&&h.subSlices.push(f);g=!0;break}}g||c[0].push(f)}return c},areArrayContentsSame_:function(d,a){if(!d||!a||(!d.length||!a.length)||d.length!=a.length)return!1;for(var b=0;b<d.length;++b)if(d[b]!=a[b])return!1;return!0}};return{TimelineSliceGroupTrack:e}});"use strict";base.require("tracks.timeline_slice_group_track");base.require("ui");
 base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineSliceGroupTrack);e.prototype={__proto__:tracks.TimelineSliceGroupTrack.prototype,decorate:function(){this.classList.add("timeline-async-slice-group-track")},addSliceTrack_:function(d){d=tracks.TimelineSliceGroupTrack.prototype.addSliceTrack_.call(this,d);d.asyncStyle=!0;return d},buildSubRows_:function(){var d=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);d.sort(function(a,b){return a.start-b.start});for(var a=
 [],b=0;b<d.length;b++){for(var c=d[b],f=!1,g=0;g<a.length;g++){var e=a[g];if(c.start>=e[e.length-1].end){f=!0;if(void 0===c.subSlices||1>c.subSlices.length)throw Error("TimelineAsyncEvent missing subSlices: ")+c.name;for(g=0;g<c.subSlices.length;g++)e.push(c.subSlices[g]);break}}if(!f&&(e=[],void 0!==c.subSlices)){for(g=0;g<c.subSlices.length;g++)e.push(c.subSlices[g]);a.push(e)}}return a}};return{TimelineAsyncSliceGroupTrack:e}});"use strict";base.requireStylesheet("tracks.timeline_thread_track");
@@ -120,12 +120,12 @@
 a+"px"},updateChildTracks_:function(){this.detachAllChildren();if(this.model_){var d=this.model_.getAllCpus();d.sort(tracing.TimelineCpu.compare);for(var a=0;a<d.length;++a){var b=d[a],c=new tracks.TimelineCpuTrack;c.heading="CPU "+b.cpuNumber+":";c.cpu=b;this.addTrack_(c)}d=this.model_.getAllProcesses();d.sort(tracing.TimelineProcess.compare);for(a=0;a<d.length;++a)b=d[a],c=new tracks.TimelineProcessTrack,c.process=b,this.addTrack_(c)}}};return{TimelineModelTrack:e}});"use strict";base.requireStylesheet("tracks.timeline_viewport_track");
 base.require("tracks.timeline_track");base.require("tracks.timeline_canvas_based_track");base.require("ui");
 base.exportTo("tracks",function(){var e=base.ui.define(tracks.TimelineCanvasBasedTrack),d=Math.log(10);e.prototype={__proto__:tracks.TimelineCanvasBasedTrack.prototype,decorate:function(){this.classList.add("timeline-viewport-track");this.strings_secs_=[];this.strings_msecs_=[];this.addEventListener("mousedown",this.onMouseDown)},onMouseDown:function(a){0==a.button&&this.placeAndBeginDraggingMarker(a.clientX)},placeAndBeginDraggingMarker:function(a){var a=this.viewport_.xViewToWorld(a-this.canvasContainer_.offsetLeft),
-b=this.viewport_.findMarkerNear(a,6),c=!1,f=!1;b||(b=this.viewport_.addMarker(a),c=!0);b.selected=!0;var d=this,e=function(a){a=d.viewport_.xViewToWorld(a.clientX-d.canvasContainer_.offsetLeft);b.positionWorld=a;f=true},h=function(){b.selected=false;!f&&!c&&d.viewport_.removeMarker(b);document.removeEventListener("mouseup",h);document.removeEventListener("mousemove",e)};document.addEventListener("mouseup",h);document.addEventListener("mousemove",e)},drawLine_:function(a,b,c,f,d,e){a.beginPath();a.moveTo(b,
-c);a.lineTo(f,d);a.closePath();a.strokeStyle=e;a.stroke()},drawArrow_:function(a,b,c,f,d,e,h){this.drawLine_(a,b,c,f,d,h);var j=f-b,k=d-c,p=Math.sqrt(j*j+k*k),m=(p-10)/p,b=b+m*j,c=c+m*k,k=k/p*e,e=-(j/p)*e;a.beginPath();a.fillStyle=h;a.moveTo(b+k,c+e);a.lineTo(f,d);a.lineTo(b-k,c-e);a.lineTo(b+k,c+e);a.closePath();a.fill()},redraw:function(){var a=this.ctx_,b=this.canvas_.width,c=this.canvas_.height;a.clearRect(0,0,b,c);var f=this.viewport_;f.xViewVectorToWorld(1);for(var g=f.xViewToWorld(0),e=f.xViewToWorld(b),
-h=this.classList.contains("timeline-viewport-track-with-distance-measurements"),j=h?c/2:c,k=0;k<f.markers.length;++k)f.markers[k].drawTriangle_(a,g,e,c,j,f);var k=f.xViewVectorToWorld(150),p,m,o,r;m=Math.pow(10,Math.ceil(Math.log(k)/d));o=[10,5,2,1];for(k=0;k<o.length;++k)if(!(150>f.xWorldVectorToView(m/o[k]))){p=m/o[k-1];break}r=void 0;100>p?(m="ms",o=1,r=this.strings_msecs_):(m="s",o=1E3,r=this.strings_secs_);var s=f.xWorldVectorToView(p/5),k=Math.floor(g/p)*p,c=Math.floor(0.25*c);a.fillStyle="rgb(0, 0, 0)";
-a.strokeStyle="rgb(0, 0, 0)";a.textAlign="left";a.textBaseline="top";g=window.devicePixelRatio||1;a.font=9*g+"px sans-serif";for(var t=k;t<e;t+=p){var q=Math.floor(f.xWorldToView(t)),k=Math.floor(1E5*(t/o))/1E5;r[k]||(r[k]=k+" "+m);a.fillText(r[k],q+2*g,0);a.beginPath();a.moveTo(q,0);a.lineTo(q,j);for(k=1;5>k;++k){var v=Math.floor(q+s*k);a.moveTo(v,j-c);a.lineTo(v,j)}a.stroke()}if(h){a.moveTo(0,j);a.lineTo(b,j);a.stroke();b=f.markers.slice();b.sort(function(a,b){return a.positionWorld_-b.positionWorld_});
-j+=2;e=j+4;for(k=0;k<b.length-1;k++)if(r=b[k+1],s=b[k],c=r.positionWorld-s.positionWorld,p=f.xWorldVectorToView(c),h=f.xWorldToView(s.positionWorld+c/2),100>c?(m="ms",o=1):(m="s",o=1E3),o=c/o,m=Math.abs(Math.floor(1E3*o)/1E3)+" "+m,o=a.measureText(m).width,g=f.xViewVectorToWorld(o),o=o+26+10,t=s.positionWorld+c/2-g/2,q=t+g,c=j,g=f.xWorldToView(t),t=f.xWorldToView(q),s=f.xWorldToView(s.positionWorld),r=f.xWorldToView(r.positionWorld),q=!1,o<=p&&(a.fillStyle="rgb(0,0,0)",a.fillText(m,g,c),q=!0),26<=
-p)q?(m=g-10,o=t+10):o=m=h,this.drawArrow_(a,m,e,s,e,3,"rgb(128,121,121)"),this.drawArrow_(a,o,e,r,e,3,"rgb(128,121,121)")}},addIntersectingItemsToSelection:function(){},addIntersectingItemsInRangeToSelection:function(){},addAllObjectsMatchingFilterToSelection:function(){}};return{TimelineViewportTrack:e}});"use strict";base.requireStylesheet("timeline");base.require("event_target");base.require("measuring_stick");base.require("timeline_filter");base.require("timeline_selection");base.require("timeline_viewport");
+b=this.viewport_.findMarkerNear(a,6),c=!1,f=!1;b||(b=this.viewport_.addMarker(a),c=!0);b.selected=!0;var d=this,e=function(a){a=d.viewport_.xViewToWorld(a.clientX-d.canvasContainer_.offsetLeft);b.positionWorld=a;f=!0},h=function(){b.selected=!1;!f&&!c&&d.viewport_.removeMarker(b);document.removeEventListener("mouseup",h);document.removeEventListener("mousemove",e)};document.addEventListener("mouseup",h);document.addEventListener("mousemove",e)},drawLine_:function(a,b,c,f,d,e){a.beginPath();a.moveTo(b,
+c);a.lineTo(f,d);a.closePath();a.strokeStyle=e;a.stroke()},drawArrow_:function(a,b,c,f,d,e,h){this.drawLine_(a,b,c,f,d,h);var j=f-b,k=d-c,q=Math.sqrt(j*j+k*k),m=(q-10)/q,b=b+m*j,c=c+m*k,k=k/q*e,e=-(j/q)*e;a.beginPath();a.fillStyle=h;a.moveTo(b+k,c+e);a.lineTo(f,d);a.lineTo(b-k,c-e);a.lineTo(b+k,c+e);a.closePath();a.fill()},redraw:function(){var a=this.ctx_,b=this.canvas_.width,c=this.canvas_.height;a.clearRect(0,0,b,c);var f=this.viewport_;f.xViewVectorToWorld(1);for(var g=f.xViewToWorld(0),e=f.xViewToWorld(b),
+h=this.classList.contains("timeline-viewport-track-with-distance-measurements"),j=h?c/2:c,k=0;k<f.markers.length;++k)f.markers[k].drawTriangle_(a,g,e,c,j,f);var k=f.xViewVectorToWorld(150),q,m,p,s;m=Math.pow(10,Math.ceil(Math.log(k)/d));p=[10,5,2,1];for(k=0;k<p.length;++k)if(!(150>f.xWorldVectorToView(m/p[k]))){q=m/p[k-1];break}s=void 0;100>q?(m="ms",p=1,s=this.strings_msecs_):(m="s",p=1E3,s=this.strings_secs_);var t=f.xWorldVectorToView(q/5),k=Math.floor(g/q)*q,c=Math.floor(0.25*c);a.fillStyle="rgb(0, 0, 0)";
+a.strokeStyle="rgb(0, 0, 0)";a.textAlign="left";a.textBaseline="top";g=window.devicePixelRatio||1;a.font=9*g+"px sans-serif";for(var u=k;u<e;u+=q){var r=Math.floor(f.xWorldToView(u)),k=Math.floor(1E5*(u/p))/1E5;s[k]||(s[k]=k+" "+m);a.fillText(s[k],r+2*g,0);a.beginPath();a.moveTo(r,0);a.lineTo(r,j);for(k=1;5>k;++k){var w=Math.floor(r+t*k);a.moveTo(w,j-c);a.lineTo(w,j)}a.stroke()}if(h){a.moveTo(0,j);a.lineTo(b,j);a.stroke();b=f.markers.slice();b.sort(function(a,b){return a.positionWorld_-b.positionWorld_});
+j+=2;e=j+4;for(k=0;k<b.length-1;k++)s=b[k+1],t=b[k],c=s.positionWorld-t.positionWorld,q=f.xWorldVectorToView(c),h=f.xWorldToView(t.positionWorld+c/2),100>c?(m="ms",p=1):(m="s",p=1E3),p=c/p,m=Math.abs(Math.floor(1E3*p)/1E3)+" "+m,p=a.measureText(m).width,g=f.xViewVectorToWorld(p),p=p+26+10,u=t.positionWorld+c/2-g/2,r=u+g,c=j,g=f.xWorldToView(u),u=f.xWorldToView(r),t=f.xWorldToView(t.positionWorld),s=f.xWorldToView(s.positionWorld),r=!1,p<=q&&(a.fillStyle="rgb(0,0,0)",a.fillText(m,g,c),r=!0),26<=q&&
+(r?(m=g-10,p=u+10):p=m=h,this.drawArrow_(a,m,e,t,e,3,"rgb(128,121,121)"),this.drawArrow_(a,p,e,s,e,3,"rgb(128,121,121)"))}},addIntersectingItemsToSelection:function(){},addIntersectingItemsInRangeToSelection:function(){},addAllObjectsMatchingFilterToSelection:function(){}};return{TimelineViewportTrack:e}});"use strict";base.requireStylesheet("timeline");base.require("event_target");base.require("measuring_stick");base.require("timeline_filter");base.require("timeline_selection");base.require("timeline_viewport");
 base.require("tracks.timeline_model_track");base.require("tracks.timeline_viewport_track");base.require("ui");
 base.exportTo("tracing",function(){var e=tracing.TimelineSelection,d=tracing.TimelineViewport,a=base.ui.define("div");a.prototype={__proto__:HTMLDivElement.prototype,model_:null,decorate:function(){this.classList.add("timeline");this.categoryFilter_=new tracing.TimelineCategoryFilter;this.viewport_=new d(this);this.viewportTrack_=new tracks.TimelineViewportTrack;this.viewportTrack_.viewport=this.viewport_;this.appendChild(this.viewportTrack_);this.modelTrackContainer_=document.createElement("div");
 this.modelTrackContainer_.className="timeline-model-track-container";this.appendChild(this.modelTrackContainer_);this.modelTrack_=new tracks.TimelineModelTrack;this.modelTrackContainer_.appendChild(this.modelTrack_);this.dragBox_=this.ownerDocument.createElement("div");this.dragBox_.className="timeline-drag-box";this.appendChild(this.dragBox_);this.hideDragBox_();this.bindEventListener_(document,"keypress",this.onKeypress_,this);this.bindEventListener_(document,"keydown",this.onKeydown_,this);this.bindEventListener_(document,
@@ -141,7 +141,7 @@
 a=this.focusElement.tabIndex?a+" <-            : Select previous event on current timeline\n ->            : Select next event on current timeline\n":a+"General Navigation\n g/General     : Shows grid at the start/end of the selected task\n <-,^TAB       : Select previous event on current timeline\n ->, TAB       : Select next event on current timeline\n";return a+"\nAlt + Scroll to zoom in/out\nDbl-click to zoom in; Shift dbl-click to zoom out\nf to zoom into selection\nz to reset zoom and pan to initial view\n"},
 get selection(){return this.selection_},set selection(a){if(!(a instanceof e))throw Error("Expected TimelineSelection");var c;for(c=0;c<this.selection_.length;c++)this.selection_[c].selected=!1;this.selection_=a;base.dispatchSimpleEvent(this,"selectionChange");for(c=0;c<this.selection_.length;c++)this.selection_[c].selected=!0;this.viewport_.dispatchChangeEvent()},setSelectionAndMakeVisible:function(a,c){if(!(a instanceof e))throw Error("Expected TimelineSelection");this.selection=a;var f=this.selection.range,
 d=this.viewport_.xWorldVectorToView(f.max-f.min);c&&50>d?(d=f.min+0.5*(f.max-f.min),f=5*(f.max-f.min),this.viewport_.xSetWorldRange(d-0.5*f,d+0.5*f,this.firstCanvas.width)):this.viewport_.xPanWorldRangeIntoView(f.min,f.max,this.firstCanvas.width)},get firstCanvas(){if(this.viewportTrack_)return this.viewportTrack_.firstCanvas;if(this.modelTrack_)return this.modelTrack_.firstCanvas},hideDragBox_:function(){this.dragBox_.style.left="-1000px";this.dragBox_.style.top="-1000px";this.dragBox_.style.width=
-0;this.dragBox_.style.height=0},setDragBoxPosition_:function(a,c,f,d,e){var h=Math.min(a,f),a=Math.max(a,f),f=this.modelTrack_.getBoundingClientRect();e?(e=f.top,f=f.bottom):(e=Math.min(c,d),f=Math.max(c,d));var c=e,d=h+(a-h),e=c+(f-e),j=this.modelTrackContainer_.getBoundingClientRect(),f=j.left,k=j.top,p=j.right,j=j.bottom,m=parseInt(this.modelTrack_.headingWidth),f=f+m;m={};h>p||d<f||c>j||e<k?c=!1:(m.left=Math.max(f,h),m.top=Math.max(k,c),m.right=Math.min(p,d),m.bottom=Math.min(j,e),m.width=m.right-
+0;this.dragBox_.style.height=0},setDragBoxPosition_:function(a,c,f,d,e){var h=Math.min(a,f),a=Math.max(a,f),f=this.modelTrack_.getBoundingClientRect();e?(e=f.top,f=f.bottom):(e=Math.min(c,d),f=Math.max(c,d));var c=e,d=h+(a-h),e=c+(f-e),j=this.modelTrackContainer_.getBoundingClientRect(),f=j.left,k=j.top,q=j.right,j=j.bottom,m=parseInt(this.modelTrack_.headingWidth),f=f+m;m={};h>q||d<f||c>j||e<k?c=!1:(m.left=Math.max(f,h),m.top=Math.max(k,c),m.right=Math.min(q,d),m.bottom=Math.min(j,e),m.width=m.right-
 m.left,m.height=m.bottom-m.top,c=m);this.dragBox_.style.left=c.left+"px";this.dragBox_.style.width=c.width+"px";this.dragBox_.style.top=c.top+"px";this.dragBox_.style.height=c.height+"px";c=this.firstCanvas;h=this.viewport_.xViewToWorld(h-c.offsetLeft);a=this.viewport_.xViewToWorld(a-c.offsetLeft);c=Math.round(100*(a-h))/100;this.dragBox_.textContent=c+"ms";c=new base.Event("selectionChanging");c.loWX=h;c.hiWX=a;this.dispatchEvent(c)},onGridToggle_:function(a){var a=a?this.selection_.range.min:this.selection_.range.max,
 c=Math.ceil((a-this.model_.minTimestamp)/this.viewport_.gridStep_);this.viewport_.gridTimebase=a-(c+1)*this.viewport_.gridStep_;this.viewport_.gridEnabled=!0},isChildOfThis_:function(a){if(a!=this){for(;a.parentNode;){if(a==this)return!0;a=a.parentNode}return!1}},onMouseDown_:function(a){if(0===a.button)if(a.shiftKey)this.viewportTrack_.placeAndBeginDraggingMarker(a.clientX);else{var c=this.firstCanvas,f=this.modelTrack_.getBoundingClientRect(),d=this.firstCanvas.getBoundingClientRect();f&&(a.clientX>=
 f.left&&a.clientX<f.right&&a.clientY>=f.top&&a.clientY<f.bottom&&a.clientX>=d.left&&a.clientX<d.right)&&(this.viewport_.xViewToWorld(a.clientX-c.offsetLeft),this.dragBeginEvent_=a,a.preventDefault(),document.activeElement&&document.activeElement.blur(),0<=this.focusElement.tabIndex&&this.focusElement.focus())}},onMouseMove_:function(a){if(this.firstCanvas){var c=this.firstCanvas;this.lastMouseViewPos_={x:a.clientX-c.offsetLeft,y:a.clientY-c.offsetTop};this.dragBeginEvent_&&(this.dragBoxXStart_=this.dragBeginEvent_.clientX,
@@ -149,10 +149,10 @@
 f=c.top,c=c.bottom):(f=Math.min(c.clientY,a.clientY),c=Math.max(c.clientY,a.clientY));var h=this.firstCanvas,d=d-h.offsetLeft,l=l-h.offsetLeft,h=new e;this.modelTrack_.addIntersectingItemsInRangeToSelection(d,l,f,c,h);this.selection=h;((f=0==navigator.platform.indexOf("Mac"))&&a.metaKey||!f&&a.ctrlKey)&&this.zoomToSelection_()}},onDblClick_:function(a){var c=4;a.shiftKey&&(c=1/c);this.zoomBy_(c);a.preventDefault()}};base.defineProperty(a,"model",base.PropertyKind.JS);return{Timeline:a}});"use strict";
 base.require("ui");base.requireStylesheet("timeline_analysis");
 base.exportTo("tracing",function(){function e(a,c){var f=c.getSliceHits(),d=c.getCounterSampleHits();if(1==f.length){var e=f[0].slice,h=a.appendTable("timeline-analysis-slice-table",2);a.appendTableHeader(h,"Selected slice:");a.appendSummaryRow(h,"Title",e.title);e.category&&a.appendSummaryRow(h,"Category",e.category);a.appendSummaryRowTime(h,"Start",e.start);a.appendSummaryRowTime(h,"Duration",e.duration);e.durationInUserTime&&a.appendSummaryRowTime(h,"Duration (U)",e.durationInUserTime);var f=0,
-j;for(j in e.args)f+=1;if(0<f)for(j in a.appendSummaryRow(h,"Args"),e.args)a.appendSummaryRow(h," "+j,e.args[j])}else if(1<f.length){var k=f.range.min,p=f.range.max;f.map(function(a){return a.slice.title});var h=0,m={};for(j=0;j<f.length;j++)e=f[j].slice,m[e.title]||(m[e.title]={slices:[]},h++),m[e.title].slices.push(e);h=a.appendTable("timeline-analysis-slices-table",3);a.appendTableHeader(h,"Slices:");var e=0,o;for(o in m){var r=m[o],s=0;j=0;var t=Number.MAX_VALUE,q=-Number.MAX_VALUE,v=Number.MAX_VALUE,
-w=-Number.MAX_VALUE;for(j=0;j<r.slices.length;j++)s+=r.slices[j].duration,t=Math.min(r.slices[j].start,t),q=Math.max(r.slices[j].start,q),v=Math.min(r.slices[j].duration,v),w=Math.max(r.slices[j].duration,w);e+=s;0==r.slices.length&&(j=0);j=s/r.slices.length;v={min:v,max:w,avg:j,frequency:void 0,frequency_stddev:void 0};j=q-t;if(2<r.slices.length&&0<j){t=r.slices.length-1;v.frequency=1E3*t/j;q=0;for(j=1;j<r.slices.length;j++)w=v.frequency-1E3/(r.slices[j].start-r.slices[j-1].start),q+=w*w;v.frequency_stddev=
-Math.sqrt(q/(t-1))}a.appendDataRow(h,o,s,r.slices.length,v)}a.appendDataRow(h,"*Totals",e,f.length);a.appendSpacingRow(h);a.appendSummaryRowTime(h,"Selection start",k);a.appendSummaryRowTime(h,"Selection extent",p-k)}if(1==d.length){var h=d[0],f=h.counter,u=h.sampleIndex,d=[];for(j=0;j<f.numSeries;++j)d.push(f.samples[f.numSeries*u+j]);h=a.appendTable("timeline-analysis-counter-table",2);a.appendTableHeader(h,"Selected counter:");a.appendSummaryRow(h,"Title",f.name);a.appendSummaryRowTime(h,"Timestamp",
-f.timestamps[u]);for(j=0;j<f.numSeries;j++)a.appendSummaryRow(h,f.seriesNames[j],d[j])}else if(1<d.length){o={};for(j=0;j<d.length;j++)f=d[j].counter,o[f.guid]||(o[f.guid]=[]),o[f.guid].push(d[j]);h=a.appendTable("timeline-analysis-counter-table",7);a.appendTableHeader(h,"Counters:");for(u in o){d=o[u];f=d[0].counter;k=[];for(j=0;j<d.length;j++)k.push(d[j].sampleIndex);d=f.getSampleStatistics(k);for(j=0;j<d.length;j++)a.appendDataRow(h,f.name+": "+f.seriesNames[j],void 0,void 0,d[j])}}}var d=base.ui.define("div");
+j;for(j in e.args)f+=1;if(0<f)for(j in a.appendSummaryRow(h,"Args"),e.args)a.appendSummaryRow(h," "+j,e.args[j])}else if(1<f.length){var k=f.range.min,q=f.range.max;f.map(function(a){return a.slice.title});var h=0,m={};for(j=0;j<f.length;j++)e=f[j].slice,m[e.title]||(m[e.title]={slices:[]},h++),m[e.title].slices.push(e);h=a.appendTable("timeline-analysis-slices-table",3);a.appendTableHeader(h,"Slices:");var e=0,p;for(p in m){var s=m[p],t=0;j=0;var u=Number.MAX_VALUE,r=-Number.MAX_VALUE,w=Number.MAX_VALUE,
+x=-Number.MAX_VALUE;for(j=0;j<s.slices.length;j++)t+=s.slices[j].duration,u=Math.min(s.slices[j].start,u),r=Math.max(s.slices[j].start,r),w=Math.min(s.slices[j].duration,w),x=Math.max(s.slices[j].duration,x);e+=t;0==s.slices.length&&(j=0);j=t/s.slices.length;w={min:w,max:x,avg:j,frequency:void 0,frequency_stddev:void 0};j=r-u;if(2<s.slices.length&&0<j){u=s.slices.length-1;w.frequency=1E3*u/j;r=0;for(j=1;j<s.slices.length;j++)x=w.frequency-1E3/(s.slices[j].start-s.slices[j-1].start),r+=x*x;w.frequency_stddev=
+Math.sqrt(r/(u-1))}a.appendDataRow(h,p,t,s.slices.length,w)}a.appendDataRow(h,"*Totals",e,f.length);a.appendSpacingRow(h);a.appendSummaryRowTime(h,"Selection start",k);a.appendSummaryRowTime(h,"Selection extent",q-k)}if(1==d.length){var h=d[0],f=h.counter,v=h.sampleIndex,d=[];for(j=0;j<f.numSeries;++j)d.push(f.samples[f.numSeries*v+j]);h=a.appendTable("timeline-analysis-counter-table",2);a.appendTableHeader(h,"Selected counter:");a.appendSummaryRow(h,"Title",f.name);a.appendSummaryRowTime(h,"Timestamp",
+f.timestamps[v]);for(j=0;j<f.numSeries;j++)a.appendSummaryRow(h,f.seriesNames[j],d[j])}else if(1<d.length){p={};for(j=0;j<d.length;j++)f=d[j].counter,p[f.guid]||(p[f.guid]=[]),p[f.guid].push(d[j]);h=a.appendTable("timeline-analysis-counter-table",7);a.appendTableHeader(h,"Counters:");for(v in p){d=p[v];f=d[0].counter;k=[];for(j=0;j<d.length;j++)k.push(d[j].sampleIndex);d=f.getSampleStatistics(k);for(j=0;j<d.length;j++)a.appendDataRow(h,f.name+": "+f.seriesNames[j],void 0,void 0,d[j])}}}var d=base.ui.define("div");
 d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){},tsRound_:function(a){return Math.round(1E3*a)/1E3},appendElement_:function(a,c,f){c=a.ownerDocument.createElement(c);a.appendChild(c);void 0!=f&&(c.textContent=f);return c},appendText_:function(a,c){a.ownerDocument.createTextNode(c);a.appendChild(textNode);return textNode},appendTableCell_:function(a,c,f,d){c=this.appendElement_(c,"td",d);c.className=a.className+"-col-"+f;return c},appendTableCellWithTooltip_:function(a,c,f,d,e){if(e)return c=
 this.appendElement_(c,"td"),c.className=a.className+"-col-"+f,a=this.appendElement_(c,"span",d),a.className="tooltip",a.title=e,c;this.appendTableCell_(a,c,f,d)},appendTable:function(a,c){var f=this.appendElement_(this,"table");f.className=a+" timeline-analysis-table";f.numColumns=c;return f},appendTableHeader:function(a,c){var f=this.appendElement_(a,"tr");this.appendElement_(f,"th",c).className="timeline-analysis-table-header"},appendSummaryRow:function(a,c,f){var d=this.appendElement_(a,"tr");
 d.className="timeline-analysis-table-row";this.appendTableCell_(a,d,0,c);if(void 0!==f){this.appendTableCell_(a,d,1,f);for(c=2;c<a.numColumns;c++)this.appendTableCell_(a,d,c,"")}else for(c=1;c<a.numColumns;c++)this.appendTableCell_(a,d,1,"")},appendSpacingRow:function(a){var c=this.appendElement_(a,"tr");c.className="timeline-analysis-table-row";for(var f=0;f<a.numColumns;f++)this.appendTableCell_(a,c,f," ")},appendSummaryRowTime:function(a,c,f){this.appendSummaryRow(a,c,this.tsRound_(f)+" ms")},
@@ -185,7 +185,7 @@
 c.endSlice(b.ts/1E3)):"C"==b.ph?this.processCounterEvent(b):"M"==b.ph?"thread_name"==b.name?(c=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),c.name=b.args.name):this.model_.importErrors.push("Unrecognized metadata name: "+b.name):this.model_.importErrors.push("Unrecognized event phase: "+b.ph+"("+b.name+")")}},finalizeImport:function(){this.createAsyncSlices_()},createAsyncSlices_:function(){if(0!=this.allAsyncEvents_.length){this.allAsyncEvents_.sort(function(a,b){return a.event.ts-
 b.event.ts});for(var d={},a=this.allAsyncEvents_,b=0;b<a.length;b++){var c=a[b],f=c.event,e=f.name;if(void 0===e)this.model_.importErrors.push("Async events (ph: S, T or F) require an name parameter.");else{var l=f.id;if(void 0===l)this.model_.importErrors.push("Async events (ph: S, T or F) require an id parameter.");else if("S"==f.ph)void 0===d[e]&&(d[e]={}),d[e][l]?this.model_.importErrors.push("At "+f.ts+", a slice of the same id "+l+" was alrady open."):(d[e][l]=[],d[e][l].push(c));else if(void 0===
 d[e])this.model_.importErrors.push("At "+f.ts+", no slice named "+e+" was open.");else if(void 0===d[e][l])this.model_.importErrors.push("At "+f.ts+", no slice named "+e+" with id="+l+" was open.");else{var h=d[e][l];h.push(c);if("F"==f.ph){var j=new tracing.TimelineAsyncSlice(h[0].event.cat,e,tracing.getStringColorId(e),h[0].event.ts/1E3);j.duration=f.ts/1E3-h[0].event.ts/1E3;j.startThread=h[0].thread;j.endThread=c.thread;j.id=l;j.args=h[0].event.args;j.subSlices=[];for(c=1;c<h.length;++c){var k=
-e;"T"==h[c-1].event.ph&&(k=e+":"+h[c-1].event.args.step);k=new tracing.TimelineAsyncSlice(h[0].event.cat,k,tracing.getStringColorId(e+c),h[c-1].event.ts/1E3);k.duration=h[c].event.ts/1E3-h[c-1].event.ts/1E3;k.startThread=h[c-1].thread;k.endThread=h[c].thread;k.id=l;k.args=h[c-1].event.args;j.subSlices.push(k)}var h=j.subSlices[j.subSlices.length-1],p;for(p in f.args)h.args[p]=f.args[p];j.startThread.asyncSlices.push(j);delete d[e][l]}}}}}}};tracing.TimelineModel.registerImporter(e);return{TraceEventImporter:e}});
+e;"T"==h[c-1].event.ph&&(k=e+":"+h[c-1].event.args.step);k=new tracing.TimelineAsyncSlice(h[0].event.cat,k,tracing.getStringColorId(e+c),h[c-1].event.ts/1E3);k.duration=h[c].event.ts/1E3-h[c-1].event.ts/1E3;k.startThread=h[c-1].thread;k.endThread=h[c].thread;k.id=l;k.args=h[c-1].event.args;j.subSlices.push(k)}var h=j.subSlices[j.subSlices.length-1],q;for(q in f.args)h.args[q]=f.args[q];j.startThread.asyncSlices.push(j);delete d[e][l]}}}}}}};tracing.TimelineModel.registerImporter(e);return{TraceEventImporter:e}});
 base.exportTo("tracing",function(){function e(a){this.importer=a}var d=[];e.registerSubtype=function(a){d.push(a)};e.getSubtypeConstructors=function(){return d};e.prototype={__proto__:Object.prototype};return{LinuxPerfParser:e}});base.require("linux_perf_parser");
 base.exportTo("tracing",function(){function e(a){d.call(this,a);a.registerEventHandler("cpufreq_interactive_up",e.prototype.cpufreqUpDownEvent.bind(this));a.registerEventHandler("cpufreq_interactive_down",e.prototype.cpufreqUpDownEvent.bind(this));a.registerEventHandler("cpufreq_interactive_already",e.prototype.cpufreqTargetEvent.bind(this));a.registerEventHandler("cpufreq_interactive_notyet",e.prototype.cpufreqTargetEvent.bind(this));a.registerEventHandler("cpufreq_interactive_target",e.prototype.cpufreqTargetEvent.bind(this));
 a.registerEventHandler("cpufreq_interactive_boost",e.prototype.cpufreqBoostUnboostEvent.bind(this));a.registerEventHandler("cpufreq_interactive_unboost",e.prototype.cpufreqBoostUnboostEvent.bind(this))}var d=tracing.LinuxPerfParser;e.prototype={__proto__:d.prototype,cpufreqSlice:function(a,b,c,f){c=this.importer.getOrCreatePseudoThread("cpufreq");c.openSlice=b;a=new tracing.TimelineSlice("",c.openSlice,tracing.getStringColorId(c.openSlice),a,f,0);c.thread.pushSlice(a)},cpufreqBoostSlice:function(a,
@@ -230,19 +230,19 @@
 d.args[h]=event.args[h];break;case "C":a=parseInt(b[1]);h=b[2];c=parseInt(b[3]);l=this.model_.getOrCreateProcess(a).getOrCreateCounter(null,h);0==l.numSeries&&(l.seriesNames.push("value"),l.seriesColors.push(tracing.getStringColorId(l.name+".value")));l.timestamps.push(d);l.samples.push(c);break;default:return!1}return!0}};d.registerSubtype(e);return{LinuxPerfAndroidParser:e}});base.require("timeline_model");base.require("timeline_color_scheme");base.require("linux_perf_cpufreq_parser");base.require("linux_perf_drm_parser");
 base.require("linux_perf_exynos_parser");base.require("linux_perf_gesture_parser");base.require("linux_perf_i915_parser");base.require("linux_perf_mali_parser");base.require("linux_perf_power_parser");base.require("linux_perf_sched_parser");base.require("linux_perf_workqueue_parser");base.require("linux_perf_android_parser");
 base.exportTo("tracing",function(){function e(a){this.cpu=a}function d(a,b){this.importPriority=2;this.model_=a;this.events_=b;this.clockSyncRecords_=[];this.cpuStates_={};this.kernelThreadStates_={};this.buildMapFromLinuxPidsToTimelineThreads();this.lineNumber=-1;this.pseudoThreadCounter=1;this.parsers_=[];this.eventHandlers_={}}function a(a){return b.test(a)?b:c.test(a)?c:null}e.prototype={__proto__:Object.prototype,switchRunningLinuxPid:function(a,b,c,d,e,k){if(void 0!==this.lastActivePid&&0!=
-this.lastActivePid){var p=c-this.lastActiveTs;name=(a=a.threadsByLinuxPid[this.lastActivePid])?a.userFriendlyName:this.lastActiveComm;b=new tracing.TimelineSlice("",name,tracing.getStringColorId(name),this.lastActiveTs,{comm:this.lastActiveComm,tid:this.lastActivePid,prio:this.lastActivePrio,stateWhenDescheduled:b},p);this.cpu.slices.push(b)}this.lastActiveTs=c;this.lastActivePid=d;this.lastActiveComm=e;this.lastActivePrio=k}};TestExports={};var b=/^\s*(.+?)\s+\[(\d+)\]\s+[dX.][N.][Hhs.][0-9a-f.]\s+(\d+\.\d+):\s+(\S+):\s(.*)$/;
+this.lastActivePid){var q=c-this.lastActiveTs;name=(a=a.threadsByLinuxPid[this.lastActivePid])?a.userFriendlyName:this.lastActiveComm;b=new tracing.TimelineSlice("",name,tracing.getStringColorId(name),this.lastActiveTs,{comm:this.lastActiveComm,tid:this.lastActivePid,prio:this.lastActivePrio,stateWhenDescheduled:b},q);this.cpu.slices.push(b)}this.lastActiveTs=c;this.lastActivePid=d;this.lastActiveComm=e;this.lastActivePrio=k}};TestExports={};var b=/^\s*(.+?)\s+\[(\d+)\]\s+[dX.][N.][Hhs.][0-9a-f.]\s+(\d+\.\d+):\s+(\S+):\s(.*)$/;
 TestExports.lineREWithIRQInfo=b;var c=/^\s*(.+?)\s+\[(\d+)\]\s*(\d+\.\d+):\s+(\S+):\s(.*)$/;TestExports.lineRE=c;TestExports.traceEventClockSyncRE=/trace_event_clock_sync: parent_ts=(\d+\.?\d*)/;TestExports.autoDetectLineRE=a;d.canImport=function(b){if(!("string"===typeof b||b instanceof String))return!1;if(/^# tracer:/.test(b))return!0;var c=/^(.+)\n/.exec(b);c&&(b=c[1]);return a(b)?!0:!1};d.prototype={__proto__:Object.prototype,buildMapFromLinuxPidsToTimelineThreads:function(){this.threadsByLinuxPid=
 {};this.model_.getAllThreads().forEach(function(a){this.threadsByLinuxPid[a.tid]=a}.bind(this))},getOrCreateCpuState:function(a){if(!this.cpuStates_[a]){var b=this.model_.getOrCreateCpu(a);this.cpuStates_[a]=new e(b)}return this.cpuStates_[a]},getOrCreateKernelThread:function(a,b,c){this.kernelThreadStates_[a]||(void 0==b&&(b=/.+-(\d+)/.exec(a)[1],b=parseInt(b,10)),void 0==c&&(c=b),c=this.model_.getOrCreateProcess(b).getOrCreateThread(c),c.name=a,this.kernelThreadStates_[a]={pid:b,thread:c,openSlice:void 0,
 openSliceTS:void 0},this.threadsByLinuxPid[b]=c);return this.kernelThreadStates_[a]},getOrCreatePseudoThread:function(a){var b=this.kernelThreadStates_[a];b||(b=this.getOrCreateKernelThread(a,0,this.pseudoThreadCounter),this.pseudoThreadCounter++);return b},importEvents:function(a){this.createParsers();this.importCpuData();this.alignClocks(a)&&(this.buildMapFromLinuxPidsToTimelineThreads(),this.buildPerThreadCpuSlicesFromCpuState())},finalizeImport:function(){},buildPerThreadCpuSlicesFromCpuState:function(){for(var a in this.cpuStates_)for(var b=
-this.cpuStates_[a].cpu,c=0;c<b.slices.length;c++){var d=b.slices[c],e=this.threadsByLinuxPid[d.args.tid];e&&(e.tempCpuSlices||(e.tempCpuSlices=[]),e.tempCpuSlices.push(d))}var k=tracing.getColorIdByName("running"),p=tracing.getColorIdByName("runnable"),m=tracing.getColorIdByName("sleeping"),o=tracing.getColorIdByName("iowait");this.model_.getAllThreads().forEach(function(a){if(a.tempCpuSlices){var b=a.tempCpuSlices;delete a.tempCpuSlices;b.sort(function(a,b){return a.start-b.start});var c=[];if(b.length){var d=
-b[0];c.push(new tracing.TimelineSlice("","Running",k,d.start,{},d.duration))}for(d=1;d<b.length;d++){var e=b[d-1],f=b[d],g=f.start-e.end;if("S"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Sleeping",m,e.end,{},g));else if("R"==e.args.stateWhenDescheduled||"R+"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Runnable",p,e.end,{},g));else if("D"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Uninterruptible Sleep",o,e.end,{},g));else if("T"==
-e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","__TASK_STOPPED",o,e.end,{},g));else if("t"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","debug",o,e.end,{},g));else if("Z"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Zombie",o,e.end,{},g));else if("X"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Exit Dead",o,e.end,{},g));else if("x"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Task Dead",o,e.end,{},
-g));else if("W"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","WakeKill",o,e.end,{},g));else if("D|W"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Uninterruptable Sleep | WakeKill",o,e.end,{},g));else throw Error("Unrecognized state: ")+e.args.stateWhenDescheduled;c.push(new tracing.TimelineSlice("","Running",k,f.start,{},f.duration))}a.cpuSlices=c}})},alignClocks:function(a){if(0==this.clockSyncRecords_.length){if(!a)return!0;this.abortImport();return!1}a=
-this.clockSyncRecords_[0];if(0==a.parentTS||a.parentTS==a.perfTS)return!0;var a=a.parentTS-a.perfTS,b;for(b in this.cpuStates_){for(var c=this.cpuStates_[b].cpu,d=0;d<c.slices.length;d++){var e=c.slices[d];e.start+=a;e.duration=e.duration}for(var k in c.counters){d=c.counters[k];for(e=0;e<d.timestamps.length;e++)d.timestamps[e]+=a}}for(var p in this.kernelThreadStates_)this.kernelThreadStates_[p].thread.shiftTimestampsForward(a);return!0},abortImport:function(){if(this.pushedEventsToThreads)throw Error("Cannot abort, have alrady pushedCpuDataToThreads.");
+this.cpuStates_[a].cpu,c=0;c<b.slices.length;c++){var d=b.slices[c],e=this.threadsByLinuxPid[d.args.tid];e&&(e.tempCpuSlices||(e.tempCpuSlices=[]),e.tempCpuSlices.push(d))}var k=tracing.getColorIdByName("running"),q=tracing.getColorIdByName("runnable"),m=tracing.getColorIdByName("sleeping"),p=tracing.getColorIdByName("iowait");this.model_.getAllThreads().forEach(function(a){if(a.tempCpuSlices){var b=a.tempCpuSlices;delete a.tempCpuSlices;b.sort(function(a,b){return a.start-b.start});var c=[];if(b.length){var d=
+b[0];c.push(new tracing.TimelineSlice("","Running",k,d.start,{},d.duration))}for(d=1;d<b.length;d++){var e=b[d-1],f=b[d],g=f.start-e.end;if("S"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Sleeping",m,e.end,{},g));else if("R"==e.args.stateWhenDescheduled||"R+"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Runnable",q,e.end,{},g));else if("D"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Uninterruptible Sleep",p,e.end,{},g));else if("T"==
+e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","__TASK_STOPPED",p,e.end,{},g));else if("t"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","debug",p,e.end,{},g));else if("Z"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Zombie",p,e.end,{},g));else if("X"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Exit Dead",p,e.end,{},g));else if("x"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Task Dead",p,e.end,{},
+g));else if("W"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","WakeKill",p,e.end,{},g));else if("D|W"==e.args.stateWhenDescheduled)c.push(new tracing.TimelineSlice("","Uninterruptable Sleep | WakeKill",p,e.end,{},g));else throw Error("Unrecognized state: ")+e.args.stateWhenDescheduled;c.push(new tracing.TimelineSlice("","Running",k,f.start,{},f.duration))}a.cpuSlices=c}})},alignClocks:function(a){if(0==this.clockSyncRecords_.length){if(!a)return!0;this.abortImport();return!1}a=
+this.clockSyncRecords_[0];if(0==a.parentTS||a.parentTS==a.perfTS)return!0;var a=a.parentTS-a.perfTS,b;for(b in this.cpuStates_){for(var c=this.cpuStates_[b].cpu,d=0;d<c.slices.length;d++){var e=c.slices[d];e.start+=a;e.duration=e.duration}for(var k in c.counters){d=c.counters[k];for(e=0;e<d.timestamps.length;e++)d.timestamps[e]+=a}}for(var q in this.kernelThreadStates_)this.kernelThreadStates_[q].thread.shiftTimestampsForward(a);return!0},abortImport:function(){if(this.pushedEventsToThreads)throw Error("Cannot abort, have alrady pushedCpuDataToThreads.");
 for(var a in this.cpuStates_)delete this.model_.cpus[a];for(var b in this.kernelThreadStates_){a=this.kernelThreadStates_[b].thread;var c=a.parent;delete c.threads[a.tid];delete this.model_.processes[c.pid]}this.model_.importErrors.push("Cannot import kernel trace without a clock sync.")},createParsers:function(){for(var a=tracing.LinuxPerfParser.getSubtypeConstructors(),b=0;b<a.length;++b)this.parsers_.push(new a[b](this));this.registerEventHandler("tracing_mark_write:trace_event_clock_sync",d.prototype.traceClockSyncEvent.bind(this));
 this.registerEventHandler("tracing_mark_write",d.prototype.traceMarkingWriteEvent.bind(this));this.registerEventHandler("0:trace_event_clock_sync",d.prototype.traceClockSyncEvent.bind(this));this.registerEventHandler("0",d.prototype.traceMarkingWriteEvent.bind(this))},registerEventHandler:function(a,b){this.eventHandlers_[a]=b},markPidRunnable:function(){},importError:function(a){this.model_.importErrors.push("Line "+(this.lineNumber+1)+": "+a)},traceClockSyncEvent:function(a,b,c,d,e){a=/parent_ts=(\d+\.?\d*)/.exec(e[2]);
-if(!a)return!1;this.clockSyncRecords_.push({perfTS:d,parentTS:1E3*a[1]});return!0},traceMarkingWriteEvent:function(a,b,c,d,e,k){var p=/^\s*(\w+):\s*(.*)$/.exec(e[5]);if(!p)if(0===e[5].lastIndexOf("B|",0)||"E"===e[5]||0===e[5].lastIndexOf("C|",0))p=[e[5],"android",e[5]];else return!1;a=a+":"+p[1];k=/(\S+)-\d+/.exec(e[1])[1];e=this.eventHandlers_[a];return!e?(this.importError("Unknown trace_marking_write event "+a),!0):e(a,b,c,d,p,k)},importCpuData:function(){this.lines_=this.events_.split("\n");var b=
-null;for(this.lineNumber=0;this.lineNumber<this.lines_.length;++this.lineNumber){var c=this.lines_[this.lineNumber];if(!(0==c.length||/^#/.test(c))){if(null==b&&(b=a(c),null==b)){this.importError("Cannot parse line: "+c);continue}var d=b.exec(c);if(d){var e=parseInt(/\S+-(\d+)/.exec(d[1])[1]),j=parseInt(d[2]),k=1E3*parseFloat(d[3]),p=d[4],m=this.eventHandlers_[p];m?m(p,j,e,k,d)||this.importError("Malformed "+p+" event ("+c+")"):this.importError("Unknown event "+p+" ("+c+")")}else this.importError("Unrecognized line: "+
+if(!a)return!1;this.clockSyncRecords_.push({perfTS:d,parentTS:1E3*a[1]});return!0},traceMarkingWriteEvent:function(a,b,c,d,e,k){var q=/^\s*(\w+):\s*(.*)$/.exec(e[5]);if(!q)if(0===e[5].lastIndexOf("B|",0)||"E"===e[5]||0===e[5].lastIndexOf("C|",0))q=[e[5],"android",e[5]];else return!1;a=a+":"+q[1];k=/(.+)-\d+/.exec(e[1])[1];e=this.eventHandlers_[a];return!e?(this.importError("Unknown trace_marking_write event "+a),!0):e(a,b,c,d,q,k)},importCpuData:function(){this.lines_=this.events_.split("\n");var b=
+null;for(this.lineNumber=0;this.lineNumber<this.lines_.length;++this.lineNumber){var c=this.lines_[this.lineNumber];if(!(0==c.length||/^#/.test(c))){if(null==b&&(b=a(c),null==b)){this.importError("Cannot parse line: "+c);continue}var d=b.exec(c);if(d){var e=parseInt(/.+-(\d+)/.exec(d[1])[1]),j=parseInt(d[2]),k=1E3*parseFloat(d[3]),q=d[4],m=this.eventHandlers_[q];m?m(q,j,e,k,d)||this.importError("Malformed "+q+" event ("+c+")"):this.importError("Unknown event "+q+" ("+c+")")}else this.importError("Unrecognized line: "+
 c)}}}};tracing.TimelineModel.registerImporter(d);return{LinuxPerfImporter:d,_LinuxPerfImporterTestExports:TestExports}});"use strict";
 base.exportTo("base",function(){function e(){this.storage_="G_testRunner"in global?FakeLocalStorage():localStorage}e.prototype={get:function(d,a,b){d=this.namespace_(d,b);return!(d in this.storage_)?a:String(this.storage_[d])},set:function(d,a,b){this.storage_[this.namespace_(d,b)]=String(a)},keys:function(d){for(var a=[],d=d||"",b=0;b<this.storage_.length;b++){var c=this.storage_.key(b);this.isnamespaced_(c,d)&&a.push(this.unnamespace_(c,d))}return a},isnamespaced_:function(d,a){return 0==d.indexOf(this.normalize_(a))},
 namespace_:function(d,a){return this.normalize_(a)+d},unnamespace_:function(d,a){return d.replace(this.normalize_(a),"")},normalize_:function(d){return e.NAMESPACE+(d?d+".":"")}};e.NAMESPACE="trace-viewer";return{Settings:e}});function FakeLocalStorage(){return Object.create({},{key:{value:function(e){return Object.keys(this).sort()[e]}},length:{get:function(){return Object.keys(this).length}}})}"use strict";base.requireStylesheet("timeline_view");base.require("timeline");base.require("timeline_analysis");
diff --git a/trace-viewer/src/linux_perf_android_parser_test.html b/trace-viewer/src/linux_perf_android_parser_test.html
index 43ffbea..d1d05a2 100644
--- a/trace-viewer/src/linux_perf_android_parser_test.html
+++ b/trace-viewer/src/linux_perf_android_parser_test.html
@@ -60,6 +60,24 @@
   assertEquals(11, thread.slices.length);
 }
 
+function testAndroidUserlandImportWithSpacesInThreadName() {
+  var lines = [
+    'Surface Flinger -4831  [001] ...1 80909.598590: tracing_mark_write: B|4829|latchBuffer',
+    'Surface Flinger -4831  [001] ...1 80909.598604: tracing_mark_write: E',
+  ];
+  var m = new tracing.TimelineModel(lines.join('\n'), false);
+  assertEquals(0, m.importErrors.length);
+
+  var threads = m.getAllThreads();
+  assertEquals(1, threads.length);
+
+  var thread = threads[0];
+  assertEquals(4829, thread.pid);
+  assertEquals(4831, thread.tid);
+  assertEquals('Surface Flinger ', thread.name);
+  assertEquals(1, thread.slices.length);
+}
+
 function testAndroidUserlandLegacyKernelImport() {
   var lines = [
     'SurfaceFlinger-4831  [001] ...1 80909.598554: 0: B|4829|onMessageReceived',
diff --git a/trace-viewer/src/linux_perf_importer.js b/trace-viewer/src/linux_perf_importer.js
index 4f1cfa2..301e80b 100644
--- a/trace-viewer/src/linux_perf_importer.js
+++ b/trace-viewer/src/linux_perf_importer.js
@@ -490,7 +490,7 @@
       }
 
       var writeEventName = eventName + ':' + event[1];
-      var threadName = (/(\S+)-\d+/.exec(eventBase[1]))[1];
+      var threadName = (/(.+)-\d+/.exec(eventBase[1]))[1];
       var handler = this.eventHandlers_[writeEventName];
       if (!handler) {
         this.importError('Unknown trace_marking_write event ' + writeEventName);
@@ -524,7 +524,7 @@
           continue;
         }
 
-        var pid = parseInt((/\S+-(\d+)/.exec(eventBase[1]))[1]);
+        var pid = parseInt((/.+-(\d+)/.exec(eventBase[1]))[1]);
         var cpuNumber = parseInt(eventBase[2]);
         var ts = parseFloat(eventBase[3]) * 1000;
         var eventName = eventBase[4];
diff --git a/trace-viewer/src/linux_perf_importer_test.html b/trace-viewer/src/linux_perf_importer_test.html
index 7824178..e7c2a70 100644
--- a/trace-viewer/src/linux_perf_importer_test.html
+++ b/trace-viewer/src/linux_perf_importer_test.html
@@ -176,6 +176,32 @@
   assertAlmostEquals(.536 - .475, c.slices[0].duration);
 }
 
+function testImportOneSequenceWithSpacyThreadName() {
+  var lines = [
+    '          <idle>-0     [001]  4467.843475: sched_switch: ' +
+                'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' +
+                'next_comm=Surface Flinger  next_pid=178 next_prio=112',
+
+                'Surface Flinger -178   [001]  4467.843536: sched_switch: ' +
+                'prev_comm=Surface Flinger  prev_pid=178 prev_prio=112 ' +
+                'prev_state=S ==> next_comm=kworker/u:2 next_pid=2844 ' +
+                'next_prio=120',
+
+                '     kworker/u:2-2844  [001]  4467.843567: sched_switch: ' +
+                'prev_comm=kworker/u:2 prev_pid=2844 prev_prio=120 ' +
+                'prev_state=S ==> next_comm=swapper next_pid=0 next_prio=120'
+  ];
+  var m = new tracing.TimelineModel(lines.join('\n'), false);
+  assertEquals(0, m.importErrors.length);
+
+  var c = m.cpus[1];
+  assertEquals(2, c.slices.length);
+
+  assertEquals('Surface Flinger ', c.slices[0].title);
+  assertEquals(4467843.475, c.slices[0].start);
+  assertAlmostEquals(.536 - .475, c.slices[0].duration);
+}
+
 function testImportWithNewline() {
   var lines = [
     ''
diff --git a/trace-viewer/src/timeline_analysis_test.html b/trace-viewer/src/timeline_analysis_test.html
index 30ecd89..9fd162b 100644
--- a/trace-viewer/src/timeline_analysis_test.html
+++ b/trace-viewer/src/timeline_analysis_test.html
@@ -274,7 +274,7 @@
 
       for (var i = 0; i < startTimes.length; ++i) {
         for (var j = 0; j < numSlices; ++j) {
-          var name = 'slice' + String(j);
+          var name = 'slice' + String(numSlices - 1 - j);
           thread.slices.push(newSliceNamed(name, startTimes[i], duration));
         }
       }
@@ -571,23 +571,6 @@
     }
 
     function testAnalyzeSelectionWithNormallyDistributedSamples() {
-      var numSlices = 1;
-      var selection = createSelectionWithNormallyDistributedSamples(numSlices);
-
-      var results = new StubAnalysisResults();
-      tracing.analyzeSelection_(results, selection);
-      assertEquals(1, results.tables.length);
-
-      assertEquals('Frequency (occurrences/s)',
-                   results.tables[0].rows[8].label);
-      assertEquals(63, Math.round(results.tables[0].rows[8].time));
-
-      assertEquals('Std Dev (occurrences/s)',
-                   results.tables[0].rows[9].label);
-      assertEquals(16, Math.round(results.tables[0].rows[9].time));
-    }
-
-    function testAnalyzeSelectionWithNormallyDistributedSamples() {
       var numSlices = 2;
       var selection = createSelectionWithNormallyDistributedSamples(numSlices);
 
diff --git a/trace-viewer/src/tracks/timeline_slice_group_track.js b/trace-viewer/src/tracks/timeline_slice_group_track.js
index 487aa69..3413667 100644
--- a/trace-viewer/src/tracks/timeline_slice_group_track.js
+++ b/trace-viewer/src/tracks/timeline_slice_group_track.js
@@ -140,7 +140,12 @@
         var y = slices[iy];
         if (x.start != y.start)
           return x.start - y.start;
-        return ix - iy;
+
+        // Elements get inserted into the slices array in order of when the
+        // slices end.  Because slices must be properly nested, we break
+        // start-time ties by assuming that the elements appearing earlier in
+        // the slices array (and thus ending earlier) start later.
+        return iy - ix;
       });
 
       var subRows = [[]];
diff --git a/trace-viewer/src/tracks/timeline_slice_group_track_test.html b/trace-viewer/src/tracks/timeline_slice_group_track_test.html
index 678c06b..e0f7819 100644
--- a/trace-viewer/src/tracks/timeline_slice_group_track_test.html
+++ b/trace-viewer/src/tracks/timeline_slice_group_track_test.html
@@ -73,8 +73,8 @@
     assertEquals(2, subRows.length);
     assertEquals(1, subRows[0].length);
     assertEquals(1, subRows[1].length);
-    assertArrayEquals([sA], subRows[0]);
-    assertArrayEquals([sB], subRows[1]);
+    assertArrayEquals([sB], subRows[0]);
+    assertArrayEquals([sA], subRows[1]);
   }
 
   function testSubRowBuilderInstantEvents() {
@@ -94,8 +94,8 @@
 
   function testSubRowBuilderTwoInstantEvents() {
     var group = new TimelineSliceGroup();
-    var sA = group.pushSlice(newSliceNamed('a', 1, 0));
     var sB = group.pushSlice(newSliceNamed('b', 1, 0));
+    var sA = group.pushSlice(newSliceNamed('a', 1, 0));
 
     var track = new TimelineSliceGroupTrack();
     track.group = group;
@@ -155,9 +155,9 @@
     // Pattern being tested:
     // [    a    ]
     // [  b1 ]  []<- b2 where b2.duration = 0 and b2.end == a.end.
-    var sA = group.pushSlice(newSliceNamed('a', 1, 3));
     var sB1 = group.pushSlice(newSliceNamed('b1', 1, 2));
     var sB2 = group.pushSlice(newSliceNamed('b2', 4, 0));
+    var sA = group.pushSlice(newSliceNamed('a', 1, 3));
 
     var track = new TimelineSliceGroupTrack();
     track.group = group;