Implement dump mode in ttrace_tinyara.py
authorjoon.c.baek <joon.c.baek@samsung.com>
Fri, 14 Jul 2017 06:26:03 +0000 (15:26 +0900)
committerAhreum Jeong <ahreum.jeong@samsung.com>
Wed, 9 Aug 2017 10:19:44 +0000 (19:19 +0900)
1. Add options '-d' for dump.
2. Support artik053 device
3. User can use ttrace_tinyara.py only to get HTML report.

Signed-Off-by : Changjoon.Baek

tools/ttrace_parser/README.txt [new file with mode: 0644]
tools/ttrace_parser/scripts/parse_dump [new file with mode: 0755]
tools/ttrace_parser/scripts/parse_dump.c [new file with mode: 0644]
tools/ttrace_parser/scripts/prefix.html [new file with mode: 0644]
tools/ttrace_parser/scripts/style.css [new file with mode: 0644]
tools/ttrace_parser/scripts/suffix.html [new file with mode: 0644]
tools/ttrace_parser/scripts/tscript.js [new file with mode: 0755]
tools/ttrace_parser/scripts/ttrace.py [new file with mode: 0755]
tools/ttrace_parser/scripts/ttrace_tinyaraDump.py [new file with mode: 0755]
tools/ttrace_parser/ttrace_tinyara.py [new file with mode: 0755]

diff --git a/tools/ttrace_parser/README.txt b/tools/ttrace_parser/README.txt
new file mode 100644 (file)
index 0000000..0af9ac3
--- /dev/null
@@ -0,0 +1,47 @@
+ttrace parser
+=============
+
+  These are files for parsing T-trace logs to visualize T-trace result
+
+Usage
+======
+
+1. The text file contains T-trace logs
+  $ ./ttrace_tinyara.py [-i <input_filename>] [-o <output_foldername>]
+
+  After running it, You can get HTML file which show T-trace results in <output_folder>.
+  If you run it without '-i' options,
+  ttrace_tinyara.py returned immediately.
+  If you run it without '-o' options,
+  HTML file will saved at same folder with input_filename.
+
+2. Dump from artik053 device
+  $ ./ttrace_tinyara.py [-d <model_name>]
+
+  After running it, You can get HTML file which show T-trace results in current folder.
+  ttrace_tinyara.py will connect target as GDB and set breakpoint at wait_ttrace_dump().
+  You had traced on target($ ttrace -s <tags>), then run dump mode($ ttrace -d),
+  GDB will catch it and dump ttrace buffer.
+
+  Detail examples are below:
+  1. HOST$ ./ttrace_tinyara.py -d artik053
+  2. artik053$ ttrace -s apps libs ipc lock task
+  3. artik053$ ttrace -f
+  4. artik053$ ttrace -d
+
+  Dump feature needs tinyara binary, System.map, artik053.cfg and openocd executable,
+  They are located in tinyara/build/output/bin and
+  tinyara/build/configs/artik053/tools/openocd.
+  These paths are set by default.
+  However, You had changed location of them,
+  You can specified paths to ./scripts/ttrace_tinyaraDump.py with -b, -d options.
+
+  for examples,
+  $ HOST$ ./scripts/ttrace_tinyaraDump.py -t artik053 -b <binaryPath> -d <openocdPath>
+
+Example
+=======
+
+  $ ./ttrace_tinyara.py -i sample/sample_log
+
+  You can get results of parsing 'sample_log' in 'sample' folder.
diff --git a/tools/ttrace_parser/scripts/parse_dump b/tools/ttrace_parser/scripts/parse_dump
new file mode 100755 (executable)
index 0000000..a58fe22
Binary files /dev/null and b/tools/ttrace_parser/scripts/parse_dump differ
diff --git a/tools/ttrace_parser/scripts/parse_dump.c b/tools/ttrace_parser/scripts/parse_dump.c
new file mode 100644 (file)
index 0000000..18b1585
--- /dev/null
@@ -0,0 +1,208 @@
+/****************************************************************************
+ *
+ * Copyright 2017 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <getopt.h>
+#include <string.h>
+
+#define CODE_VARIABLE        0
+#define CODE_UNIQUE         (1 << 7)
+
+#define MSG_BYTES            32
+#define COMM_BYTES           12
+#define BYTE_ALIGN           4
+
+#define INVALID -1
+#define VALID 0
+
+#define packed_struct __attribute__ ((packed))
+
+int param = 0;
+
+struct sched_message {
+       short prev_pid;
+       unsigned char prev_prio;
+       unsigned char prev_state;
+       char prev_comm[COMM_BYTES];
+       short next_pid;
+       unsigned char next_prio;
+       char pad;
+       char next_comm[COMM_BYTES];
+};
+
+union trace_message {
+       char message[MSG_BYTES];        // 24B, message(192b)
+       struct sched_message sched_msg;
+};
+
+struct trace_packet {                  // total 40 byte(message), 16byte(uid)
+       int tv_sec;
+       int tv_nsec;
+       short pid;                                      // 2B, int16_t(16b)
+       char event_type;                        // 1B, char(8b)
+       unsigned char codelen;          // 1B, code(1b) + variable length(7b) or uid(7b)
+       int pad;
+       union trace_message msg;
+};
+
+static int print_uid_packet(struct trace_packet *packet)
+{
+       unsigned char uid = packet->codelen & (unsigned char)(~CODE_UNIQUE);
+       printf("[%06d:%06d] %03u: %c|%u\r\n", packet->tv_sec, packet->tv_nsec / 1000, (unsigned int)packet->pid, (unsigned int)packet->event_type, uid);
+       return sizeof(struct trace_packet) - MSG_BYTES;
+}
+
+static int print_message_packet(struct trace_packet *packet)
+{
+       printf("[%06d:%06d] %03u: %c|%s\r\n", packet->tv_sec, packet->tv_nsec / 1000, (unsigned int)packet->pid, packet->event_type, packet->msg.message);
+       return sizeof(struct trace_packet);
+}
+
+static int print_sched_packet(struct trace_packet *packet)
+{
+       printf("[%06d:%06d] %03u: %c|prev_comm=%s prev_pid=%u prev_prio=%u prev_state=%u ==> next_comm=%s next_pid=%u next_prio=%u\r\n", packet->tv_sec, packet->tv_nsec / 1000, (unsigned int)packet->pid, packet->event_type, packet->msg.sched_msg.prev_comm, (unsigned int)packet->msg.sched_msg.prev_pid, (unsigned int)packet->msg.sched_msg.prev_prio, (unsigned int)packet->msg.sched_msg.prev_state, packet->msg.sched_msg.next_comm, (unsigned int)packet->msg.sched_msg.next_pid, (unsigned int)packet->msg.sched_msg.next_prio);
+       return sizeof(struct trace_packet);
+}
+
+static int print_packet(struct trace_packet *packet)
+{
+       int isSched = (packet->event_type == 's') ? 1 : 0;
+       int isUnique = (packet->codelen & CODE_UNIQUE);
+
+       if (isSched) {
+               return print_sched_packet(packet);
+       } else if (isUnique) {
+               return print_uid_packet(packet);
+       } else {
+               return print_message_packet(packet);
+       }
+}
+
+static void show_help()
+{
+       printf("usage: parse_dump [dumpfile]\r\n");
+       printf("example: ./parse_dump ramdump\r\n");
+}
+
+static int check_args_validation(int argc, char **args)
+{
+       int i = 0;
+       if (argc != 2) {
+               show_help();
+               return INVALID;
+       }
+
+       return VALID;
+}
+
+static int get_dumpsize(FILE *file)
+{
+       int size = 0;
+       fseek(file, 0, SEEK_END);
+       size = ftell(file);
+       fseek(file, 0, SEEK_SET);
+       return size;
+}
+
+static FILE *open_dump(char *path)
+{
+       FILE *file = fopen(path, "r+");
+       if (file == NULL) {
+               printf("Failed to open : %s\r\n", path);
+       }
+       return file;
+}
+
+static char *alloc_tracebuffer(int size)
+{
+       char *bp = (char *)malloc(size * sizeof(char));
+       if (bp == NULL) {
+               printf("Failed to zalloc buffer in ttrace\r\n");
+       }
+       return bp;
+}
+
+static void close_dump(FILE *file)
+{
+       if (file == NULL) {
+               printf("file pointer doesn't opened\r\n");
+               return;
+       }
+       fclose(file);
+       return;
+}
+
+static void free_tracebuffer(char *buffer)
+{
+       if (buffer == NULL) {
+               printf("tracebuffer dosen't allocated\r\n");
+               return;
+       }
+       free(buffer);
+       return;
+}
+
+static int read_tracebuffer(FILE *file, int bufsize)
+{
+       char *buffer = NULL;
+       int read_len = 0, offset = 0;
+
+       buffer = alloc_tracebuffer(bufsize);
+       if (buffer == NULL) {
+               return INVALID;
+       }
+
+       read_len = fread(buffer, sizeof(char), bufsize, file);
+       if (read_len < 0) {
+               return INVALID;
+       }
+
+       while (offset < read_len) {
+               offset += print_packet((struct trace_packet *)(buffer + offset));
+       }
+
+       free_tracebuffer(buffer);
+       return VALID;
+}
+
+int main(int argc, char **args)
+{
+       FILE *file;
+       int filesize, ret;
+
+       if (INVALID == check_args_validation(argc, args)) {
+               return INVALID;
+       }
+
+       file = open_dump(args[1]);
+       if (file == NULL) {
+               return INVALID;
+       }
+
+       filesize = get_dumpsize(file);
+       if (filesize <= 0) {
+               return INVALID;
+       }
+
+       ret = read_tracebuffer(file, filesize);
+
+       close_dump(file);
+       return ret;
+}
diff --git a/tools/ttrace_parser/scripts/prefix.html b/tools/ttrace_parser/scripts/prefix.html
new file mode 100644 (file)
index 0000000..66f1f19
--- /dev/null
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<head i18n-values="dir:textdirection;">
+<meta charset="utf-8"/>
+<title>Tizen System Trace</title>
+%s
+%s
+<script language="javascript">
+document.addEventListener('DOMContentLoaded', function() {
+  if (!linuxPerfData)
+    return;
+
+  var m = new tracing.TraceModel(linuxPerfData);
+  var timelineViewEl = document.querySelector('.view');
+  ui.decorate(timelineViewEl, tracing.TimelineView);
+  timelineViewEl.model = m;
+  timelineViewEl.tabIndex = 1;
+  timelineViewEl.timeline.focusElement = timelineViewEl;
+});
+</script>
+<style>
+  .view {
+    overflow: hidden;
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+  }
+</style>
+</head>
+<body>
+  <div>%s</div>
+  <div class="view">
+  </div>
+<!-- BEGIN TRACE -->
+  <script>
+  var linuxPerfData = "\
diff --git a/tools/ttrace_parser/scripts/style.css b/tools/ttrace_parser/scripts/style.css
new file mode 100644 (file)
index 0000000..a5d58a8
--- /dev/null
@@ -0,0 +1 @@
+* WARNING:This file is generated by generate_standalone_timeline_view.py * * Do not edit directly. */.analysis-link{color:-webkit-link;cursor:pointer;text-decoration:underline}.analysis-link:hover{cursor:pointer}x-generic-object-view{display:block;font-family:monospace}.analysis-results{font-family:monospace;white-space:pre}.analysis-results *{-webkit-user-select:text!important;cursor:text}.analysis-table{border-collapse:collapse;border-width:0;margin-bottom:25px}.analysis-table>tr>td:first-child{padding-left:2px}.analysis-table>tr>td{padding:2px 4px 2px 4px}.analysis-table-header{text-align:left}.analysis-table-row{vertical-align:top}.analysis-table-row:nth-child(2n+0){background-color:#e2e2e2}.selection-changing-link{color:-webkit-link;cursor:pointer;text-decoration:underline}.analysis-slices-table-col-1,.analysis-slices-table-col-2{text-align:right}.default-object-snapshot-view #args{white-space:pre}.default-object-instance-view #snapshots>*{display:block}.default-object-view{overflow:auto}.default-object-view *{display:block;-webkit-user-select:text}.default-object-view .title,.default-object-view .title{border-bottom:1px solid #808080;font-size:110%;font-weight:bold}.default-object-view td,.default-object-view th{font-family:monospace;vertical-align:top}.analysis-view{background-color:white;display:-webkit-flex}.analysis-view:not(.viewing-object){overflow:auto}.analysis-view>*{-webkit-flex:1 0 auto}.overlay-root *{-webkit-user-select:none;box-sizing:border-box}.overlay-root{-webkit-flex-flow:row;-webkit-justify-content:center;-webkit-user-select:none;background:rgba(0,0,0,0.8);display:-webkit-flex;font-family:sans-serif;height:100%;left:0;position:fixed;top:0;width:100%;z-index:1000}.overlay-root:not([visible]){display:none}.overlay-root>.content-host{-webkit-flex-flow:column;-webkit-justify-content:center;-webkit-user-select:auto;display:-webkit-flex}.overlay *{-webkit-user-select:auto}.overlay-root>.content-host>*{background:#fff}.overlay-root>.content-host .tool-bar{cursor:pointer;display:-webkit-flex;height:24px;padding:1px}.overlay-root>.content-host .tool-bar .exit-button{background-color:rgba(0,0,0,0.8);border:1px solid white;color:white;height:100%;padding-left:4px;width:19px}.overlay{max-height:500px;overflow:auto;padding:8px}.track-button{background-color:rgba(255,255,255,0.5);border:1px solid rgba(0,0,0,0.1);color:rgba(0,0,0,0.2);font-size:10px;height:12px;text-align:center;width:12px}.track-button:hover{background-color:rgba(255,255,255,1.0);border:1px solid rgba(0,0,0,0.5);box-shadow:0 0 .05em rgba(0,0,0,0.4);color:rgba(0,0,0,1)}.track-close-button{left:2px;position:absolute;top:2px}.track-collapse-button{left:3px;position:absolute;top:2px}.drawing-container{-webkit-box-flex:1;display:inline;overflow:auto;position:relative}.drawing-container-canvas{-webkit-box-flex:1;display:block;pointer-events:none;position:absolute;top:0}.heading-track{-webkit-box-align:stretch;-webkit-box-orient:horizontal;display:-webkit-box;margin:0;padding:0 5px 0 0}.heading-track>heading{-webkit-box-sizing:border-box;background-color:rgba(214,221,229,0.3);border-right:1px solid #8e8e8e;box-sizing:border-box;display:block;overflow:hidden;padding-left:18px;padding-right:5px;text-align:left;text-overflow:ellipsis;white-space:nowrap}.ruler-track{height:12px}.ruler-track-with-distance-measurements{height:24px}.slice-track{height:18px}.object-instance-track{height:18px}.heap-instance-track{height:150px}.heap-instance-track ul{list-style:none;list-style-position:outside;margin:0;overflow:hidden}.counter-track{height:30px;position:relative}.spacing-track{height:4px}.thread-track{-webkit-box-orient:vertical;display:-webkit-box;position:relative}.process-track-header{-webkit-flex:0 0 auto;background-image:-webkit-gradient(linear,0 0,100% 0,from(#e5e5e5),to(#d1d1d1));border-bottom:1px solid #8e8e8e;border-top:1px solid white;font-size:75%}.process-track-base:not(.expanded)>.track{display:none}.process-track-header>expand-button{display:inline;padding:2px 4px 2px 4px}.process-track-header>expand-button.expand-button-expanded{content:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAABl0RVh0U29mdHdhcmUAUGFpbnQuTkVUIHYzLjUuNtCDrVoAAAAoSURBVChTY2CgKggNDVUHYnsUQ4EC//FhBoIKkI0DKlYAYhmqupsBAMwgJH8K5nKoAAAAAElFTkSuQmCC)}.process-track-header>expand-button:not(.expand-button-expanded){content:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAwBQTFRFAAAAVVVVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASd3+7gAAAQB0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AFP3ByUAAAAZdEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjbQg61aAAAAGklEQVQYV2P4//8/IyOQYMBkMEIBA5yBWzEAD3Mj+VR5R78AAAAASUVORK5CYII=)}.model-track{-webkit-box-flex:1}.tool-button{background-position:center center;background-repeat:no-repeat;border-bottom:1px solid #bcbcbc;border-top:1px solid #f1f1f1;cursor:pointer;height:30px}.tool-button.active{cursor:auto}.mouse-mode-selector{-webkit-user-drag:element;-webkit-user-select:none;background:#DDD;border:1px solid #BBB;border-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,0.2);height:108px;left:calc(100% - 120px);position:fixed;top:100px;user-drag:element;user-select:none;width:29px;z-index:20}.mouse-mode-selector .drag-handle{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAABkCAYAAADaIVPoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABV0RVh0Q3JlYXRpb24gVGltZQA3LzE2LzEzRNEKUwAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAlGSURBVHic7VxfSFPvH362taMLZxIqtAr8k01MwYQkaMGUVRfByEHxFYZ1E2oQBgrd7KZYUER1UaghonlR0CC7UWrrYhetGwum4kxksi4kdf6b25ye03Z+F/421B238579MXIPyM6fd5/nPHt9/+zzvO9Ejx8/Zq9fvw6TyYRUvP5tELEsy87MzKCkpASpeP3bIH7y5AkAIFWvfxsyNZyp4X+shkVOp5Pd74dIJ8T7/QDpRkbwv44DJ/jQfj+Aw+HAjx8/wDAMxOLEP/9QKASKolBTU4OKioqo+/sq2OFwYGRkBMeOHUNxcTFkMhlEIpHgeKFQCH6/Hy6XCyMjIwAQJXpfBY+OjuLkyZMoLy8HRVGQSCQJCWZZFjKZDLm5uRgfH8fo6GhyBK+uriIvL0/wg4URCoVQVFQEmUwGqVQaV3B4QrMXWJZFMBiERCJBcXExFhcXo8oQNxq32w2LxQK/30/61ihIJBLk5uZCKpWCoihQFAWpVMr5Nzk5iba2NiwvL+9ZZnuMI0eOQCKRJC54cnISAPD9+/eEBYvFYkgkEl5/b9++BQA8e/aMV3mKojg7QSLBs7OzmJ+fBwAsLCxgdnY2YdEikShuu7XZbLDb7QCAsbEx2Gw2wTGJBI+NjUWdMwxDEkIQuru7o859Pp+gWESCm5qaos4pihJETIJPnz5FncvlckGxiHppt9sd8zxVSCZvzBp2u90YGhriFWhoaAgul0vwg2zH6Ogo9Ho9r7J6vR5ms5l3bM7vwwzDYGJiAtPT0/yf8v/Iy8tDdXU1CgoK4pZ9//49Ll++jOzsbEilUgQCAQwMDGBwcJCYt6SkBHfu3EFlZSUYhsHGxgbMZjNu3LixoxxnDVutVkFiga1JidVqFdSDd3R0CBILbE1KOjo68O3bt5jlOAXrdDqUl5cLIj5+/DgaGxtjzoj2Ql9fH7RarSDec+fOwWQyob6+PmY5zk7L5/NBpVKhoqICX758wc2bNyP3Xr58GTm+e/du5PjNmze4ePEiTpw4Aa/Xi83NTeKHpmkaBoMB165dg8FgwOfPnyP3qqqqIsfj4+OR4ytXruD+/ftQqVTwer3Y2NiIycEpmGVZeDweyGQy6PV6zM3Ncb55+3W9Xo+1tTUsLy/zUxeDt7S0FMPDw7x4h4eHiXhjDks0TfMeApI5RKWSl2jisXuI4jtkJYrdQxTfIYsLRIIvXboU8zxVePToUcxzEhAJzsnJQXV1NQCguLgYOTk5golJUFZWFqnV+vp6lJWVCY5FJJimaVRWViI/Px/nz58HTdOCicNg2fg+AE3TuHXrFpRKJe7du8eLNxgMcl4nznhsbm6irq4Of/78IX0rJ9bX15GdnR23HMuyePXqFa+YLMtibW2N896+5rSkUilcLheOHDmyZ42QIhgMIhgM4tevX5BKpVH391VwVVUV7HY7RCIRioqK9kzL8EUwGMTKygpmZmbgdrtx9uzZqDL7KvjUqVMQiURwOByYn5+HWCxOOGsZCoVw6NAh1NTUoLS0NKpMxj3815ER/K/jwAnOuIfpRMY9/Fvdw2SB1D2MBz7u4b4K3u0eJjKtDCM8J0/IPQy3h2Qjnnv4/Plz3u5iUt1Dl8sFi8WSEuMsltNnNpvR3NxMbJwlxT1cXV3F0NAQVldXicgTxczMDPR6PZxOZ1LiEQ18DMPAYrEkzUPiC7/fj5aWFiIPaS8IGulHRkYiBnU68fTpU3R2diYUQ/DUZnp6GlarNS2G+HYMDg6ivb09PYb4brjdbpjN5rS367GxMbS0tAhq1wlPXtfX12G1WtPerufn59He3k7crgVPPPLz86HT6ZCVlYVQKASv14tAICA0HG8olUr09fVBLpcL4iWqYYqioNFoAACLi4uw2WyYm5vDwsJCSsXK5XIYjUYAwNTUFLq7uwXzEgm+evUqFAoFamtrAQATExNpab8vXryAWq1Ga2srAGBgYEDwuMxbsEajweHDhxEIBHDmzBnk5uYC2PrGk0oYjUaUlZUhEAigqakJCoUCANDV1SUoHi/BGo0GCoUiYnH4fD7U1dUB2FqgJnR5RDwYjUao1eodvA8fPgSw9UF/+PCBOCYvwQqFIqqt5OTkRJZFTExMEBPzgVqtjuItKyuLLIsYGBggjslLMFfHQNM0amtrQVFUyiYfe/G2tbVBLpcLWuCa0PfhjY0N3L59G2KxeM/lCfHAxz3kes/Xr19j8ibNPdxNvLCwkEgI3u4hCW/GPdyGjHuYTmTcwzTgwFktGcH/Og6c4Ix7mE5k3MOMe0iGlLmH4bROohsuSd3DcFqHawYVRjz3kFiwy+WC3W4HwzCorq5ObGUrh3u4F8xmMzo7O+H3+9Ha2gqdTrdn2VjuIW/BDMPAbrfvyD/b7XbMzs7iwoULnN9M+CDe3kOfz4eurq4d+eeuri7YbDY8ePCAcwlzwu5heGsOV7I9vJkrFbvUnE4nOjo6OJPtY2Nj0Ov1xElEXjVcUFCA//77Dx6PB+/evdtxr7GxEUePHsXq6mpS1k9vR3l5OUwmE5xOZ9RPVZlMJpw+fZqYl5dghmGwtLQU2Uq7HVNTUzE7kUQQ5v3582fUPavVKqjTJJracCXd4+0TSga4ftNHaBMiEsyVR1pZWRFETAIuL1poLpxIMFdadGlpSRAxCbgyk2kR7PV6o67RNJ1yU/z3799R13w+nyBTPG6nZbFY4hpmHz9+BLA180rWXqbm5ua4v8fV0NAAYGsr7evXr3nFjVvDOp2O17Z3iqJizn5I0d/fz2vbu1wuR39/P++4cQX7fL7IJxkLDQ0NgtddcIGmafT29sYt19vbSzQOxxXMsiwkEknECOeCRqOBRCIRZJvE4i0sLIwY4VwwGo0oLCwk4uXVaTEMA4VCwbmJury8HAqFIiUdF8MwUKvVnJuotVot1Go1MS/vXjoQCEClUiE/Pz9yLT8/HyqVKqXLHQKBAAwGA5RKZeSaUqmEwWAQxEs0LHk8Hmi12shv3mi1Wng8HmLS7eDz7+jxeNDT0wO5XA65XI6enp64vElzD7d3YsnopPi6h9s7sXidVFLdQ5Zlk9Y5kbqH4XUlsTZ6ZtzDXTjEsmxCiTO+2M3Dsmxa3MPdvCKHw8FmZWUlJIYPAoEAZDJZ5HxzcxP7wStOBymAHaQA0iKWi/fAeUsHTvD/AOsopsJRclbzAAAAAElFTkSuQmCC) 2px 3px no-repeat;background-repeat:no-repeat;border-bottom:1px solid #bcbcbc;cursor:move;display:block;height:13px;width:27px}.mouse-mode-selector .pan-scan-mode-button{background-image:url(data:image/png;base64,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);background-position:0 -10px}.mouse-mode-selector .pan-scan-mode-button.active{background-position:-30px -10px}.mouse-mode-selector .selection-mode-button{background-image:url(data:image/png;base64,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);background-position:0 -40px}.mouse-mode-selector .selection-mode-button.active{background-position:-30px -40px}.mouse-mode-selector .zoom-mode-button{background-image:url(data:image/png;base64,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);background-position:0 -70px;border-bottom:0}.mouse-mode-selector .zoom-mode-button.active{background-position:-30px -70px}.timeline-track-view *{-webkit-user-select:none;cursor:default}.timeline-track-view .tool-button{cursor:pointer}.timeline-track-view{-webkit-box-orient:vertical;display:-webkit-box}.timeline-track-view .mode-indicator{height:32px;position:absolute;right:5px;top:38px;width:33px}.model-track-container{-webkit-box-flex:1;overflow:auto}.drag-box{background-color:rgba(0,0,255,0.25);border:1px solid #000060;font-size:75%;position:fixed}x-drag-handle{-webkit-user-select:none;box-sizing:border-box;display:block}x-drag-handle.horizontal-drag-handle{background-image:-webkit-gradient(linear,0 0,0 100%,from(#e5e5e5),to(#d1d1d1));border-bottom:1px solid #8e8e8e;border-top:1px solid white;cursor:ns-resize;height:7px;position:relative;z-index:10}x-drag-handle.vertical-drag-handle{background-image:-webkit-gradient(linear,0 0,100% 0,from(#e5e5e5),to(#d1d1d1));border-left:1px solid white;border-right:1px solid #8e8e8e;cursor:ew-resize;position:relative;width:7px;z-index:10}.timeline-view *{-webkit-user-select:none;box-sizing:border-box}.timeline-view{-webkit-box-flex:1;-webkit-box-orient:vertical;cursor:default;display:-webkit-box;font-family:sans-serif;padding:0}.timeline-view>.control>.title{font-size:14px;height:19px;padding-left:2px;padding-right:8px;padding-top:2px}.timeline-view>.control{background-color:#e6e6e6;background-image:-webkit-gradient(linear,0 0,0 100%,from(#e5e5e5),to(#d1d1d1));border-bottom:1px solid #8e8e8e;display:-webkit-flex;padding-top:1px}.timeline-view>.control>.controls.category-filter{margin-left:auto}.timeline-view>.control>.controls{display:-webkit-flex}.timeline-view>.control>span{padding-left:5px;padding-right:10px}.timeline-view>.control>.controls>button,.timeline-view>.control>.controls>label{font-size:11px;height:19px;margin:1px 2px 1px 2px}.timeline-view>.control>.spacer{-webkit-box-flex:1}.timeline-view>.container{-webkit-box-flex:1;border-bottom:1px solid #8e8e8e;display:-webkit-box}.timeline-view>.container>*{-webkit-box-flex:1}.timeline-view>.analysis-view{display:-webkit-flex;padding-left:2px;padding-right:2px}.timeline-view>.analysis-view:not(.viewing-object){height:250px}.timeline-view>.analysis-view.viewing-object{height:500px}.timeline-view .selection{margin:2px}.timeline-view .selection ul{margin:0}.find-control{-webkit-user-select:none;display:-webkit-box;position:relative}.find-control .hit-count-label{left:0;opacity:.25;pointer-events:none;position:absolute;text-align:right;top:2px;width:170px;z-index:1}.find-control input{-webkit-user-select:auto;background-color:#f8f8f8;border:1px solid rgba(0,0,0,0.5);box-sizing:border-box;height:19px;margin-bottom:1px;margin-left:0;margin-right:0;margin-top:1px;padding:0;width:170px}.find-control input:focus{background-color:white}.button.find-previous{border-left:none;margin-left:0;margin-right:0}.button.find-next{border-left:none;margin-left:0}.view-help-overlay{padding:6px}.button{background-color:#f8f8f8;border:1px solid rgba(0,0,0,0.5);color:rgba(0,0,0,0.8);font-size:14px;height:19px;margin:1px;min-width:23px;text-align:center}.button:hover{background-color:rgba(255,255,255,1.0);border:1px solid rgba(0,0,0,0.8);box-shadow:0 0 .05em rgba(0,0,0,0.4);color:rgba(0,0,0,1)}.view-info-button{padding-left:4px;padding-right:4px;width:auto}.view-info-button:hover{border:solid 1px}.view-import-errors-button{border:solid 1px rgba(128,0,0,0.2);color:darkred}.view-import-errors-button:hover{border:solid 1px red;color:red}.view-import-errors-overlay{-webkit-user-select:text;max-height:500px;max-width:800px;min-height:200px;min-width:400px;overflow:auto}.import-errors-dialog-text{font-family:monospace;margin:8px;white-space:pre}.metadata-dialog{max-height:500px;max-width:800px;min-height:200px;min-width:400px;overflow:auto}.metadata-dialog-text{font-family:monospace;margin:8px;white-space:pre}.category-filter-dialog{max-height:500px;min-width:400px;overflow-y:auto;padding:20px}.category-filter-dialog-form{font-size:80%;padding:10px}.category-filter-dialog-form input{margin-right:7px}
diff --git a/tools/ttrace_parser/scripts/suffix.html b/tools/ttrace_parser/scripts/suffix.html
new file mode 100644 (file)
index 0000000..f770848
--- /dev/null
@@ -0,0 +1,5 @@
+\n";
+  </script>
+<!-- END TRACE -->
+</body>
+</html>
diff --git a/tools/ttrace_parser/scripts/tscript.js b/tools/ttrace_parser/scripts/tscript.js
new file mode 100755 (executable)
index 0000000..66511b2
--- /dev/null
@@ -0,0 +1,8 @@
+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 PIDCommMap=function(){this.map=new Object};PIDCommMap.prototype={put:function(e,t){this.map[e]=t},get:function(e){return this.map[e]},clear:function(){this.map=new Object}};var customPIDMap=new PIDCommMap,templateData_=window.atob("PCEtLQpDb3B5cmlnaHQgKGMpIDIwMTMgVGhlIENocm9taXVtIEF1dGhvcnMuIEFsbCByaWdodHMgcmVzZXJ2ZWQuClVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGEgQlNELXN0eWxlIGxpY2Vuc2UgdGhhdCBjYW4gYmUKZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZS4KLS0+Cgo8dGVtcGxhdGUgaWQ9Im1vdXNlLW1vZGUtc2VsZWN0b3ItdGVtcGxhdGUiPgogIDxkaXYgY2xhc3M9ImRyYWctaGFuZGxlIj48L2Rpdj4KICA8ZGl2IGNsYXNzPSJidXR0b25zIj4KICAgIDxkaXYgY2xhc3M9InBhbi1zY2FuLW1vZGUtYnV0dG9uIHRvb2wtYnV0dG9uIj48L2Rpdj4KICAgIDxkaXYgY2xhc3M9InNlbGVjdGlvbi1tb2RlLWJ1dHRvbiB0b29sLWJ1dHRvbiI+PC9kaXY+CiAgICA8ZGl2IGNsYXNzPSJ6b29tLW1vZGUtYnV0dG9uIHRvb2wtYnV0dG9uIj48L2Rpdj4KICA8L2Rpdj4KPC90ZW1wbGF0ZT4KPCEtLQpDb3B5cmlnaHQgKGMpIDIwMTMgVGhlIENocm9taXVtIEF1dGhvcnMuIEFsbCByaWdodHMgcmVzZXJ2ZWQuClVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGEgQlNELXN0eWxlIGxpY2Vuc2UgdGhhdCBjYW4gYmUKZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZS4KLS0+Cgo8dGVtcGxhdGUgaWQ9InJlY29yZC1zZWxlY3Rpb24tZGlhbG9nLXRlbXBsYXRlIj4KICA8ZGl2IGNsYXNzPSJyZWNvcmQtc2VsZWN0aW9uLWRpYWxvZyI+CiAgICA8Zm9ybT4KICAgICAgPHRhYmxlPgogICAgICAgIDx0cj4KICAgICAgICAgIDx0ZCBjbGFzcz0iZGVmYXVsdC1lbmFibGVkLWNhdGVnb3JpZXMiPgogICAgICAgICAgICA8ZGl2PlJlY29yZCZuYnNwO0NhdGVnb3JpZXM8L2Rpdj4KICAgICAgICAgICAgPGRpdiBjbGFzcz0iZ3JvdXAtc2VsZWN0b3JzIj4KICAgICAgICAgICAgICBTZWxlY3QKICAgICAgICAgICAgICA8YnV0dG9uIGNsYXNzPSJhbGwtYnRuIj5BbGw8L2J1dHRvbj4KICAgICAgICAgICAgICA8YnV0dG9uIGNsYXNzPSJub25lLWJ0biI+Tm9uZTwvYnV0dG9uPgogICAgICAgICAgICA8L2Rpdj4KICAgICAgICAgICAgPGRpdiBjbGFzcz0iY2F0ZWdvcmllcyI+PC9kaXY+CiAgICAgICAgICA8L3RkPgogICAgICAgICAgPHRkIGNsYXNzPSJkZWZhdWx0LWRpc2FibGVkLWNhdGVnb3JpZXMiPgogICAgICAgICAgICA8ZGl2PkRpc2FibGVkJm5ic3A7YnkmbmJzcDtEZWZhdWx0Jm5ic3A7Q2F0ZWdvcmllczwvZGl2PgogICAgICAgICAgICA8ZGl2IGNsYXNzPSJncm91cC1zZWxlY3RvcnMiPgogICAgICAgICAgICAgIFNlbGVjdAogICAgICAgICAgICAgIDxidXR0b24gY2xhc3M9ImFsbC1idG4iPkFsbDwvYnV0dG9uPgogICAgICAgICAgICAgIDxidXR0b24gY2xhc3M9Im5vbmUtYnRuIj5Ob25lPC9idXR0b24+CiAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICA8ZGl2IGNsYXNzPSJjYXRlZ29yaWVzIj48L2Rpdj4KICAgICAgICAgIDwvdGQ+CiAgICAgICAgPC90cj4KICAgICAgPC90YWJsZT4KICAgIDwvZm9ybT4KCiAgICA8ZGl2IGNsYXNzPSJvcHRpb25zIj4KICAgICAgPGJ1dHRvbiBjbGFzcz0icmVjb3JkLWNhdGVnb3JpZXMiPlJlY29yZDwvYnV0dG9uPgogICAgICA8bGFiZWwgY2xhc3M9ImNvbnRpbnVvdXMtdHJhY2luZy1sYWJlbCI+CiAgICAgICAgQ29udGludW91cyB0cmFjaW5nCiAgICAgICAgPGlucHV0IHR5cGU9ImNoZWNrYm94IiB2YWx1ZT0iY29udGludW91c1RyYWNpbmciIGNoZWNrZWQ9ImNoZWNrZWQiCiAgICAgICAgICAgICAgIGNsYXNzPSJjb250aW51b3VzLXRyYWNpbmctYnV0dG9uIiAvPgogICAgICA8L2xhYmVsPgogICAgICA8bGFiZWwgY2xhc3M9InN5c3RlbS10cmFjaW5nLWxhYmVsIj4KICAgICAgICBTeXN0ZW0gZXZlbnRzCiAgICAgICAgPGlucHV0IHR5cGU9ImNoZWNrYm94IiB2YWx1ZT0ic3lzdGVtVHJhY2luZyIKICAgICAgICAgICAgICAgY2xhc3M9InN5c3RlbS10cmFjaW5nLWJ1dHRvbiIgLz4KICAgICAgPC9sYWJlbD4KICAgICAgPGxhYmVsIGNsYXNzPSJzYW1wbGluZy1sYWJlbCI+CiAgICAgICAgRW5hYmxlIHNhbXBsaW5nCiAgICAgICAgPGlucHV0IHR5cGU9ImNoZWNrYm94IiB2YWx1ZT0iZW5hYmxlU2FtcGxpbmciIGNsYXNzPSJzYW1wbGluZy1idXR0b24iIC8+CiAgICAgIDwvbGFiZWw+CiAgICA8L2Rpdj4KICA8L2Rpdj4KPC90ZW1wbGF0ZT4KPCEtLQpDb3B5cmlnaHQgKGMpIDIwMTMgVGhlIENocm9taXVtIEF1dGhvcnMuIEFsbCByaWdodHMgcmVzZXJ2ZWQuClVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGEgQlNELXN0eWxlIGxpY2Vuc2UgdGhhdCBjYW4gYmUKZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZS4KLS0+Cgo8dGVtcGxhdGUgaWQ9InRpbWVsaW5lLXZpZXctdGVtcGxhdGUiPgogIDxkaXYgY2xhc3M9ImNvbnRyb2wiPgogICAgPGRpdiBpZD0ibGVmdC1jb250cm9scyIgY2xhc3M9ImNvbnRyb2xzIj48L2Rpdj4KICAgIDxkaXYgY2xhc3M9InRpdGxlIj5eX148L2Rpdj4KICAgIDxkaXYgaWQ9InJpZ2h0LWNvbnRyb2xzIiBjbGFzcz0iY29udHJvbHMgY2F0ZWdvcnktZmlsdGVyIj48L2Rpdj4KICA8L2Rpdj4KICA8ZGl2IGNsYXNzPSJjb250YWluZXIiPjwvZGl2Pgo8L3RlbXBsYXRlPgoKPHRlbXBsYXRlIGlkPSJ0cmFjay1zZWxlY3Rvci1idG4tdGVtcGxhdGUiPgogIDxkaXYgY2xhc3M9InRyYWNrLXNlbGVjdG9yLWFuY2hvciI+CiAgICA8YnV0dG9uIGNsYXNzPSJidXR0b24gdHJhY2stc2VsZWN0b3ItYnV0dG9uIHRyYWNrLXNlbGVjdG9yLWNsb3NlZCI+CiAgICAgIFRyYWNrIFNlbGVjdG9yCiAgICA8L2J1dHRvbj4KICA8L2Rpdj4KPC90ZW1wbGF0ZT4KCjx0ZW1wbGF0ZSBpZD0iaW1wb3J0LWVycm9ycy1idG4tdGVtcGxhdGUiPgogIDxkaXYgY2xhc3M9ImJ1dHRvbiB2aWV3LWltcG9ydC1lcnJvcnMtYnV0dG9uIHZpZXctaW5mby1idXR0b24iPgogICAgSW1wb3J0IGVycm9ycyEKICA8L2Rpdj4KICA8ZGl2IGNsYXNzPSJpbmZvLWJ1dHRvbi1jb250YWluZXIgaW1wb3J0LWVycm9ycy1kaWFsb2ciPgogICAgRXJyb3JzIG9jY3VycmVkIGR1cmluZyBpbXBvcnQ6CiAgICA8ZGl2IGNsYXNzPSJpbmZvLWJ1dHRvbi10ZXh0IGltcG9ydC1lcnJvcnMtZGlhbG9nLXRleHQiPjwvZGl2PgogIDwvZGl2Pgo8L3RlbXBsYXRlPgoKPHRlbXBsYXRlIGlkPSJjYXRlZ29yeS1maWx0ZXItYnRuLXRlbXBsYXRlIj4KICA8ZGl2IGNsYXNzPSJidXR0b24gdmlldy1pbmZvLWJ1dHRvbiI+Q2F0ZWdvcmllczwvZGl2Pgo8L3RlbXBsYXRlPgoKPHRlbXBsYXRlIGlkPSJoZWxwLWJ0bi10ZW1wbGF0ZSI+CiAgPGRpdiBjbGFzcz0iYnV0dG9uIHZpZXctaGVscC1idXR0b24iPj88L2Rpdj4KICA8ZGl2IGNsYXNzPSJ2aWV3LWhlbHAtdGV4dCIKICAgICAgc3R5bGU9IndoaXRlLXNwYWNlOiBwcmU7IGZvbnQtZmFtaWx5OiBtb25vc3BhY2UiPjwvZGl2Pgo8L3RlbXBsYXRlPgoKPHRlbXBsYXRlIGlkPSJtZXRhZGF0YS1idG4tdGVtcGxhdGUiPgogIDxkaXYgY2xhc3M9ImJ1dHRvbiB2aWV3LW1ldGFkYXRhLWJ1dHRvbiB2aWV3LWluZm8tYnV0dG9uIj4KICAgIE1ldGFkYXRhCiAgPC9kaXY+CiAgPGRpdiBjbGFzcz0iaW5mby1idXR0b24tY29udGFpbmVyIG1ldGFkYXRhLWRpYWxvZyI+CiAgICBNZXRhZGF0YSBJbmZvOgogICAgPGRpdiBjbGFzcz0iaW5mby1idXR0b24tdGV4dCBtZXRhZGF0YS1kaWFsb2ctdGV4dCI+PC9kaXY+CiAgPC9kaXY+CjwvdGVtcGxhdGU+CjwhLS0KQ29weXJpZ2h0IChjKSAyMDEzIFRoZSBDaHJvbWl1bSBBdXRob3JzLiBBbGwgcmlnaHRzIHJlc2VydmVkLgpVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSBhIEJTRC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlCmZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUuCi0tPgoKPHRlbXBsYXRlIGlkPSJ2aWV3LWNhdGVnb3J5LWZpbHRlci1kaWFsb2ctdGVtcGxhdGUiPgogIDxkaXYgY2xhc3M9ImNhdGVnb3J5LWZpbHRlci1kaWFsb2ciPgogICAgU2VsZWN0IGFjdGl2ZSBjYXRlZ29yaWVzOgogICAgPGZvcm0gY2xhc3M9ImNhdGVnb3J5LWZpbHRlci1kaWFsb2ctZm9ybSI+CiAgICAgIDxkaXYgY2xhc3M9ImNhdGVnb3JpZXMiPgogICAgICA8L2Rpdj4KICAgIDwvZm9ybT4KICA8L2Rpdj4KPC90ZW1wbGF0ZT4K"),templateElem_=document.createElement("div");for(templateElem_.innerHTML=templateData_;templateElem_.hasChildNodes();)document.head.appendChild(templateElem_.removeChild(templateElem_.firstChild));var global=this;this.base=function(){function d(e){"/"==e[e.length-1]&&(e=e.substring(0,e.length-1)),l=e}function b(e,t){n[e]||(n[e]=[]);for(var i=n[e],r=!1,s=0;s<i.length;s++)i[s]==t&&(r=!0);r||i.push(t)}function a(e,t){q[e]||(q[e]=[]);for(var i=q[e],n=!1,r=0;r<q.length;r++)i[r]==t&&(n=!0);n||i.push(t)}function c(e,t){p[e]||(p[e]=[]);for(var i=p[e],n=!1,r=0;r<i.length;r++)i[r]==t&&(n=!0);n||i.push(t)}function e(){if(!window.FLATTENED&&!m){m=!0;var e=new XMLHttpRequest;if(e.open("GET","/deps.js",!1),e.send(null),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");throw 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),Error(f)}base.addModuleDependency=b,base.addModuleRawScriptDependency=a,base.addModuleStylesheet=c;try{eval(e.responseText)}catch(d){throw Error(d.stack)}delete base.addModuleStylesheet,delete base.addModuleRawScriptDependency,delete base.addModuleDependency}}function f(){if(!t&&!window.FLATTENED){t=!0;var e=new XMLHttpRequest;e.open("GET","/templates",!1),e.send(null);var i=document.createElement("div");for(i.innerHTML=e.responseText;i.hasChildNodes();)document.head.appendChild(i.removeChild(i.firstChild))}}function g(t,i){var r=i||0,s=t;t instanceof Array||(s=[t]),e(),f(),s.forEach(function(e){if(window.FLATTENED){if(!window.FLATTENED[e])throw Error("Somehow, module "+e+" didn't get stored in the flattened js file! You may need to rerun build/generate_about_tracing_contents.py")}else if("APPENDED"!=v[e]&&"RESOLVING"!=v[e]){v[e]="RESOLVING",g(n[e]||[],r+1);for(var t=p[e]||[],i=0;i<t.length;i++)k(t[i]);for(t=q[e]||[],i=0;i<t.length;i++){var s=t[i];w[s]||(h(s),w[s]="APPENDED")}h(e.replace(/\./g,"/")+".js"),v[name]="APPENDED"}})}function h(e){var t=document.createElement("script");t.src=l+"/"+e,t.type="text/javascript",t.defer=!0,t.async=!1,base.doc.head.appendChild(t)}function k(e){if(!window.FLATTENED&&!s[e]){s[e]=!0,e=e.replace(/\./g,"/")+".css",e=l+"/"+e;var t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),base.doc.head.appendChild(t)}}var l=".",m=!1,n={},p={},q={},t=!1,v={},w={},s={},r={};return{set moduleBasePath(e){d(e)},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 e=base;Object.defineProperty(global,"base",{get:function(){return Object.defineProperty(global,"base",{value:e}),e.initialize(),e},configurable:!0})}},require:g,requireStylesheet:k,requireRawScript:function(e){if(window.FLATTENED_RAW_SCRIPTS){if(!window.FLATTENED_RAW_SCRIPTS[e])throw Error("Somehow, "+e+" didn't get stored in the flattened js file! You may need to rerun build/generate_about_tracing_contents.py")}else if(!w[e])throw Error(e+" should already have been loaded. Did you forget to run build/generate_about_tracing_contents.py?")},requireTemplate:function(e){if(!window.FLATTENED&&!r[e]){r[e]=!0,e=e.replace(/\./g,"/")+".html",e=l+"/"+e;var t=document.createElement("link");t.setAttribute("rel","import"),t.setAttribute("href",e)}},exportTo:function(e,t){var i;i=e.split(".");for(var n,r=global;i.length&&(n=i.shift());)r=n in r?r[n]:r[n]={};i=r;try{var s=t()}catch(a){return console.log("While running exports for ",e,":"),void console.log(a.stack||a)}for(var o in s)(r=Object.getOwnPropertyDescriptor(s,o))&&Object.defineProperty(i,o,r)}}}(),base.initialize(),base.exportTo("tracing",function(){function e(e){for(var t=0,i=0;i<e.length;++i)t=(t+37*t+11*e.charCodeAt(i))%4294967295;return t}var t=[{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}],i=t.length-5,n=t.length,r=t.concat(t.map(function(e){var t;return t=240<=e.r&&240<=e.g&&240<=e.b?-.2:.45,{r:Math.min(255,e.r+Math.floor(e.r*t)),g:Math.min(255,e.g+Math.floor(e.g*t)),b:Math.min(255,e.b+Math.floor(e.b*t))}})).map(function(e){return"rgb("+e.r+","+e.g+","+e.b+")"}),s={};return{getColorPalette:function(){return r},getColorPaletteHighlightIdBoost:function(){return n},getColorIdByName:function(e){if("iowait"==e)return i;if("running"==e)return i+1;if("runnable"==e)return i+2;if("sleeping"==e)return i+3;if("UNKNOWN"==e)return i+4;throw Error("Unrecognized color ")+e},getStringHash:e,getStringColorId:function(t){if(void 0===s[t]){var n=e(t);s[t]=n%i}return s[t]}}}),base.exportTo("tracing.importer.linux_perf",function(){function e(e){this.importer=e,this.model=e.model}var t=[];return e.registerSubtype=function(e){t.push(e)},e.getSubtypeConstructors=function(){return t},e.prototype={__proto__:Object.prototype},{Parser:e}}),base.exportTo("base",function(){var e=1;return{GUID:{allocate:function(){return e++}}}}),base.require("base.guid"),base.exportTo("tracing.trace_model",function(){function e(e,t){this.guid_=base.GUID.allocate(),this.timestamp_=e,this.value_=t}function t(e,t){this.guid_=base.GUID.allocate(),this.name_=e,this.color_=t,this.timestamps_=[],this.samples_=[]}return e.prototype={__proto__:Object.prototype,get value(){return this.value_},set timestamp(e){this.timestamp_=e},toJSON:function(){for(var e={},t=Object.keys(this),i=0;i<t.length;i++){var n=t[i];"function"!=typeof this[n]&&(e[n]="parent"==n?this[n].guid:this[n])}return e}},t.prototype={__proto__:Object.prototype,toJSON:function(){for(var e={},t=Object.keys(this),i=0;i<t.length;i++){var n=t[i];"function"!=typeof this[n]&&(e[n]="parent"==n?this[n].guid:this[n])}return e},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(e){return this.samples_[e]},getTimestamp:function(e){return this.timestamps_[e]},addSample:function(t,i){this.timestamps_.push(t),this.samples_.push(new e(t,i))},getStatistics:function(e){for(var t=0,i=Number.MAX_VALUE,n=-Number.MAX_VALUE,r=0;r<e.length;++r)var s=this.getSample(e[r]).value,t=t+s,i=Math.min(s,i),n=Math.max(s,n);return{min:i,max:n,avg:t/e.length,start:this.getSample(e[0]).value,end:this.getSample(e.length-1).value}},shiftTimestampsForward:function(e){for(var t=0;t<this.timestamps_.length;++t)this.timestamps_[t]+=e,this.samples_[t].timestamp=this.timestamps_[t]}},{CounterSeries:t}}),base.require("tracing.importer.linux_perf.parser"),base.require("tracing.trace_model.counter_series"),base.exportTo("tracing.importer.linux_perf",function(){function e(t){i.call(this,t),t.registerEventHandler("tracing_mark_write:android",e.prototype.traceMarkWriteAndroidEvent.bind(this)),t.registerEventHandler("0:android",e.prototype.traceMarkWriteAndroidEvent.bind(this)),this.model_=t.model_,this.ppids_={}}function t(e){var t={};if(e){e=e.split(";");for(var i=0;i<e.length;++i){var n=e[i].split("=");n[0]&&(t[n.shift()]=n.join("="))}}return t}var i=tracing.importer.linux_perf.Parser;return e.prototype={__proto__:i.prototype,openAsyncSlice:function(e,t,i,n,r){t=new tracing.trace_model.AsyncSlice(t,i,tracing.getStringColorId(i),r),t.id=n,t.startThread=e,this.openAsyncSlices||(this.openAsyncSlices={}),this.openAsyncSlices[i+":"+n]=t},closeAsyncSlice:function(e,t,i,n){this.openAsyncSlices&&(t=t+":"+i,i=this.openAsyncSlices[t])&&(i.endThread=e,i.duration=n-i.start,i.startThread.asyncSliceGroup.push(i),i.subSlices=[new tracing.trace_model.Slice(i.category,i.title,i.colorId,i.start,i.args,i.duration)],delete this.openAsyncSlices[t])},traceMarkWriteAndroidEvent:function(e,i,n,r,s){switch(e=s.details.split("|"),e[0]){case"B":i=parseInt(e[1]);var a=e[4],o=e[2],c=this.model_.getOrCreateProcess(i).getOrCreateThread(n);if(c.name=customPIDMap.get(n),c.name||(c.name=s.threadName),!c.sliceGroup.isTimestampValidForBeginOrEnd(r))return this.model_.importErrors.push("Timestamps are moving backward."),!1;this.ppids_[n]=i,c.sliceGroup.beginSlice(a,o,r,t(e[3]));break;case"E":if(i=this.ppids_[n],void 0===i)break;if(c=this.model_.getOrCreateProcess(i).getOrCreateThread(n),!c.sliceGroup.openSliceCount)break;n=c.sliceGroup.endSlice(r),s=t(e[3]);for(a in s)void 0!==n.args[a]&&this.model_.importErrors.push("Both the B and E events of "+n.title+"provided values for argument "+a+". The value of the E event will be used."),n.args[a]=s[a];break;case"C":i=parseInt(e[1]);var o=e[2],l=parseInt(e[3]),a=e[4];n=this.model_.getOrCreateProcess(i).getOrCreateCounter(a,o),0===n.numSeries&&n.addSeries(new tracing.trace_model.CounterSeries(l,tracing.getStringColorId(n.name+".value"))),n.series.forEach(function(e){e.addSample(r,l)});break;case"S":i=parseInt(e[1]),o=e[2],e=parseInt(e[3]),c=this.model_.getOrCreateProcess(i).getOrCreateThread(n),c.name=s.threadName,this.ppids_[n]=i,this.openAsyncSlice(c,null,o,e,r);break;case"F":if(i=this.ppids_[n],void 0===i)break;c=this.model_.getOrCreateProcess(i).getOrCreateThread(n),o=e[2],e=parseInt(e[3]),this.closeAsyncSlice(c,o,e,r);break;default:return!1}return!0}},i.registerSubtype(e),{AndroidParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.require("tracing.trace_model.counter_series"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("memory_bus_usage",e.prototype.traceMarkWriteBusEvent.bind(this)),this.model_=i.model_,this.ppids_={}}var t=tracing.importer.linux_perf.Parser;return e.prototype={__proto__:t.prototype,traceMarkWriteBusEvent:function(e,t,i,n,r){i=/bus=(\S+) rw_bytes=(\d+) r_bytes=(\d+) w_bytes=(\d+) cycles=(\d+) ns=(\d+)/.exec(r.details),e=i[1],parseInt(i[2]),t=parseInt(i[3]),parseInt(i[4]),parseInt(i[5]),i=parseInt(i[6]);var s=1e9*t/i,s=s/1048576;return t=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,"bus "+e+" read"),0===t.numSeries&&t.addSeries(new tracing.trace_model.CounterSeries("value",tracing.getStringColorId(t.name+".value"))),t.series.forEach(function(e){e.addSample(n,s)}),t=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,"bus "+e+" write"),0===t.numSeries&&t.addSeries(new tracing.trace_model.CounterSeries("value",tracing.getStringColorId(t.name+".value"))),t.series.forEach(function(e){e.addSample(n,s)}),!0}},t.registerSubtype(e),{BusParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.require("tracing.trace_model.counter_series"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("clock_set_rate",e.prototype.traceMarkWriteClockEvent.bind(this)),this.model_=i.model_,this.ppids_={}}var t=tracing.importer.linux_perf.Parser;return e.prototype={__proto__:t.prototype,traceMarkWriteClockEvent:function(e,t,i,n,r){e=/(\S+) state=(\d+) cpu_id=(\d+)/.exec(r.details),t=e[1];var s=parseInt(e[2]);return e=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,t),0===e.numSeries&&e.addSeries(new tracing.trace_model.CounterSeries("value",tracing.getStringColorId(e.name+".value"))),e.series.forEach(function(e){e.addSample(n,s)}),!0}},t.registerSubtype(e),{ClockParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.exportTo("tracing.importer.linux_perf",function(){function e(t){i.call(this,t),t.registerEventHandler("cpufreq_interactive_up",e.prototype.cpufreqUpDownEvent.bind(this)),t.registerEventHandler("cpufreq_interactive_down",e.prototype.cpufreqUpDownEvent.bind(this)),t.registerEventHandler("cpufreq_interactive_already",e.prototype.cpufreqTargetEvent.bind(this)),t.registerEventHandler("cpufreq_interactive_notyet",e.prototype.cpufreqTargetEvent.bind(this)),t.registerEventHandler("cpufreq_interactive_setspeed",e.prototype.cpufreqTargetEvent.bind(this)),t.registerEventHandler("cpufreq_interactive_target",e.prototype.cpufreqTargetEvent.bind(this)),t.registerEventHandler("cpufreq_interactive_boost",e.prototype.cpufreqBoostUnboostEvent.bind(this)),t.registerEventHandler("cpufreq_interactive_unboost",e.prototype.cpufreqBoostUnboostEvent.bind(this))}function t(e){var t={};e=e.split(/\s+/);for(var i=e.length,n=0;i>n;n++){var r=e[n].split("=");t[r[0]]=parseInt(r[1])}return t}var i=tracing.importer.linux_perf.Parser;return e.prototype={__proto__:i.prototype,cpufreqSlice:function(e,t,i,n){i=this.importer.getOrCreatePseudoThread("cpufreq"),i.openSlice=t,e=new tracing.trace_model.Slice("",i.openSlice,tracing.getStringColorId(i.openSlice),e,n,0),i.thread.sliceGroup.pushSlice(e)},cpufreqBoostSlice:function(e,t,i){var n=this.importer.getOrCreatePseudoThread("cpufreq_boost");n.openSlice=t,e=new tracing.trace_model.Slice("",n.openSlice,tracing.getStringColorId(n.openSlice),e,i,0),n.thread.sliceGroup.pushSlice(e)},cpufreqUpDownEvent:function(e,i,n,r,s){return i=t(s.details),this.cpufreqSlice(r,e,i.cpu,i),!0},cpufreqTargetEvent:function(e,i,n,r,s){return i=t(s.details),this.cpufreqSlice(r,e,i.cpu,i),!0},cpufreqBoostUnboostEvent:function(e,t,i,n,r){return this.cpufreqBoostSlice(n,e,{type:r.details}),!0}},i.registerSubtype(e),{CpufreqParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("ext4_sync_file_enter",e.prototype.ext4SyncFileEnterEvent.bind(this)),i.registerEventHandler("ext4_sync_file_exit",e.prototype.ext4SyncFileExitEvent.bind(this)),i.registerEventHandler("block_rq_issue",e.prototype.blockRqIssueEvent.bind(this)),i.registerEventHandler("block_rq_complete",e.prototype.blockRqCompleteEvent.bind(this))}var t=tracing.importer.linux_perf.Parser;return e.prototype={__proto__:t.prototype,openAsyncSlice:function(e,t,i,n,r,s){i=this.importer.getOrCreateKernelThread(t+":"+i,n),e=new tracing.trace_model.AsyncSlice(t,s,tracing.getStringColorId(s),e),e.startThread=i.thread,i.openAsyncSlices||(i.openAsyncSlices={}),i.openAsyncSlices[r]=e},closeAsyncSlice:function(e,t,i,n,r,s){i=this.importer.getOrCreateKernelThread(t+":"+i,n),i.openAsyncSlices&&(n=i.openAsyncSlices[r])&&(n.duration=e-n.start,n.args=s,n.endThread=i.thread,n.subSlices=[new tracing.trace_model.Slice(t,n.title,n.colorId,n.start,n.args,n.duration)],i.thread.asyncSliceGroup.push(n),delete i.openAsyncSlices[r])},ext4SyncFileEnterEvent:function(e,t,i,n,r){return(e=/dev (\d+,\d+) ino (\d+) parent (\d+) datasync (\d+)/.exec(r.details))?(t=e[1],i=parseInt(e[2]),this.openAsyncSlice(n,"ext4",r.threadName,r.pid,t+"-"+i,1==e[4]?"fdatasync":"fsync"),!0):!1},ext4SyncFileExitEvent:function(e,t,i,n,r){return(i=/dev (\d+,\d+) ino (\d+) ret (\d+)/.exec(r.details))?(e=i[1],t=parseInt(i[2]),i=parseInt(i[3]),this.closeAsyncSlice(n,"ext4",r.threadName,r.pid,e+"-"+t,{device:e,inode:t,error:i}),!0):!1},blockRqIssueEvent:function(e,t,i,n,r){var s=/(\d+,\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? \d+ \(.*\) (\d+) \+ (\d+) \[.*\]/.exec(r.details);if(!s)return!1;switch(s[3]){case"D":e="discard";break;case"W":e="write";break;case"R":e="read";break;case"N":e="none";break;default:e="unknown"}return s[2]&&(e+=" flush"),"F"==s[4]&&(e+=" fua"),"A"==s[5]&&(e+=" ahead"),"S"==s[6]&&(e+=" sync"),"M"==s[7]&&(e+=" meta"),t=s[1],i=parseInt(s[8]),s=parseInt(s[9]),this.openAsyncSlice(n,"block",r.threadName,r.pid,t+"-"+i+"-"+s,e),!0},blockRqCompleteEvent:function(e,t,i,n,r){var s=/(\d+,\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? \(.*\) (\d+) \+ (\d+) \[(.*)\]/.exec(r.details);return s?(e=s[1],t=parseInt(s[8]),i=parseInt(s[9]),s=parseInt(s[10]),this.closeAsyncSlice(n,"block",r.threadName,r.pid,e+"-"+t+"-"+i,{device:e,sector:t,numSectors:i,error:s}),!0):!1}},t.registerSubtype(e),{DiskParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("drm_vblank_event",e.prototype.vblankEvent.bind(this))}var t=tracing.importer.linux_perf.Parser;return e.prototype={__proto__:t.prototype,drmVblankSlice:function(e,t,i){var n=this.importer.getOrCreatePseudoThread("drm_vblank");n.openSlice=t,e=new tracing.trace_model.Slice("",n.openSlice,tracing.getStringColorId(n.openSlice),e,i,0),n.thread.sliceGroup.pushSlice(e)},vblankEvent:function(e,t,i,n,r){return(t=/crtc=(\d+), seq=(\d+)/.exec(r.details))?(e=parseInt(t[1]),t=parseInt(t[2]),this.drmVblankSlice(n,"vblank:"+e,{crtc:e,seq:t}),!0):!1}},t.registerSubtype(e),{DrmParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("exynos_flip_request",e.prototype.flipEvent.bind(this)),i.registerEventHandler("exynos_flip_complete",e.prototype.flipEvent.bind(this)),i.registerEventHandler("exynos_busfreq_target_int",e.prototype.busfreqTargetIntEvent.bind(this)),i.registerEventHandler("exynos_busfreq_target_mif",e.prototype.busfreqTargetMifEvent.bind(this))}var t=tracing.importer.linux_perf.Parser;return e.prototype={__proto__:t.prototype,exynosFlipOpenSlice:function(e,t){var i=this.importer.getOrCreatePseudoThread("exynos_flip");i.openSliceTS=e,i.openSlice="flip:"+t},exynosFlipCloseSlice:function(e,t){var i=this.importer.getOrCreatePseudoThread("exynos_flip");if(i.openSlice){var n=new tracing.trace_model.Slice("",i.openSlice,tracing.getStringColorId(i.openSlice),i.openSliceTS,t,e-i.openSliceTS);i.thread.sliceGroup.pushSlice(n)}i.openSlice=void 0},flipEvent:function(e,t,i,n,r){return(t=/pipe=(\d+)/.exec(r.details))?(t=parseInt(t[1]),"exynos_flip_request"==e?this.exynosFlipOpenSlice(n,t):this.exynosFlipCloseSlice(n,{pipe:t}),!0):!1},exynosBusfreqSample:function(e,t,i){e=this.importer.getOrCreateCpuState(0).cpu.getOrCreateCounter("",e),0===e.numSeries&&e.addSeries(new tracing.trace_model.CounterSeries("frequency",tracing.getStringColorId(e.name+".frequency"))),e.series.forEach(function(e){e.addSample(t,i)})},busfreqTargetIntEvent:function(e,t,i,n,r){return(e=/frequency=(\d+)/.exec(r.details))?(this.exynosBusfreqSample("INT Frequency",n,parseInt(e[1])),!0):!1},busfreqTargetMifEvent:function(e,t,i,n,r){return(e=/frequency=(\d+)/.exec(r.details))?(this.exynosBusfreqSample("MIF Frequency",n,parseInt(e[1])),!0):!1}},t.registerSubtype(e),{ExynosParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("tracing_mark_write:log",e.prototype.logEvent.bind(this)),i.registerEventHandler("tracing_mark_write:SyncInterpret",e.prototype.syncEvent.bind(this)),i.registerEventHandler("tracing_mark_write:HandleTimer",e.prototype.timerEvent.bind(this))}var t=tracing.importer.linux_perf.Parser;return e.prototype={__proto__:t.prototype,gestureOpenSlice:function(e,t,i){this.importer.getOrCreatePseudoThread("gesture").thread.sliceGroup.beginSlice("touchpad_gesture",e,t,i)},gestureCloseSlice:function(e,t){var i=this.importer.getOrCreatePseudoThread("gesture").thread;if(i.sliceGroup.openSliceCount){var n=i.sliceGroup.mostRecentlyOpenedPartialSlice;n.title!=e?this.importer.importError("Titles do not match. Title is "+n.title+" in openSlice, and is "+e+" in endSlice"):i.sliceGroup.endSlice(t)}},logEvent:function(e,t,i,n,r){switch(e=/^\s*(\w+):\s*(\w+)$/.exec(r.details),e[1]){case"start":this.gestureOpenSlice("GestureLog",n,{name:e[2]});
+break;case"end":this.gestureCloseSlice("GestureLog",n)}return!0},syncEvent:function(e,t,i,n,r){switch(e=/^\s*(\w+):\s*(\w+)$/.exec(r.details),e[1]){case"start":this.gestureOpenSlice("SyncInterpret",n,{interpreter:e[2]});break;case"end":this.gestureCloseSlice("SyncInterpret",n)}return!0},timerEvent:function(e,t,i,n,r){switch(e=/^\s*(\w+):\s*(\w+)$/.exec(r.details),e[1]){case"start":this.gestureOpenSlice("HandleTimer",n,{interpreter:e[2]});break;case"end":this.gestureCloseSlice("HandleTimer",n)}return!0}},t.registerSubtype(e),{GestureParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("i915_gem_object_create",e.prototype.gemObjectCreateEvent.bind(this)),i.registerEventHandler("i915_gem_object_bind",e.prototype.gemObjectBindEvent.bind(this)),i.registerEventHandler("i915_gem_object_unbind",e.prototype.gemObjectBindEvent.bind(this)),i.registerEventHandler("i915_gem_object_change_domain",e.prototype.gemObjectChangeDomainEvent.bind(this)),i.registerEventHandler("i915_gem_object_pread",e.prototype.gemObjectPreadWriteEvent.bind(this)),i.registerEventHandler("i915_gem_object_pwrite",e.prototype.gemObjectPreadWriteEvent.bind(this)),i.registerEventHandler("i915_gem_object_fault",e.prototype.gemObjectFaultEvent.bind(this)),i.registerEventHandler("i915_gem_object_clflush",e.prototype.gemObjectDestroyEvent.bind(this)),i.registerEventHandler("i915_gem_object_destroy",e.prototype.gemObjectDestroyEvent.bind(this)),i.registerEventHandler("i915_gem_ring_dispatch",e.prototype.gemRingDispatchEvent.bind(this)),i.registerEventHandler("i915_gem_ring_flush",e.prototype.gemRingFlushEvent.bind(this)),i.registerEventHandler("i915_gem_request",e.prototype.gemRequestEvent.bind(this)),i.registerEventHandler("i915_gem_request_add",e.prototype.gemRequestEvent.bind(this)),i.registerEventHandler("i915_gem_request_complete",e.prototype.gemRequestEvent.bind(this)),i.registerEventHandler("i915_gem_request_retire",e.prototype.gemRequestEvent.bind(this)),i.registerEventHandler("i915_gem_request_wait_begin",e.prototype.gemRequestEvent.bind(this)),i.registerEventHandler("i915_gem_request_wait_end",e.prototype.gemRequestEvent.bind(this)),i.registerEventHandler("i915_gem_ring_wait_begin",e.prototype.gemRingWaitEvent.bind(this)),i.registerEventHandler("i915_gem_ring_wait_end",e.prototype.gemRingWaitEvent.bind(this)),i.registerEventHandler("i915_reg_rw",e.prototype.regRWEvent.bind(this)),i.registerEventHandler("i915_flip_request",e.prototype.flipEvent.bind(this)),i.registerEventHandler("i915_flip_complete",e.prototype.flipEvent.bind(this))}var t=tracing.importer.linux_perf.Parser;return e.prototype={__proto__:t.prototype,i915FlipOpenSlice:function(e,t,i){var n=this.importer.getOrCreatePseudoThread("i915_flip");n.openSliceTS=e,n.openSlice="flip:"+t+"/"+i},i915FlipCloseSlice:function(e,t){var i=this.importer.getOrCreatePseudoThread("i915_flip");if(i.openSlice){var n=new tracing.trace_model.Slice("",i.openSlice,tracing.getStringColorId(i.openSlice),i.openSliceTS,t,e-i.openSliceTS);i.thread.sliceGroup.pushSlice(n)}i.openSlice=void 0},i915GemObjectSlice:function(e,t,i,n){var r=this.importer.getOrCreatePseudoThread("i915_gem");r.openSlice=t+":"+i,e=new tracing.trace_model.Slice("",r.openSlice,tracing.getStringColorId(r.openSlice),e,n,0),r.thread.sliceGroup.pushSlice(e)},i915GemRingSlice:function(e,t,i,n,r){var s=this.importer.getOrCreatePseudoThread("i915_gem_ring");s.openSlice=t+":"+i+"."+n,e=new tracing.trace_model.Slice("",s.openSlice,tracing.getStringColorId(s.openSlice),e,r,0),s.thread.sliceGroup.pushSlice(e)},i915RegSlice:function(e,t,i,n){var r=this.importer.getOrCreatePseudoThread("i915_reg");r.openSlice=t+":"+i,e=new tracing.trace_model.Slice("",r.openSlice,tracing.getStringColorId(r.openSlice),e,n,0),r.thread.sliceGroup.pushSlice(e)},gemObjectCreateEvent:function(e,t,i,n,r){return(i=/obj=(\w+), size=(\d+)/.exec(r.details))?(t=i[1],i=parseInt(i[2]),this.i915GemObjectSlice(n,e,t,{obj:t,size:i}),!0):!1},gemObjectBindEvent:function(e,t,i,n,r){return(r=/obj=(\w+), offset=(\w+), size=(\d+)/.exec(r.details))?(t=r[1],i=r[2],r=parseInt(r[3]),this.i915ObjectGemSlice(n,e+":"+t,{obj:t,offset:i,size:r}),!0):!1},gemObjectChangeDomainEvent:function(e,t,i,n,r){return(t=/obj=(\w+), read=(\w+=>\w+), write=(\w+=>\w+)/.exec(r.details))?(i=t[1],this.i915GemObjectSlice(n,e,i,{obj:i,read:t[2],write:t[3]}),!0):!1},gemObjectPreadWriteEvent:function(e,t,i,n,r){return(r=/obj=(\w+), offset=(\d+), len=(\d+)/.exec(r.details))?(t=r[1],i=parseInt(r[2]),r=parseInt(r[3]),this.i915GemObjectSlice(n,e,t,{obj:t,offset:i,len:r}),!0):!1},gemObjectFaultEvent:function(e,t,i,n,r){return(r=/obj=(\w+), (\w+) index=(\d+)/.exec(r.details))?(t=r[1],i=r[2],r=parseInt(r[3]),this.i915GemObjectSlice(n,e,t,{obj:t,type:i,index:r}),!0):!1},gemObjectDestroyEvent:function(e,t,i,n,r){return(t=/obj=(\w+)/.exec(r.details))?(t=t[1],this.i915GemObjectSlice(n,e,t,{obj:t}),!0):!1},gemRingDispatchEvent:function(e,t,i,n,r){return(r=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(r.details))?(t=parseInt(r[1]),i=parseInt(r[2]),r=parseInt(r[3]),this.i915GemRingSlice(n,e,t,i,{dev:t,ring:i,seqno:r}),!0):!1},gemRingFlushEvent:function(e,t,i,n,r){return(t=/dev=(\d+), ring=(\w+), invalidate=(\w+), flush=(\w+)/.exec(r.details))?(i=parseInt(t[1]),r=parseInt(t[2]),this.i915GemRingSlice(n,e,i,r,{dev:i,ring:r,invalidate:t[3],flush:t[4]}),!0):!1},gemRequestEvent:function(e,t,i,n,r){return(r=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(r.details))?(t=parseInt(r[1]),i=parseInt(r[2]),r=parseInt(r[3]),this.i915GemRingSlice(n,e,t,i,{dev:t,ring:i,seqno:r}),!0):!1},gemRingWaitEvent:function(e,t,i,n,r){return(i=/dev=(\d+), ring=(\d+)/.exec(r.details))?(t=parseInt(i[1]),i=parseInt(i[2]),this.i915GemRingSlice(n,e,t,i,{dev:t,ring:i}),!0):!1},regRWEvent:function(e,t,i,n,r){return(e=/(\w+) reg=(\w+), len=(\d+), val=(\(\w+, \w+\))/.exec(r.details))?(t=e[1],i=e[2],this.i915RegSlice(n,t,i,{rw:t,reg:i,len:e[3],data:e[3]}),!0):!1},flipEvent:function(e,t,i,n,r){return(i=/plane=(\d+), obj=(\w+)/.exec(r.details))?(t=parseInt(i[1]),i=i[2],"i915_flip_request"==e?this.i915FlipOpenSlice(n,i,t):this.i915FlipCloseSlice(n,{obj:i,plane:t}),!0):!1}},t.registerSubtype(e),{I915Parser:e}}),base.require("tracing.importer.linux_perf.parser"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("graph_ent",e.prototype.traceKernelFuncEnterEvent.bind(this)),i.registerEventHandler("graph_ret",e.prototype.traceKernelFuncReturnEvent.bind(this)),this.model_=i.model_,this.ppids_={}}var t=tracing.importer.linux_perf.Parser,i=/func=(.+)/;return e.prototype={__proto__:t.prototype,traceKernelFuncEnterEvent:function(e,t,n,r,s){return e=i.exec(s.details),e&&void 0!==s.tgid?(t=parseInt(s.tgid),e=e[1],n=this.model_.getOrCreateProcess(t).getOrCreateThread(n),n.name=s.threadName,s=n.kernelSliceGroup,s.isTimestampValidForBeginOrEnd(r)?(s.beginSlice(null,e,r,{}),!0):(this.model_.importErrors.push("Timestamps are moving backward."),!1)):!1},traceKernelFuncReturnEvent:function(e,t,i,n,r){return void 0===r.tgid?!1:(e=parseInt(r.tgid),i=this.model_.getOrCreateProcess(e).getOrCreateThread(i),i.name=r.threadName,r=i.kernelSliceGroup,r.isTimestampValidForBeginOrEnd(n)?(0<r.openSliceCount&&r.endSlice(n),!0):(this.model_.importErrors.push("Timestamps are moving backward."),!1))}},t.registerSubtype(e),{KernelFuncParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("mali_dvfs_event",e.prototype.dvfsEventEvent.bind(this)),i.registerEventHandler("mali_dvfs_set_clock",e.prototype.dvfsSetClockEvent.bind(this)),i.registerEventHandler("mali_dvfs_set_voltage",e.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 n=0;7>n;n++){var r="JS"+n,s="mali_hwc_"+r;this.addJMCounter(s+"_JOBS",r+" Jobs"),this.addJMCounter(s+"_TASKS",r+" Tasks"),this.addJMCycles(s+"_ACTIVE",r+" Active"),this.addJMCycles(s+"_WAIT_READ",r+" Wait Read"),this.addJMCycles(s+"_WAIT_ISSUE",r+" Wait Issue"),this.addJMCycles(s+"_WAIT_DEPEND",r+" Wait Depend"),this.addJMCycles(s+"_WAIT_FINISH",r+" 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"),i.registerEventHandler("tracing_mark_write:mali_driver",e.prototype.maliDDKEvent.bind(this)),this.model_=i.model_}var t=tracing.importer.linux_perf.Parser;return e.prototype={__proto__:t.prototype,maliDDKOpenSlice:function(e,t,i,n,r){e=this.importer.model_.getOrCreateProcess(e).getOrCreateThread(t),n=/^([\w\d_]*)(?:\(\))?:?\s*(.*)$/.exec(n),e.sliceGroup.beginSlice("gpu-driver",n[1],i,{args:n[2],blockinfo:r})},maliDDKCloseSlice:function(e,t,i){e=this.importer.model_.getOrCreateProcess(e).getOrCreateThread(t),e.sliceGroup.openSliceCount&&e.sliceGroup.endSlice(i)},autoDetectLineRE:function(e){var t=/^\s*\(([\w\-]*)\)\s*(\w+):\s*([\w\\\/\.\-]*@\d*):?\s*(.*)$/;return t.test(e)?t:(t=/^s*()(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/,t.test(e)?t:null)},lineRE:null,maliDDKEvent:function(e,t,i,n,r){if(null==this.lineRE&&(this.lineRE=this.autoDetectLineRE(r.details),null==this.lineRE))return!1;switch(e=this.lineRE.exec(r.details),t=""===e[1]?"mali":e[1],e[2]){case"cros_trace_print_enter":this.maliDDKOpenSlice(i,t,n,e[4],e[3]);break;case"cros_trace_print_exit":this.maliDDKCloseSlice(i,t,n,[],e[3])}return!0},dvfsSample:function(e,t,i,n){var r=parseInt(n);e=this.model_.getOrCreateProcess(0).getOrCreateCounter("DVFS",e),0===e.numSeries&&e.addSeries(new tracing.trace_model.CounterSeries(t,tracing.getStringColorId(e.name))),e.series.forEach(function(e){e.addSample(i,r)})},dvfsEventEvent:function(e,t,i,n,r){return(e=/utilization=(\d+)/.exec(r.details))?(this.dvfsSample("DVFS Utilization","utilization",n,e[1]),!0):!1},dvfsSetClockEvent:function(e,t,i,n,r){return(e=/frequency=(\d+)/.exec(r.details))?(this.dvfsSample("DVFS Frequency","frequency",n,e[1]),!0):!1},dvfsSetVoltageEvent:function(e,t,i,n,r){return(e=/voltage=(\d+)/.exec(r.details))?(this.dvfsSample("DVFS Voltage","voltage",n,e[1]),!0):!1},hwcSample:function(e,t,i,n,r){if(r=/val=(\d+)/.exec(r.details),!r)return!1;var s=parseInt(r[1]);return e=this.model_.getOrCreateProcess(0).getOrCreateCounter(e,t),0===e.numSeries&&e.addSeries(new tracing.trace_model.CounterSeries(i,tracing.getStringColorId(e.name))),e.series.forEach(function(e){e.addSample(n,s)}),!0},jmSample:function(e,t,i,n){return this.hwcSample("mali:jm","JM: "+e,t,i,n)},addJMCounter:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.jmSample(t,"count",r,s)}.bind(this))},addJMCycles:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.jmSample(t,"cycles",r,s)}.bind(this))},tilerSample:function(e,t,i,n){return this.hwcSample("mali:tiler","Tiler: "+e,t,i,n)},addTilerCounter:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.tilerSample(t,"count",r,s)}.bind(this))},addTilerCycles:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.tilerSample(t,"cycles",r,s)}.bind(this))},fragSample:function(e,t,i,n){return this.hwcSample("mali:fragment","Fragment: "+e,t,i,n)},addFragCounter:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.fragSample(t,"count",r,s)}.bind(this))},addFragCycles:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.fragSample(t,"cycles",r,s)}.bind(this))},computeSample:function(e,t,i,n){return this.hwcSample("mali:compute","Compute: "+e,t,i,n)},addComputeCounter:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.computeSample(t,"count",r,s)}.bind(this))},addComputeCycles:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.computeSample(t,"cycles",r,s)}.bind(this))},addTripipeCycles:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.hwcSample("mali:shader","Tripipe: "+t,"cycles",r,s)}.bind(this))},arithSample:function(e,t,i,n){return this.hwcSample("mali:arith","Arith: "+e,t,i,n)},addArithCounter:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.arithSample(t,"count",r,s)}.bind(this))},addArithCycles:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.arithSample(t,"cycles",r,s)}.bind(this))},addLSCounter:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.hwcSample("mali:ls","LS: "+t,"count",r,s)}.bind(this))},textureSample:function(e,t,i,n){return this.hwcSample("mali:texture","Texture: "+e,t,i,n)},addTexCounter:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.textureSample(t,"count",r,s)}.bind(this))},addLSCCounter:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.hwcSample("mali:lsc","LSC: "+t,"count",r,s)}.bind(this))},addAXICounter:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.hwcSample("mali:axi","AXI: "+t,"count",r,s)}.bind(this))},mmuSample:function(e,t,i,n){return this.hwcSample("mali:mmu","MMU: "+e,t,i,n)},addMMUCounter:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.mmuSample(t,"count",r,s)}.bind(this))},addMMUCycles:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.mmuSample(t,"cycles",r,s)}.bind(this))},l2Sample:function(e,t,i,n){return this.hwcSample("mali:l2","L2: "+e,t,i,n)},addL2Counter:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.l2Sample(t,"count",r,s)}.bind(this))},addL2Cycles:function(e,t){this.importer.registerEventHandler(e,function(e,i,n,r,s){return this.l2Sample(t,"cycles",r,s)}.bind(this))}},t.registerSubtype(e),{MaliParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.require("tracing.trace_model.counter_series"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("power_start",e.prototype.powerStartEvent.bind(this)),i.registerEventHandler("power_frequency",e.prototype.powerFrequencyEvent.bind(this)),i.registerEventHandler("cpu_frequency",e.prototype.cpuFrequencyEvent.bind(this)),i.registerEventHandler("cpu_idle",e.prototype.cpuIdleEvent.bind(this))}var t=tracing.importer.linux_perf.Parser;return e.prototype={__proto__:t.prototype,cpuStateSlice:function(e,t,i,n){t=this.importer.getOrCreateCpuState(t),"1"!=i?this.importer.importError("Don't understand power_start events of type "+i):(i=t.cpu.getOrCreateCounter("","C-State"),0===i.numSeries&&i.addSeries(new tracing.trace_model.CounterSeries("state",tracing.getStringColorId(i.name+".state"))),i.series.forEach(function(t){t.addSample(e,n)}))},cpuIdleSlice:function(e,t,i){t=this.importer.getOrCreateCpuState(t).cpu.getOrCreateCounter("","C-State"),0===t.numSeries&&t.addSeries(new tracing.trace_model.CounterSeries("state",tracing.getStringColorId(t.name)));var n=4294967295!=i?i:0;t.series.forEach(function(t){t.addSample(e,n)})},cpuFrequencySlice:function(e,t,i){t=this.importer.getOrCreateCpuState(t).cpu.getOrCreateCounter("","Clock Frequency"),0===t.numSeries&&t.addSeries(new tracing.trace_model.CounterSeries("state",tracing.getStringColorId(t.name+".state"))),t.series.forEach(function(t){t.addSample(e,i)})},powerStartEvent:function(e,t,i,n,r){return(e=/type=(\d+) state=(\d) cpu_id=(\d)+/.exec(r.details))?(t=parseInt(e[3]),i=parseInt(e[2]),this.cpuStateSlice(n,t,e[1],i),!0):!1},powerFrequencyEvent:function(e,t,i,n,r){return(t=/type=(\d+) state=(\d+) cpu_id=(\d)+/.exec(r.details))?(e=parseInt(t[3]),t=parseInt(t[2]),this.cpuFrequencySlice(n,e,t),!0):!1},cpuFrequencyEvent:function(e,t,i,n,r){return(t=/state=(\d+) cpu_id=(\d)+/.exec(r.details))?(e=parseInt(t[2]),t=parseInt(t[1]),this.cpuFrequencySlice(n,e,t),!0):!1},cpuIdleEvent:function(e,t,i,n,r){return(t=/state=(\d+) cpu_id=(\d)+/.exec(r.details))?(e=parseInt(t[2]),t=parseInt(t[1]),this.cpuIdleSlice(n,e,t),!0):!1}},t.registerSubtype(e),{PowerParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("sched_switch",e.prototype.schedSwitchEvent.bind(this)),i.registerEventHandler("sched_wakeup",e.prototype.schedWakeupEvent.bind(this))}var t=tracing.importer.linux_perf.Parser,i={},n=RegExp("prev_comm=(.+) prev_pid=(\\d+) prev_prio=(\\d+) prev_state=(\\S\\+?|\\S\\|\\S) ==> next_comm=(.+) next_pid=(\\d+) next_prio=(\\d+)");i.schedSwitchRE=n;var r=/comm=(.+) pid=(\d+) prio=(\d+) success=(\d+) target_cpu=(\d+)/;return i.schedWakeupRE=r,e.prototype={__proto__:t.prototype,schedSwitchEvent:function(e,t,i,r,s){var a=n.exec(s.details);return a?(e=a[4],i=a[5],s=parseInt(a[6]),a=parseInt(a[7]),customPIDMap.put(s,i),this.importer.getOrCreateCpuState(t).switchRunningLinuxPid(this.importer,e,r,s,i,a),!0):!1},schedWakeupEvent:function(e,t,i,n,s){return(s=r.exec(s.details))?(e=i,t=s[1],i=parseInt(s[2]),s=parseInt(s[3]),this.importer.markPidRunnable(n,i,t,s,e),!0):!1}},t.registerSubtype(e),{SchedParser:e,_SchedParserTestExports:i}}),base.require("tracing.importer.linux_perf.parser"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("sync_timeline",e.prototype.timelineEvent.bind(this)),i.registerEventHandler("sync_wait",e.prototype.syncWaitEvent.bind(this)),i.registerEventHandler("sync_pt",e.prototype.syncPtEvent.bind(this)),this.model_=i.model_}var t=tracing.importer.linux_perf.Parser,i=/name=(\S+) value=(\S*)/,n=/(\S+) name=(\S+) state=(\d+)/,r=/name=(\S+) value=(\S*)/;return e.prototype={__proto__:t.prototype,timelineEvent:function(e,t,n,r,s){return(e=i.exec(s.details))?(t=this.importer.getOrCreatePseudoThread(e[1]),void 0!==t.lastActiveTs&&(n=r-t.lastActiveTs,s=t.lastActiveValue,void 0==s&&(s=" "),n=new tracing.trace_model.Slice("",s,tracing.getStringColorId(s),t.lastActiveTs,{},n),t.thread.sliceGroup.pushSlice(n)),t.lastActiveTs=r,t.lastActiveValue=e[2],!0):!1},syncWaitEvent:function(e,t,i,r,s){if(e=n.exec(s.details),!e||void 0===s.tgid)return!1;if(t=parseInt(s.tgid),i=this.model_.getOrCreateProcess(t).getOrCreateThread(i),i.name=s.threadName,s=i.kernelSliceGroup,!s.isTimestampValidForBeginOrEnd(r))return this.model_.importErrors.push("Timestamps are moving backward."),!1;if(i='fence_wait("'+e[2]+'")',"begin"==e[1])s.beginSlice(null,i,r,{"Start state":e[3]});else{if("end"!=e[1])return!1;0<s.openSliceCount&&s.endSlice(r)}return!0},syncPtEvent:function(e,t,i,n,s){return r.exec(s.details)?!0:!1}},t.registerSubtype(e),{SyncParser:e}}),base.require("tracing.importer.linux_perf.parser"),base.exportTo("tracing.importer.linux_perf",function(){function e(i){t.call(this,i),i.registerEventHandler("workqueue_execute_start",e.prototype.executeStartEvent.bind(this)),i.registerEventHandler("workqueue_execute_end",e.prototype.executeEndEvent.bind(this)),i.registerEventHandler("workqueue_queue_work",e.prototype.executeQueueWork.bind(this)),i.registerEventHandler("workqueue_activate_work",e.prototype.executeActivateWork.bind(this))}var t=tracing.importer.linux_perf.Parser,i=/work struct (.+): function (\S+)/,n=/work struct (.+)/;return e.prototype={__proto__:t.prototype,executeStartEvent:function(e,t,n,r,s){return(e=i.exec(s.details))?(n=this.importer.getOrCreateKernelThread(s.threadName,n,n),n.openSliceTS=r,n.openSlice=e[2],!0):!1},executeEndEvent:function(e,t,i,r,s){return n.exec(s.details)?(e=this.importer.getOrCreateKernelThread(s.threadName,i,i),e.openSlice&&(r=new tracing.trace_model.Slice("",e.openSlice,tracing.getStringColorId(e.openSlice),e.openSliceTS,{},r-e.openSliceTS),e.thread.sliceGroup.pushSlice(r)),e.openSlice=void 0,!0):!1},executeQueueWork:function(){return!0},executeActivateWork:function(){return!0}},t.registerSubtype(e),{WorkqueueParser:e}}),base.exportTo("base",function(){function e(){}e.prototype={addEventListener:function(e,t){if(this.listeners_||(this.listeners_=Object.create(null)),e in this.listeners_){var i=this.listeners_[e];0>i.indexOf(t)&&i.push(t)}else this.listeners_[e]=[t]},removeEventListener:function(e,t){if(this.listeners_&&e in this.listeners_){var i=this.listeners_[e],n=i.indexOf(t);n>=0&&(1==i.length?delete this.listeners_[e]:i.splice(n,1))}},dispatchEvent:function(e){if(!this.listeners_)return!0;var t=this;e.__defineGetter__("target",function(){return t}),e.preventDefault=function(){this.returnValue=!1};var i=e.type,n=0;if(i in this.listeners_)for(var r,i=this.listeners_[i].concat(),s=0;r=i[s];s++)n=r.handleEvent?n|!1===r.handleEvent.call(r,e):n|!1===r.call(this,e);return!n&&e.returnValue},hasEventListener:function(e){return void 0!==this.listeners_[e]}};var t={decorate:function(e){for(var i in t)if("decorate"!=i){var n=t[i];"function"==typeof n&&(e[i]=n)}e.listenerCounts_={}},addEventListener:function(e,t,i){this.__proto__.addEventListener.call(this,e,t,i),void 0===this.listenerCounts_[e]&&(this.listenerCounts_[e]=0),this.listenerCounts_[e]++},removeEventListener:function(e,t,i){this.__proto__.removeEventListener.call(this,e,t,i),this.listenerCounts_[e]--},hasEventListener:function(e){return 0<this.listenerCounts_[e]}};return{EventTarget:e,EventTargetHelper:t}}),base.require("base.event_target"),base.exportTo("base",function(){function e(e,t,i){var n=base.doc.createEvent("Event");return n.initEvent(e,!!t,!!i),n.__proto__=global.Event.prototype,n}return e.prototype={__proto__:global.Event.prototype},{Event:e,dispatchSimpleEvent:function(t,i,n,r){return i=new e(i,n,r),t.dispatchEvent(i)}}}),base.exportTo("base",function(){function e(){this.isEmpty_=!0,this.max_=this.min_=void 0}return e.prototype={__proto__:Object.prototype,reset:function(){this.isEmpty_=!0,this.max_=this.min_=void 0},get isEmpty(){return this.isEmpty_},addRange:function(e){e.isEmpty||(this.addValue(e.min),this.addValue(e.max))},addValue:function(e){this.isEmpty_?(this.min_=this.max_=e,this.isEmpty_=!1):(this.max_=Math.max(this.max_,e),this.min_=Math.min(this.min_,e))},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.5*(this.min_+this.max_)}},e.compareByMinTimes=function(e,t){return e.isEmpty||t.isEmpty?e.isEmpty&&!t.isEmpty?-1:!e.isEmpty&&t.isEmpty?1:0:e.min_-t.min_},{Range:e}}),base.exportTo("tracing",function(){function e(){}function t(e){this.text_=e.toLowerCase()}function i(e){this.categories_={},e=e||[];for(var t=0;t<e.length;t++)this.addCategory(e[t])}return e.prototype={__proto__:Object.prototype,matchCounter:function(){return!0},matchCpu:function(){return!0},matchProcess:function(){return!0},matchSlice:function(){return!0},matchThread:function(){return!0}},t.prototype={__proto__:e.prototype,matchCounter:function(e){return 0===this.text_.length||void 0===e.name?!1:-1!==e.name.toLowerCase().indexOf(this.text_)},matchSlice:function(e){return 0===this.text_.length||void 0===e.title?!1:-1!==e.title.toLowerCase().indexOf(this.text_)}},i.prototype={__proto__:e.prototype,addCategory:function(e){this.categories_[e]=!0},matchCounter:function(e){return e.category?!this.categories_[e.category]:!0},matchSlice:function(e){return e.category?!this.categories_[e.category]:!0}},{filterCounterArray:function(e,t){if(void 0===e)return t;for(var i=[],n=0;n<t.length;++n)e.matchCounter(t[n])&&i.push(t[n]);return i},filterSliceArray:function(e,t){if(void 0===e)return t;
+for(var i=[],n=0;n<t.length;++n)e.matchSlice(t[n])&&i.push(t[n]);return i},Filter:e,TitleFilter:t,CategoryFilter:i}}),base.require("base.guid"),base.require("base.range"),base.require("tracing.trace_model.counter_series"),base.exportTo("tracing.trace_model",function(){function e(e,t,i,n){this.guid_=base.GUID.allocate(),this.parent=e,this.id=t,this.category=i||"",this.name=n,this.series_=[],this.bounds=new base.Range}return e.prototype={__proto__:Object.prototype,get guid(){return this.guid_},toJSON:function(){for(var e={},t=Object.keys(this),i=0;i<t.length;i++){var n=t[i];"function"!=typeof this[n]&&(e[n]="parent"==n?this[n].guid:this[n])}return e},set timestamps(e){throw Error("Bad counter API. No cookie.")},set seriesNames(e){throw Error("Bad counter API. No cookie.")},set seriesColors(e){throw Error("Bad counter API. No cookie.")},set samples(e){throw Error("Bad counter API. No cookie.")},addSeries:function(e){this.series_.push(e)},getSeries:function(e){return this.series_[e]},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(e){e.sort();var t=[];return this.series_.forEach(function(i){t.push(i.getStatistics(e))}),t},shiftTimestampsForward:function(e){for(var t=0;t<this.series_.length;++t)this.series_[t].shiftTimestampsForward(e)},updateBounds:function(){if(this.totals=[],this.maxTotal=0,this.bounds.reset(),0!==this.series_.length){var e=this.series_[0],t=this.series_[this.series_.length-1];this.bounds.addValue(e.getTimestamp(0)),this.bounds.addValue(t.getTimestamp(t.length-1)),this.maxTotal=-1/0;for(var i=0;i<e.length;++i){var n=0;this.series_.forEach(function(e){n+=e.getSample(i).value,this.totals.push(n)}.bind(this)),this.maxTotal=Math.max(n,this.maxTotal)}}}},e.compare=function(e,t){var i=e.parent.compareTo(t);return 0!=i?i:(i=e.name.localeCompare(t.name),0==i?e.tid-t.tid:i)},{Counter:e}}),base.exportTo("tracing.trace_model",function(){function e(e,t,i,n,r){this.category=e||"",this.title=t,this.colorId=i,this.start=n,this.args=r,this.didNotFinish=!1}return e.prototype={selected:!1,duration:0,get end(){return this.start}},{TraceModelEvent:e}}),base.require("tracing.trace_model.trace_model_event"),base.exportTo("tracing.trace_model",function(){function e(e,t,i,n,r,s){tracing.trace_model.TraceModelEvent.call(this,e,t,i,n,r),void 0!==s&&(this.duration=s)}return e.prototype={__proto__:tracing.trace_model.TraceModelEvent.prototype,get end(){return this.start+this.duration}},{Slice:e}}),base.require("base.range"),base.require("tracing.trace_model.slice"),base.require("tracing.trace_model.counter"),base.exportTo("tracing.trace_model",function(){function e(e){this.cpuNumber=e,this.slices=[],this.counters={},this.bounds=new base.Range}var t=tracing.trace_model.Counter;return e.prototype={getOrCreateCounter:function(e,i){var n;return n=e.length?e+"."+i:i,this.counters[n]||(this.counters[n]=new t(this,n,e,i)),this.counters[n]},shiftTimestampsForward:function(e){for(var t=0;t<this.slices.length;t++)this.slices[t].start+=e;for(var i in this.counters)this.counters[i].shiftTimestampsForward(e)},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 e in this.counters)this.counters[e].updateBounds(),this.bounds.addRange(this.counters[e].bounds)},addCategoriesToDict:function(e){for(var t=0;t<this.slices.length;t++)e[this.slices[t].category]=!0;for(var i in this.counters)e[this.counters[i].category]=!0}},e.compare=function(e,t){return e.cpuNumber-t.cpuNumber},{Cpu:e}}),base.exportTo("base",function(){function e(e,t,i){if(0==e.length)return 1;for(var n,r,s=0,a=e.length-1,o=-1;a>=s;)n=Math.floor((s+a)/2),r=t(e[n])-i,0>r?s=n+1:(r>0||(o=n),a=n-1);return-1!=o?o:s}function t(t,i,n,r,s,a){if(0!=t.length&&!(r>s)){var o=e(t,i,r);if(-1!=o&&(o>0&&i(t[o-1])+n(t[o-1],o-1)>=r&&a(t[o-1]),o!=t.length))for(n=t.length;n>o&&!(i(t[o])>=s);o++)a(t[o])}}return{findLowIndexInSortedArray:e,findLowIndexInSortedIntervals:function(t,i,n,r){var s=e(t,i,r);return 0==s?r>=i(t[0])&&r<i(t[0])+n(t[0],0)?0:-1:s<t.length?r>=i(t[s])&&r<i(t[s])+n(t[s],s)?s:r>=i(t[s-1])&&r<i(t[s-1])+n(t[s-1],s-1)?s-1:t.length:s==t.length&&r>=i(t[s-1])&&r<i(t[s-1])+n(t[s-1],s-1)?s-1:t.length},iterateOverIntersectingIntervals:t,getIntersectingIntervals:function(e,i,n,r,s){var a=[];return t(e,i,n,r,s,function(e){a.push(e)}),a}}}),base.exportTo("base",function(){function e(t,i){if(t instanceof Object)if(t instanceof Array)for(var n=0;n<t.length;n++)i(t,n,t[n]),e(t[n],i);else for(n in t){var r=t[n];i(t,n,r),e(r,i)}}return{asArray:function(e){for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t},concatenateArrays:function(){for(var e=[],t=0;t<arguments.length;t++){if(!(arguments[t]instanceof Array))throw Error("Arguments "+t+"is not an array");e.push.apply(e,arguments[t])}return e},compareArrays:function(e,t,i){for(var n=Math.min(e.length,t.length),r=0;n>r;r++){var s=i(e[r],t[r]);if(s)return s}return e.length==t.length?0:void 0===e[r]?-1:1},comparePossiblyUndefinedValues:function(e,t,i){return void 0!==e&&void 0!==t?i(e,t):void 0!==e?-1:void 0!==t?1:0},dictionaryKeys:function(e){var t,i=[];for(t in e)i.push(t);return i},dictionaryValues:function(e){var t,i=[];for(t in e)i.push(e[t]);return i},iterItems:function(e,t,i){i=i||this;for(var n in e)t.call(i,n,e[n])},iterObjectFieldsRecursively:e}}),base.require("base.iteration_helpers"),base.exportTo("base",function(){return{addSingletonGetter:function(e){e.getInstance=function(){return e.instance_||(e.instance_=new e)}},tracedFunction:function(e,t,i){return function(){console.time(t);try{e.apply(i,arguments)}finally{console.timeEnd(t)}}},normalizeException:function(e){return"string"==typeof e?{message:e,stack:["<unknown>"]}:{message:e.message,stack:e.stack?e.stack:["<unknown>"]}},instantiateTemplate:function(e){return document.querySelector(e).content.cloneNode(!0)},stackTrace:function(){var e=Error().stack+"",e=e.split("\n");return e.slice(2)}}}),base.exportTo("tracing.trace_model",function(){function e(e,t,i){this.objectInstance=e,this.ts=t,this.args=i,this.selected=!1}return e.prototype={__proto__:Object.prototype,preInitialize:function(){},initialize:function(){}},e.nameToConstructorMap_={},e.register=function(t,i){if(e.nameToConstructorMap_[t])throw Error("Constructor already registerd for "+t);e.nameToConstructorMap_[t]=i},e.unregister=function(t){delete e.nameToConstructorMap_[t]},e.getConstructor=function(t){return e.nameToConstructorMap_[t]?e.nameToConstructorMap_[t]:e},{ObjectSnapshot:e}}),base.require("base.range"),base.require("base.sorted_array_utils"),base.require("tracing.trace_model.object_snapshot"),base.exportTo("tracing.trace_model",function(){function e(e,t,i,n,r){this.parent=e,this.id=t,this.category=i,this.name=n,this.creationTs=r,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}return e.prototype={__proto__:Object.prototype,get typeName(){return this.name},addSnapshot:function(e,t){if(e<this.creationTs)throw Error("Snapshots must be >= instance.creationTs");if(e>=this.deletionTs)throw Error("Snapshots cannot be added after an objects deletion timestamp.");var i;if(0<this.snapshots.length){if(i=this.snapshots[this.snapshots.length-1],i.ts==e)throw Error("Snapshots already exists at this time!");if(e<i.ts)throw Error("Snapshots must be added in increasing timestamp order")}return i=new(tracing.trace_model.ObjectSnapshot.getConstructor(this.name))(this,e,t),this.snapshots.push(i),i},wasDeleted:function(e){var t;if(0<this.snapshots.length&&(t=this.snapshots[this.snapshots.length-1],t.ts>e))throw Error("Instance cannot be deleted at ts="+e+". A snapshot exists that is older.");this.deletionTs=e,this.deletionTsWasExplicit=!0},preInitialize:function(){for(var e=0;e<this.snapshots.length;e++)this.snapshots[e].preInitialize()},initialize:function(){for(var e=0;e<this.snapshots.length;e++)this.snapshots[e].initialize()},getSnapshotAt:function(e){if(e<this.creationTs){if(this.creationTsWasExplicit)throw Error("ts must be within lifetime of this instance");return this.snapshots[0]}if(e>this.deletionTs)throw Error("ts must be within lifetime of this instance");var t=this.snapshots;return e=base.findLowIndexInSortedIntervals(t,function(e){return e.ts},function(e,i){return i==t.length-1?t[i].objectInstance.deletionTs:t[i+1].ts-t[i].ts},e),0>e?this.snapshots[0]:e>=this.snapshots.length?this.snapshots[this.snapshots.length-1]:this.snapshots[e]},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(e){this.creationTs+=e,this.deletionTs!=Number.MAX_VALUE&&(this.deletionTs+=e),this.snapshots.forEach(function(t){t.ts+=e})}},e.nameToConstructorMap_={},e.register=function(t,i){if(e.nameToConstructorMap_[t])throw Error("Constructor already registerd for "+t);e.nameToConstructorMap_[t]=i},e.unregister=function(t){delete e.nameToConstructorMap_[t]},e.getConstructor=function(t){return e.nameToConstructorMap_[t]?e.nameToConstructorMap_[t]:e},{ObjectInstance:e}}),base.require("base.range"),base.require("base.sorted_array_utils"),base.exportTo("tracing.trace_model",function(){function e(e,t,i){this.createObjectInstanceFunction_=e,this.parent=t,this.id=i,this.instances=[]}return e.prototype={idWasCreated:function(e,t,i){if(0==this.instances.length)return this.instances.push(this.createObjectInstanceFunction_(this.parent,this.id,e,t,i)),this.instances[0].creationTsWasExplicit=!0,this.instances[0];var n=this.instances[this.instances.length-1];if(i<n.deletionTs)throw Error("Mutation of the TimeToObjectInstanceMap must be done in ascending timestamp order.");return n=this.createObjectInstanceFunction_(this.parent,this.id,e,t,i),n.creationTsWasExplicit=!0,this.instances.push(n),n},addSnapshot:function(e,t,i,n){0==this.instances.length&&this.instances.push(this.createObjectInstanceFunction_(this.parent,this.id,e,t,i));var r=base.findLowIndexInSortedIntervals(this.instances,function(e){return e.creationTs},function(e){return e.deletionTs-e.creationTs},i);if(0>r){if(r=this.instances[0],i>r.deletionTs||r.creationTsWasExplicit)throw Error("At the provided timestamp, no instance was still alive");if(0!=r.snapshots.length)throw Error("Cannot shift creationTs forward, snapshots have been added. First snap was at ts="+r.snapshots[0].ts+" and creationTs was "+r.creationTs);r.creationTs=i}else if(r>=this.instances.length)if(r=this.instances[this.instances.length-1],i>=r.deletionTs)r=this.createObjectInstanceFunction_(this.parent,this.id,e,t,i),this.instances.push(r);else{for(var s,r=this.instances.length-1;r>=0&&(e=this.instances[r],!(i>=e.deletionTs));r--)0==e.creationTsWasExplicit&&0==e.snapshots.length&&(s=r);if(void 0===s)throw Error("Cannot add snapshot. No instance was alive that was mutable.");r=this.instances[s],r.creationTs=i}else r=this.instances[r];return r.addSnapshot(i,n)},get lastInstance(){return 0==this.instances.length?void 0:this.instances[this.instances.length-1]},idWasDeleted:function(e,t,i){0==this.instances.length&&this.instances.push(this.createObjectInstanceFunction_(this.parent,this.id,e,t,i));var n=this.instances[this.instances.length-1];if(i<n.creationTs)throw Error("Cannot delete a id before it was crated");if(n.deletionTs==Number.MAX_VALUE)return n.wasDeleted(i),n;if(i<n.deletionTs)throw Error("id was already deleted earlier.");return n=this.createObjectInstanceFunction_(this.parent,this.id,e,t,i),this.instances.push(n),n},getInstanceAt:function(e){return e=base.findLowIndexInSortedIntervals(this.instances,function(e){return e.creationTs},function(e){return e.deletionTs-e.creationTs},e),0>e?this.instances[0].creationTsWasExplicit?void 0:this.instances[0]:e>=this.instances.length?void 0:this.instances[e]}},{TimeToObjectInstanceMap:e}}),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 e(e){this.parent=e,this.bounds=new base.Range,this.instanceMapsById_={},this.instancesByTypeName_={},this.createObjectInstance_=this.createObjectInstance_.bind(this)}return e.prototype={__proto__:Object.prototype,createObjectInstance_:function(e,t,i,n,r){return e=new(tracing.trace_model.ObjectInstance.getConstructor(n))(e,t,i,n,r),t=e.typeName,i=this.instancesByTypeName_[t],i||(i=[],this.instancesByTypeName_[t]=i),i.push(e),e},getOrCreateInstanceMap_:function(e){var t=this.instanceMapsById_[e];return t?t:(t=new tracing.trace_model.TimeToObjectInstanceMap(this.createObjectInstance_,this.parent,e),this.instanceMapsById_[e]=t)},idWasCreated:function(e,t,i,n){return this.getOrCreateInstanceMap_(e).idWasCreated(t,i,n)},addSnapshot:function(e,t,i,n,r){if(e=this.getOrCreateInstanceMap_(e,t,i,n).addSnapshot(t,i,n,r),e.objectInstance.category!=t)throw Error("Added snapshot with different category than when it was created");if(e.objectInstance.name!=i)throw Error("Added snapshot with different name than when it was created");return e},idWasDeleted:function(e,t,i,n){if(e=this.getOrCreateInstanceMap_(e,t,i,n).idWasDeleted(t,i,n)){if(e.category!=t)throw Error("Deleting an object with a different category than when it was created");if(e.name!=i)throw Error("Deleting an object with a different name than when it was created")}},autoDeleteObjects:function(e){base.iterItems(this.instanceMapsById_,function(t,i){var n=i.lastInstance;n.deletionTs==Number.MAX_VALUE&&(i.idWasDeleted(n.category,n.name,e),n.deletionTsWasExplicit=!1)})},getObjectInstanceAt:function(e,t){var i=this.instanceMapsById_[e];return i?i.getInstanceAt(t):void 0},getSnapshotAt:function(e,t){var i=this.getObjectInstanceAt(e,t);return i?i.getSnapshotAt(t):void 0},iterObjectInstances:function(e,t){t=t||this,base.iterItems(this.instanceMapsById_,function(i,n){n.instances.forEach(e,t)})},getAllObjectInstances:function(){var e=[];return this.iterObjectInstances(function(t){e.push(t)}),e},getAllInstancesNamed:function(e){return this.instancesByTypeName_[e]},getAllInstancesByTypeName:function(){return this.instancesByTypeName_},preInitializeAllObjects:function(){this.iterObjectInstances(function(e){e.preInitialize()})},initializeAllObjects:function(){this.iterObjectInstances(function(e){e.initialize()})},initializeInstances:function(){this.iterObjectInstances(function(e){e.initialize()})},updateBounds:function(){this.bounds.reset(),this.iterObjectInstances(function(e){e.updateBounds(),this.bounds.addRange(e.bounds)},this)},shiftTimestampsForward:function(e){this.iterObjectInstances(function(t){t.shiftTimestampsForward(e)})},addCategoriesToDict:function(e){this.iterObjectInstances(function(t){e[t.category]=!0})},toJSON:function(){return{}}},{ObjectCollection:e}}),base.require("tracing.trace_model.slice"),base.exportTo("tracing.trace_model",function(){function e(){tracing.trace_model.Slice.apply(this,arguments)}return e.prototype={__proto__:tracing.trace_model.Slice.prototype,toJSON:function(){for(var e={},t=Object.keys(this),i=0;i<t.length;i++){var n=t[i];"function"!=typeof this[n]&&(e[n]="startThread"==n||"endThread"==n?this[n].guid:this[n])}return e},id:void 0,startThread:void 0,endThread:void 0,subSlices:void 0},{AsyncSlice:e}}),base.require("base.range"),base.require("tracing.trace_model.async_slice"),base.exportTo("tracing.trace_model",function(){function e(){this.slices=[],this.bounds=new base.Range}return e.prototype={__proto__:Object.prototype,push:function(e){this.slices.push(e)},get length(){return this.slices.length},shiftTimestampsForward:function(e){for(var t=0;t<this.slices.length;t++){var i=this.slices[t];i.start+=e;for(var n=0;n<i.subSlices.length;n++)i.subSlices[n].start+=e}},updateBounds:function(){this.bounds.reset();for(var e=0;e<this.slices.length;e++)this.bounds.addValue(this.slices[e].start),this.bounds.addValue(this.slices[e].end)},computeSubGroups:function(){for(var t={},i=0;i<this.slices.length;++i){var n=this.slices[i],r=n.startThread.guid;t[r]||(t[r]=new e),t[r].slices.push(n)}var s,i=[];for(s in t)n=t[s],n.updateBounds(),i.push(n);return i}},{AsyncSliceGroup:e}}),base.require("tracing.trace_model.trace_model_event"),base.exportTo("tracing.trace_model",function(){function e(){tracing.trace_model.TraceModelEvent.apply(this,arguments)}return e.prototype={__proto__:tracing.trace_model.TraceModelEvent.prototype},{Sample:e}}),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 e(e){this.sliceConstructor=e||t,this.openPartialSlices_=[],this.slices=[],this.bounds=new base.Range}var t=tracing.trace_model.Slice;return e.prototype={__proto__:Object.prototype,get length(){return this.slices.length},pushSlice:function(e){return this.slices.push(e),e},pushSlices:function(e){this.slices.push.apply(this.slices,e)},pushInstantEvent:function(e){this.slices.push(e)},beginSlice:function(e,t,i,n){if(this.openPartialSlices_.length&&i<this.openPartialSlices_[this.openPartialSlices_.length-1].start)throw Error("Slices must be added in increasing timestamp order");var r=tracing.getStringColorId(t);return e=new this.sliceConstructor(e,t,r,i,n?n:{}),this.openPartialSlices_.push(e),e},isTimestampValidForBeginOrEnd:function(e){return this.openPartialSlices_.length?e>=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(e){if(!this.openSliceCount)throw Error("endSlice called without an open slice");var t=this.openPartialSlices_[this.openSliceCount-1];if(this.openPartialSlices_.splice(this.openSliceCount-1,1),e<t.start)throw Error("Slice "+t.title+" end time is before its start.");return t.duration=e-t.start,this.pushSlice(t),t},autoCloseOpenSlices:function(e){for(e||(this.updateBounds(),e=this.bounds.max);0<this.openSliceCount;)this.endSlice(e).didNotFinish=!0},shiftTimestampsForward:function(e){for(var t=0;t<this.slices.length;t++){var n=this.slices[t];n.start+=e}for(t=0;t<this.openPartialSlices_.length;t++)n=this.openPartialSlices_[i],n.start+=e},updateBounds:function(){this.bounds.reset();for(var e=0;e<this.slices.length;e++)this.bounds.addValue(this.slices[e].start),this.bounds.addValue(this.slices[e].end);this.openPartialSlices_.length&&(this.bounds.addValue(this.openPartialSlices_[0].start),this.bounds.addValue(this.openPartialSlices_[this.openPartialSlices_.length-1].start))},copySlice:function(e){var t=new this.sliceConstructor(e.category,e.title,e.colorId,e.start,e.args,e.duration);return t.didNotFinish=e.didNotFinish,t}},e.merge=function(t,i){if(0<t.openPartialSlices_.length)throw Error("groupA has open partial slices");if(0<i.openPartialSlices_.length)throw Error("groupB has open partial slices");for(var n=new e,r=t.slices,s=i.slices,a=r.length-1,o=s.length-1,c=[],l=[],h=function(e){for(var t=0;t<l.length;t++){var i=l[t],r=i.end;if(e<i.start||e>r)throw Error("slice should not be split");var s=n.copySlice(i);i.start=e,i.duration=r-e,i.title+=" (cont.)",s.duration=e-s.start,l[t]=s,n.pushSlice(s)}},d=function(e){for(;0<c.length||0<l.length;){var t=c[c.length-1],i=l[l.length-1],t=t&&t.start,i=i&&i.start;if((void 0===t||e>t)&&(void 0===i||e>i))break;void 0===i||t>i?(h(t),c.pop()):l.pop()}};a>=0||o>=0;){var u=r[a],p=s[o];void 0===u||void 0!==p&&u.end<p.end?(u=n.copySlice(p),p=!0,o--):(u=n.copySlice(u),p=!1,a--),d(u.end),n.pushSlice(u),p?l.push(u):(h(u.end),c.push(u))}return d(),n.slices.reverse(),n},{SliceGroup:e}}),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 e(e,t,n,r,s,a){i.call(this,e,t,n,r,s,a),this.subSlices=[]}function t(t,i){if(this.guid_=base.GUID.allocate(),!t)throw Error("Parent must be provided.");this.parent=t,this.sortIndex=0,this.tid=i,this.sliceGroup=new n(e),this.cpuSlices=void 0,this.samples_=[],this.kernelSliceGroup=new n,this.asyncSliceGroup=new r,this.bounds=new base.Range,this.ephemeralSettings={}}var i=tracing.trace_model.Slice,n=tracing.trace_model.SliceGroup,r=tracing.trace_model.AsyncSliceGroup;return e.prototype={__proto__:i.prototype},t.prototype={get guid(){return this.guid_},compareTo:function(e){return t.compare(this,e)},toJSON:function(){for(var e={},t=Object.keys(this),i=0;i<t.length;i++){var n=t[i];"function"!=typeof this[n]&&(e[n]="parent"==n?this[n].guid:this[n])}return e},addSample:function(e,t,i,n){if(this.samples_.length&&i<this.samples_[this.samples_.length-1].start)throw Error("Samples must be added in increasing timestamp order.");var r=tracing.getStringColorId(t);return e=new tracing.trace_model.Sample(e,t,r,i,n?n:{}),this.samples_.push(e),e},get samples(){return this.samples_},name:void 0,shiftTimestampsForward:function(e){if(this.sliceGroup.shiftTimestampsForward(e),this.cpuSlices)for(var t=0;t<this.cpuSlices.length;t++)this.cpuSlices[t].start+=e;if(this.samples_.length)for(t=0;t<this.samples_.length;t++)this.samples_[t].start+=e;this.kernelSliceGroup.shiftTimestampsForward(e),this.asyncSliceGroup.shiftTimestampsForward(e)},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(e){for(var t=0;t<this.sliceGroup.length;t++)e[this.sliceGroup.slices[t].category]=!0;for(t=0;t<this.kernelSliceGroup.length;t++)e[this.kernelSliceGroup.slices[t].category]=!0;for(t=0;t<this.asyncSliceGroup.length;t++)e[this.asyncSliceGroup.slices[t].category]=!0;for(t=0;t<this.samples_.length;t++)e[this.samples_[t].category]=!0},autoCloseOpenSlices:function(e){this.sliceGroup.autoCloseOpenSlices(e),this.kernelSliceGroup.autoCloseOpenSlices(e)},mergeKernelWithUserland:function(){if(0<this.kernelSliceGroup.length){var e=n.merge(this.sliceGroup,this.kernelSliceGroup);this.sliceGroup.slices=e.slices,this.kernelSliceGroup=new n,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 e=this.parent.getSettingsKey();return e?e+"."+this.name:void 0}}},t.compare=function(e,t){var i=e.parent.compareTo(t.parent);return i||(i=e.sortIndex-t.sortIndex)?i:(i=base.comparePossiblyUndefinedValues(e.name,t.name,function(e,t){return e.localeCompare(t)}))?i:e.tid-t.tid},{ThreadSlice:e,Thread:t}}),base.exportTo("base",function(){function e(){return e}var t=localStorage;return e.get=function(i,n,r){i=e.namespace_(i,r);var s=t.getItem(i);if(null===s||void 0===s)return n;try{return JSON.parse(s).value}catch(a){return t.removeItem(e.namespace_(i,r)),n}},e.set=function(i,n,r){if(void 0===n)throw Error("Settings.set: value must not be undefined");n=JSON.stringify({value:n}),t.setItem(e.namespace_(i,r),n)},e.keys=function(i){var n=[];i=i||"";for(var r=0;r<t.length;r++){var s=t.key(r);e.isnamespaced_(s,i)&&n.push(e.unnamespace_(s,i))}return n},e.isnamespaced_=function(t,i){return 0==t.indexOf(e.normalize_(i))},e.namespace_=function(t,i){return e.normalize_(i)+t},e.unnamespace_=function(t,i){return t.replace(e.normalize_(i),"")},e.normalize_=function(t){return e.NAMESPACE+(t?t+".":"")},e.setAlternativeStorageInstance=function(e){t=e},e.getAlternativeStorageInstance=function(){return t===localStorage?void 0:t},e.NAMESPACE="trace-viewer",{Settings:e}}),base.require("base.settings"),base.exportTo("tracing",function(){function e(e){this.model=e,this.objectsByKey_=[],this.nonuniqueKeys_=[],this.buildObjectsByKeyMap_(),this.removeNonuniqueKeysFromSettings_()}var t=base.Settings;return e.prototype={buildObjectsByKeyMap_:function(){var e=[this.model.kernel];e.push.apply(e,base.dictionaryValues(this.model.processes)),e.push.apply(e,this.model.getAllThreads());for(var t={},i=0;i<e.length;i++){var n=e[i],r=n.getSettingsKey();r&&(t[r]=void 0===t[r]?n:"nonuniqueKey")}var s={};base.dictionaryKeys(t).forEach(function(e){"nonuniqueKey"===t[e]&&(delete t[e],s[e]=!0)}),this.nonuniqueKeys=s,this.objectsByKey_=t},removeNonuniqueKeysFromSettings_:function(){var e=t.get("trace_model_settings",{}),i=!1;base.dictionaryKeys(e).forEach(function(t){this.nonuniqueKeys[t]&&(i=!0,delete e[t])},this),i&&t.set("trace_model_settings",e)},hasUniqueSettingKey:function(e){return(e=e.getSettingsKey())?void 0!==this.objectsByKey_[e]:!1},getSettingFor:function(e,i,n){var r=e.getSettingsKey();return r&&this.objectsByKey_[r]?(e=t.get("trace_model_settings",{}),e[r]||(e[r]={}),i=e[r][i],void 0!==i?i:n):(i=e.ephemeralSettings[i],void 0!==i?i:n)},setSettingFor:function(e,i,n){var r=e.getSettingsKey();r&&this.objectsByKey_[r]?(e=t.get("trace_model_settings",{}),e[r]||(e[r]={}),e[r][i]=n,t.set("trace_model_settings",e)):e.ephemeralSettings[i]=n}},{TraceModelSettings:e}}),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 e(e){if(!e)throw Error("Must provide a model");this.guid_=base.GUID.allocate(),this.model=e,this.threads={},this.counters={},this.objects=new tracing.trace_model.ObjectCollection(this),this.bounds=new base.Range,this.sortIndex=0,this.ephemeralSettings={}}var t=tracing.trace_model.Thread,i=tracing.trace_model.Counter;return e.compare=function(e,t){return e.sortIndex-t.sortIndex},e.prototype={get guid(){return this.guid_},get numThreads(){var e,t=0;for(e in this.threads)t++;return t},toJSON:function(){for(var e={},t=Object.keys(this),i=0;i<t.length;i++){var n=t[i];"function"!=typeof this[n]&&"model"!=n&&(e[n]=this[n])}return e},shiftTimestampsForward:function(e){for(var t in this.threads)this.threads[t].shiftTimestampsForward(e);for(var i in this.counters)this.counters[i].shiftTimestampsForward(e);this.objects.shiftTimestampsForward(e)},autoCloseOpenSlices:function(e){for(var t in this.threads)this.threads[t].autoCloseOpenSlices(e)},autoDeleteObjects:function(e){this.objects.autoDeleteObjects(e)},preInitializeObjects:function(){this.objects.preInitializeAllObjects()},initializeObjects:function(){this.objects.initializeAllObjects()},mergeKernelWithUserland:function(){for(var e in this.threads)this.threads[e].mergeKernelWithUserland()},updateBounds:function(){this.bounds.reset();for(var e in this.threads)this.threads[e].updateBounds(),this.bounds.addRange(this.threads[e].bounds);for(var t in this.counters)this.counters[t].updateBounds(),this.bounds.addRange(this.counters[t].bounds);this.objects.updateBounds(),this.bounds.addRange(this.objects.bounds)},addCategoriesToDict:function(e){for(var t in this.threads)this.threads[t].addCategoriesToDict(e);for(var i in this.counters)e[this.counters[i].category]=!0;this.objects.addCategoriesToDict(e)},findAllThreadsNamed:function(e){var t,i=[];for(t in this.threads){var n=this.threads[t];n.name==e&&i.push(n)}return i},pruneEmptyContainers:function(){var e,t={};for(e in this.threads){var i=this.threads[e];i.isEmpty||(t[e]=i)}this.threads=t},getOrCreateThread:function(e){return this.threads[e]||(this.threads[e]=new t(this,e)),this.threads[e]},getOrCreateCounter:function(e,t){var n=e+"."+t;return this.counters[n]||(this.counters[n]=new i(this,n,e,t)),this.counters[n]},getSettingsKey:function(){throw Error("Not implemented")}},{ProcessBase:e}}),base.require("tracing.trace_model.cpu"),base.require("tracing.trace_model.process_base"),base.exportTo("tracing.trace_model",function(){function e(e){if(void 0===e)throw Error("model must be provided");i.call(this,e),this.cpus={}}var t=tracing.trace_model.Cpu,i=tracing.trace_model.ProcessBase;return e.compare=function(){return 0},e.prototype={__proto__:i.prototype,compareTo:function(t){return e.compare(this,t)},get userFriendlyName(){return"Kernel"},get userFriendlyDetails(){return"Kernel"},getOrCreateCpu:function(e){return this.cpus[e]||(this.cpus[e]=new t(e)),this.cpus[e]},shiftTimestampsForward:function(e){i.prototype.shiftTimestampsForward.call(this);for(var t in this.cpus)this.cpus[t].shiftTimestampsForward(e)},updateBounds:function(){i.prototype.updateBounds.call(this);for(var e in this.cpus){var t=this.cpus[e];t.updateBounds(),this.bounds.addRange(t.bounds)}},addCategoriesToDict:function(e){i.prototype.addCategoriesToDict.call(this,e);for(var t in this.cpus)this.cpus[t].addCategoriesToDict(e)},getSettingsKey:function(){return"kernel"}},{Kernel:e}}),base.require("tracing.trace_model.process_base"),base.exportTo("tracing.trace_model",function(){function e(e,t){if(void 0===e)throw Error("model must be provided");if(void 0===t)throw Error("pid must be provided");tracing.trace_model.ProcessBase.call(this,e),this.pid=t,this.name=void 0,this.labels=[],this.instantEvents=[]}return e.compare=function(e,t){var i=tracing.trace_model.ProcessBase.compare(e,t);return i||(i=base.comparePossiblyUndefinedValues(e.name,t.name,function(e,t){return e.localeCompare(t)}))?i:(i=base.compareArrays(e.labels,t.labels,function(e,t){return e.localeCompare(t)}))?i:e.pid-t.pid},e.prototype={__proto__:tracing.trace_model.ProcessBase.prototype,compareTo:function(t){return e.compare(this,t)},pushInstantEvent:function(e){this.instantEvents.push(e)},get userFriendlyName(){var e;return e=this.name?this.name:"Process "+this.pid,this.labels.length&&(e+=": "+this.labels.join(", ")),e},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(e){for(var t in this.instantEvents)this.instantEvents[t].start+=e;tracing.trace_model.ProcessBase.prototype.shiftTimestampsForward.apply(this,arguments)}},{Process:e}}),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 e(e,t){this.kernel=new n(this),this.processes={},this.importErrors=[],this.metadata=[],this.categories=[],this.bounds=new base.Range,this.instantEvents=[],e&&this.importTraces([e],t)}function t(){this.importPriority=0}var i=tracing.trace_model.Process,n=tracing.trace_model.Kernel;return e.importerConstructors_=[],e.registerImporter=function(t){e.importerConstructors_.push(t)},e.prototype={__proto__:base.EventTarget.prototype,get numProcesses(){var e,t=0;for(e in this.processes)t++;return t},getOrCreateProcess:function(e){return this.processes[e]||(this.processes[e]=new i(this,e)),this.processes[e]
+},pushInstantEvent:function(e){this.instantEvents.push(e)},updateCategories_:function(){var e={};this.kernel.addCategoriesToDict(e);for(var t in this.processes)this.processes[t].addCategoriesToDict(e);this.categories=[];for(var i in e)""!=i&&this.categories.push(i)},updateBounds:function(){this.bounds.reset(),this.kernel.updateBounds(),this.bounds.addRange(this.kernel.bounds);for(var e in this.processes)this.processes[e].updateBounds(),this.bounds.addRange(this.processes[e].bounds)},shiftWorldToZero:function(){if(!this.bounds.isEmpty){var e=this.bounds.min;this.kernel.shiftTimestampsForward(-e);for(var t in this.instantEvents)this.instantEvents[t].start-=e;for(var i in this.processes)this.processes[i].shiftTimestampsForward(-e);this.updateBounds()}},getAllThreads:function(){var e,t=[];for(e in this.kernel.threads)t.push(n.threads[e]);for(var i in this.processes){var n=this.processes[i];for(e in n.threads)t.push(n.threads[e])}return t},getAllProcesses:function(){var e,t=[];for(e in this.processes)t.push(this.processes[e]);return t},getAllCounters:function(){var e=[];e.push.apply(e,base.dictionaryValues(this.kernel.counters));for(var t in this.processes){var i,n=this.processes[t];for(i in n.counters)e.push(n.counters[i])}return e},findAllThreadsNamed:function(e){var t=[];t.push.apply(t,this.kernel.findAllThreadsNamed(e));for(var i in this.processes)t.push.apply(t,this.processes[i].findAllThreadsNamed(e));return t},createImporter_:function(t){for(var i,n=0;n<e.importerConstructors_.length;++n)if(e.importerConstructors_[n].canImport(t)){i=e.importerConstructors_[n];break}if(!i)throw Error("Could not find an importer for the provided eventData.");return new i(this,t)},importTraces:function(e,t,i){void 0===t&&(t=!0),void 0===i&&(i=!0),e=e.slice(0);for(var n=[],r=0;r<e.length;++r)n.push(this.createImporter_(e[r]));for(r=0;r<n.length;r++){var s=n[r].extractSubtrace();s&&(e.push(s),n.push(this.createImporter_(s)))}for(n.sort(function(e,t){return e.importPriority-t.importPriority}),r=0;r<n.length;r++)n[r].importEvents(r>0);this.updateBounds(),this.kernel.autoCloseOpenSlices(this.bounds.max);for(var a in this.processes)this.processes[a].autoCloseOpenSlices(this.bounds.max);for(r=0;r<n.length;r++)n[r].finalizeImport();for(a in this.processes)this.processes[a].preInitializeObjects();if(i)for(a in this.kernel.pruneEmptyContainers(),this.processes)this.processes[a].pruneEmptyContainers();for(a in this.processes)this.processes[a].mergeKernelWithUserland();for(this.updateBounds(),this.updateCategories_(),t&&this.shiftWorldToZero(),r=0;r<n.length;r++)n[r].joinRefs();for(a in this.processes)this.processes[a].autoDeleteObjects(this.bounds.max);for(a in this.processes)this.processes[a].initializeObjects()}},t.canImport=function(e){return e instanceof Array&&0==e.length?!0:"string"==typeof e||e instanceof String?0==e.length:!1},t.prototype={__proto__:Object.prototype,extractSubtrace:function(){},importEvents:function(){},finalizeImport:function(){},joinRefs:function(){}},e.registerImporter(t),{TraceModel:e}}),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 e(e){this.cpu=e}function t(e,t){this.importPriority=2,this.model_=e,this.events_=t,this.clockSyncRecords_=[],this.cpuStates_={},this.wakeups_=[],this.kernelThreadStates_={},this.buildMapFromLinuxPidsToThreads(),this.lineNumberBase=0,this.lineNumber=-1,this.pseudoThreadCounter=1,this.parsers_=[],this.eventHandlers_={}}function i(e){return"{"==e[0]?!1:r.test(e)?s:a.test(e)?o:c.test(e)?l:null}e.prototype={__proto__:Object.prototype,switchRunningLinuxPid:function(e,t,i,n,r,s){if(void 0!==this.lastActivePid&&0!=this.lastActivePid){var a=i-this.lastActiveTs;e=(e=e.threadsByLinuxPid[this.lastActivePid])?e.userFriendlyName:this.lastActiveComm,t=new tracing.trace_model.Slice("",e,tracing.getStringColorId(e),this.lastActiveTs,{comm:this.lastActiveComm,tid:this.lastActivePid,prio:this.lastActivePrio,stateWhenDescheduled:t},a),this.cpu.slices.push(t)}this.lastActiveTs=i,this.lastActivePid=n,this.lastActiveComm=r,this.lastActivePrio=s}};var n={},r=RegExp("^\\s*(.+)-(\\d+)\\s+\\(\\s*(\\d+|-+)\\)\\s\\[(\\d+)\\]\\s+[dX.][Nn.][Hhs.][0-9a-f.]\\s+(\\d+\\.\\d+):\\s+(\\S+):\\s(.*)$"),s=function(e){if(e=r.exec(e),!e)return e;var t=e[3];return"-"===t[0]&&(t=void 0),{threadName:e[1],pid:e[2],tgid:t,cpuNumber:e[4],timestamp:e[5],eventName:e[6],details:e[7]}};n.lineParserWithTGID=s;var a=/^\s*(.+)-(\d+)\s+\[(\d+)\]\s+[dX.][Nn.][Hhs.][0-9a-f.]\s+(\d+\.\d+):\s+(\S+):\s(.*)$/,o=function(e){return(e=a.exec(e))?{threadName:e[1],pid:e[2],cpuNumber:e[3],timestamp:e[4],eventName:e[5],details:e[6]}:e};n.lineParserWithIRQInfo=o;var c=/^\s*(.+)-(\d+)\s+\[(\d+)\]\s*(\d+\.\d+):\s+(\S+):\s(.*)$/,l=function(e){return(e=c.exec(e))?{threadName:e[1],pid:e[2],cpuNumber:e[3],timestamp:e[4],eventName:e[5],details:e[6]}:e};return n.lineParserWithLegacyFmt=l,n.traceEventClockSyncRE=/trace_event_clock_sync: parent_ts=(\d+\.?\d*)/,n.autoDetectLineParser=i,t.canImport=function(e){if(!("string"==typeof e||e instanceof String))return!1;if(t._extractEventsFromSystraceHTML(e,!1).ok||/^# tracer:/.test(e))return!0;var n=/^(.+)\n/.exec(e);return n&&(e=n[1]),i(e)?!0:!1},t._extractEventsFromSystraceHTML=function(e,t){function i(e){for(;a<s.length;a++)if(e.test(s[a]))return!0;return!1}function n(e,t){return-1===e.indexOf(t,e.length-t.length)?e:e.substring(e,e.length-t.length)}var r={ok:!1};if(void 0===t&&(t=!0),0==/^<!DOCTYPE HTML>/.test(e))return r;var s=e.split("\n"),a=1;if(!i(/^  <script>$/)||!i(/^  var linuxPerfData = "\\$/))return r;var o=a+1;if(!i(/^  <\/script>$/))return r;var c=a;if(!i(/^<\/body>$/)||!i(/^<\/html>$/))return r;var l=s.slice(o,c),c=[];if(t)for(var h=0;h<l.length;h++){var d=l[h],d=n(d,"\\n\\");c.push(d)}else c=[l[l.length-1]];return l=c[c.length-1],h=n(l,'\\n";'),h==l?r:(c[c.length-1]=h,{ok:!0,lines:t?c:void 0,events_begin_at_line:o})},t.prototype={__proto__:Object.prototype,extractSubtrace:function(){},get model(){return this.model_},buildMapFromLinuxPidsToThreads:function(){this.threadsByLinuxPid={},this.model_.getAllThreads().forEach(function(e){this.threadsByLinuxPid[e.tid]=e}.bind(this))},getOrCreateCpuState:function(t){if(!this.cpuStates_[t]){var i=this.model_.kernel.getOrCreateCpu(t);this.cpuStates_[t]=new e(i)}return this.cpuStates_[t]},getOrCreateKernelThread:function(e,t,i){return this.kernelThreadStates_[e]||(i=this.model_.getOrCreateProcess(t).getOrCreateThread(i),i.name=e,this.kernelThreadStates_[e]={pid:t,thread:i,openSlice:void 0,openSliceTS:void 0},this.threadsByLinuxPid[t]=i),this.kernelThreadStates_[e]},getOrCreatePseudoThread:function(e){var t=this.kernelThreadStates_[e];return t||(t=this.getOrCreateKernelThread(e,0,this.pseudoThreadCounter),this.pseudoThreadCounter++),t},importEvents:function(e){this.createParsers(),this.importCpuData(),this.alignClocks(e)&&(this.buildMapFromLinuxPidsToThreads(),this.buildPerThreadCpuSlicesFromCpuState())},finalizeImport:function(){customPIDMap.clear()},joinRefs:function(){},buildPerThreadCpuSlicesFromCpuState:function(){for(var e in this.cpuStates_)for(var t=this.cpuStates_[e].cpu,i=0;i<t.slices.length;i++){var n=t.slices[i],r=this.threadsByLinuxPid[n.args.tid];r&&(r.tempCpuSlices||(r.tempCpuSlices=[]),r.tempCpuSlices.push(n))}for(i in this.wakeups_)e=this.wakeups_[i],(r=this.threadsByLinuxPid[e.tid])&&(r.tempWakeups=r.tempWakeups||[],r.tempWakeups.push(e));var s=tracing.getColorIdByName("running"),a=tracing.getColorIdByName("runnable"),o=tracing.getColorIdByName("sleeping"),c=tracing.getColorIdByName("iowait");this.model_.getAllThreads().forEach(function(e){if(void 0!==e.tempCpuSlices){var t=e.tempCpuSlices;delete e.tempCpuSlices,t.sort(function(e,t){return e.start-t.start});var i=e.tempWakeups||[];delete e.tempWakeups,i.sort(function(e,t){return e.ts-t.ts});var n=[];if(t.length){var r=t[0];if(i.length&&i[0].ts<r.start){var l=i.shift();n.push(new tracing.trace_model.Slice("","Runnable",a,l.ts,{"wakeup from tid":l.fromTid},r.start-l.ts))}n.push(new tracing.trace_model.Slice("","Running",s,r.start,{},r.duration))}for(l=void 0,r=1;r<t.length;r++){for(var h=t[r-1],d=t[r],u=d.start-h.end;i.length&&i[0].ts<d.start;){var p=i.shift();void 0===l&&p.ts>h.end&&(l=p)}p=function(e,t){void 0!==l&&(u=l.ts-h.end),n.push(new tracing.trace_model.Slice("",e,t,h.end,{},u)),void 0!==l&&(n.push(new tracing.trace_model.Slice("","Runnable",a,l.ts,{"wakeup from tid":l.fromTid},d.start-l.ts)),l=void 0)},"S"==h.args.stateWhenDescheduled?p("Sleeping",o):"R"==h.args.stateWhenDescheduled||"R+"==h.args.stateWhenDescheduled?n.push(new tracing.trace_model.Slice("","Runnable",a,h.end,{},u)):"D"==h.args.stateWhenDescheduled?p("Uninterruptible Sleep",c):"T"==h.args.stateWhenDescheduled?n.push(new tracing.trace_model.Slice("","__TASK_STOPPED",c,h.end,{},u)):"t"==h.args.stateWhenDescheduled?n.push(new tracing.trace_model.Slice("","debug",c,h.end,{},u)):"Z"==h.args.stateWhenDescheduled?n.push(new tracing.trace_model.Slice("","Zombie",c,h.end,{},u)):"X"==h.args.stateWhenDescheduled?n.push(new tracing.trace_model.Slice("","Exit Dead",c,h.end,{},u)):"x"==h.args.stateWhenDescheduled?n.push(new tracing.trace_model.Slice("","Task Dead",c,h.end,{},u)):"K"==h.args.stateWhenDescheduled?n.push(new tracing.trace_model.Slice("","Wakekill",c,h.end,{},u)):"W"==h.args.stateWhenDescheduled?n.push(new tracing.trace_model.Slice("","Waking",c,h.end,{},u)):"D|K"==h.args.stateWhenDescheduled?p("Uninterruptible Sleep | WakeKill",c):"D|W"==h.args.stateWhenDescheduled?p("Uninterruptible Sleep | Waking",c):(n.push(new tracing.trace_model.Slice("","UNKNOWN",c,h.end,{},u)),this.model_.importErrors.push("Unrecognized sleep state: "+h.args.stateWhenDescheduled)),n.push(new tracing.trace_model.Slice("","Running",s,d.start,{},d.duration))}e.cpuSlices=n}},this)},alignClocks:function(e){if(0==this.clockSyncRecords_.length)return e?(this.abortImport(),!1):!0;if(e=this.clockSyncRecords_[0],0==e.parentTS||e.parentTS==e.perfTS)return!0;e=e.parentTS-e.perfTS;for(var t in this.cpuStates_){for(var i=this.cpuStates_[t].cpu,n=0;n<i.slices.length;n++){var r=i.slices[n];r.start+=e,r.duration=r.duration}for(var s in i.counters)for(n=i.counters[s],r=0;r<n.timestamps.length;r++)n.timestamps[r]+=e}for(var a in this.kernelThreadStates_)this.kernelThreadStates_[a].thread.shiftTimestampsForward(e);return!0},abortImport:function(){if(this.pushedEventsToThreads)throw Error("Cannot abort, have alrady pushedCpuDataToThreads.");for(var e in this.cpuStates_)delete this.model_.kernel.cpus[e];for(var t in this.kernelThreadStates_){e=this.kernelThreadStates_[t].thread;var i=e.parent;delete i.threads[e.tid],delete this.model_.processes[i.pid]}this.model_.importErrors.push("Cannot import kernel trace without a clock sync.")},createParsers:function(){for(var e=tracing.importer.linux_perf.Parser.getSubtypeConstructors(),i=0;i<e.length;++i)this.parsers_.push(new e[i](this));this.registerEventHandler("tracing_mark_write:trace_event_clock_sync",t.prototype.traceClockSyncEvent.bind(this)),this.registerEventHandler("tracing_mark_write",t.prototype.traceMarkingWriteEvent.bind(this)),this.registerEventHandler("0:trace_event_clock_sync",t.prototype.traceClockSyncEvent.bind(this)),this.registerEventHandler("0",t.prototype.traceMarkingWriteEvent.bind(this))},registerEventHandler:function(e,t){this.eventHandlers_[e]=t},markPidRunnable:function(e,t,i,n,r){this.wakeups_.push({ts:e,tid:t,fromTid:r})},importError:function(e){this.model_.importErrors.push("Line "+(this.lineNumberBase+this.lineNumber+1)+": "+e)},traceClockSyncEvent:function(e,t,i,n,r){return(e=/parent_ts=(\d+\.?\d*)/.exec(r.details))?(this.clockSyncRecords_.push({perfTS:n,parentTS:1e3*e[1]}),!0):!1},traceMarkingWriteEvent:function(e,t,i,n,r,s){var a=/^\s*(\w+):\s*(.*)$/.exec(r.details);if(a)r.subEventName=a[1],r.details=a[2];else{if(a=r.details.substring(0,2),"B|"!=a&&"E"!=a&&"E|"!=a&&"C|"!=a&&"S|"!=a&&"F|"!=a)return!1;r.subEventName="android"}return e=e+":"+r.subEventName,a=this.eventHandlers_[e],a?a(e,t,i,n,r,s):(this.importError("Unknown trace_marking_write event "+e),!0)},importCpuData:function(){var e=t._extractEventsFromSystraceHTML(this.events_,!0);for(e.ok?(this.lineNumberBase=e.events_begin_at_line,this.lines_=e.lines):(this.lineNumberBase=0,this.lines_=this.events_.split("\n")),e=null,this.lineNumber=0;this.lineNumber<this.lines_.length;++this.lineNumber){var n=this.lines_[this.lineNumber];if(0!=n.length&&!/^#/.test(n)){if(null==e&&(e=i(n),null==e)){this.importError("Cannot parse line: "+n);continue}var r=e(n);if(r){var s=parseInt(r.pid),a=parseInt(r.cpuNumber),o=1e3*parseFloat(r.timestamp),c=r.eventName,l=this.eventHandlers_[c];l?l(c,a,s,o,r)||this.importError("Malformed "+c+" event ("+n+")"):this.importError("Unknown event "+c+" ("+n+")")}else this.importError("Unrecognized line: "+n)}}}},tracing.TraceModel.registerImporter(t),{LinuxPerfImporter:t,_LinuxPerfImporterTestExports:n}}),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 e=vec2.create(),t=vec2.create(),i=vec4.create();return mat2d.create(),vec2.createFromArray=function(e){if(2!=e.length)throw Error("Should be length 2");var t=vec2.create();return vec2.set(t,e[0],e[1]),t},vec2.createXY=function(e,t){var i=vec2.create();return vec2.set(i,e,t),i},vec2.toString=function(e){return"["+e[0]+", "+e[1]+"]"},vec2.addTwoScaledUnitVectors=function(i,n,r,s,a){vec2.scale(e,n,r),vec2.scale(t,s,a),vec2.add(i,e,t)},vec3.createXYZ=function(e,t,i){var n=vec3.create();return vec3.set(n,e,t,i),n},vec3.toString=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},mat2d.translateXY=function(t,i,n){vec2.set(e,i,n),mat2d.translate(t,t,e)},mat2d.scaleXY=function(t,i,n){vec2.set(e,i,n),mat2d.scale(t,t,e)},vec4.unitize=function(e,t){return e[0]=t[0]/t[3],e[1]=t[1]/t[3],e[2]=t[2]/t[3],e[3]=1,e},vec2.copyFromVec4=function(e,t){vec4.unitize(i,t),vec2.copy(e,i)},{}}),base.require("base.gl_matrix"),base.exportTo("base",function(){function e(e,t,i,n){return vec2.scale(o,t,n),vec2.scale(c,i,1-n),vec2.add(e,o,c),vec2.normalize(e,e),e}function t(){this.p1=vec2.create(),this.p2=vec2.create(),this.p3=vec2.create(),this.p4=vec2.create()}function i(e,t,i){return(e[0]-i[0])*(t[1]-i[1])-(t[0]-i[0])*(e[1]-i[1])}function n(e,t,n,r){var s=0>i(e,t,n);return n=0>i(e,n,r),e=0>i(e,r,t),s==n&&n==e}for(var r=[],s=0;8>s;s++)r[s]=vec2.create();var a=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 o=vec2.create(),c=vec2.create();return t.FromXYWH=function(e,i,n,r){var s=new t;return vec2.set(s.p1,e,i),vec2.set(s.p2,e+n,i),vec2.set(s.p3,e+n,i+r),vec2.set(s.p4,e,i+r),s},t.FromRect=function(e){return new t.FromXYWH(e.x,e.y,e.width,e.height)},t.From4Vecs=function(e,i,n,r){var s=new t;return vec2.set(s.p1,e[0],e[1]),vec2.set(s.p2,i[0],i[1]),vec2.set(s.p3,n[0],n[1]),vec2.set(s.p4,r[0],r[1]),s},t.From8Array=function(e){if(8!=e.length)throw Error("Array must be 8 long");var i=new t;return i.p1[0]=e[0],i.p1[1]=e[1],i.p2[0]=e[2],i.p2[1]=e[3],i.p3[0]=e[4],i.p3[1]=e[5],i.p4[0]=e[6],i.p4[1]=e[7],i},t.prototype={vecInside:function(e){return n(e,this.p1,this.p2,this.p3)||n(e,this.p1,this.p3,this.p4)},boundingRect:function(){var e=Math.min(this.p1[0],this.p2[0],this.p3[0],this.p4[0]),t=Math.min(this.p1[1],this.p2[1],this.p3[1],this.p4[1]),i=Math.max(this.p1[0],this.p2[0],this.p3[0],this.p4[0]),n=Math.max(this.p1[1],this.p2[1],this.p3[1],this.p4[1]);return new base.Rect.FromXYWH(e,t,i-e,n-t)},clone:function(){var e=new t;return vec2.copy(e.p1,this.p1),vec2.copy(e.p2,this.p2),vec2.copy(e.p3,this.p3),vec2.copy(e.p4,this.p4),e},scale:function(e){var i=new t;return this.scaleFast(i,e),i},scaleFast:function(e,t){vec2.copy(e.p1,this.p1,t),vec2.copy(e.p2,this.p2,t),vec2.copy(e.p3,this.p3,t),vec2.copy(e.p3,this.p3,t)},isRectangle:function(){var e=this.boundingRect();return e.x==this.p1[0]&&e.y==this.p1[1]&&e.width==this.p2[0]-this.p1[0]&&e.y==this.p2[1]&&e.width==this.p3[0]-this.p1[0]&&e.height==this.p3[1]-this.p2[1]&&e.x==this.p4[0]&&e.height==this.p4[1]-this.p2[1]},projectUnitRect:function(e){var i=new t;return this.projectUnitRectFast(i,e),i},projectUnitRectFast:function(t,i){var n,s,o,c,l=r[0],h=r[1],d=r[2],u=r[3];vec2.sub(l,this.p2,this.p1),n=vec2.length(l),vec2.scale(l,l,1/n),vec2.sub(h,this.p4,this.p1),s=vec2.length(h),vec2.scale(h,h,1/s),vec2.sub(d,this.p3,this.p2),o=vec2.length(d),vec2.scale(d,d,1/o),vec2.sub(u,this.p3,this.p4),c=vec2.length(u),vec2.scale(u,u,1/c);var p=r[0],_=r[1],g=r[2],m=r[3];e(p,l,u,i.y),e(m,l,u,1-i.bottom),e(_,h,d,i.x),e(g,h,d,1-i.right),vec2.addTwoScaledUnitVectors(a,p,n*i.x,_,s*i.y),vec2.add(t.p1,this.p1,a),vec2.addTwoScaledUnitVectors(a,p,n*-(1-i.right),g,o*i.y),vec2.add(t.p2,this.p2,a),vec2.addTwoScaledUnitVectors(a,m,c*-(1-i.right),g,o*-(1-i.bottom)),vec2.add(t.p3,this.p3,a),vec2.addTwoScaledUnitVectors(a,m,c*i.left,_,s*-(1-i.bottom)),vec2.add(t.p4,this.p4,a)},toString:function(){return"Quad("+vec2.toString(this.p1)+", "+vec2.toString(this.p2)+", "+vec2.toString(this.p3)+", "+vec2.toString(this.p4)+")"}},{vecInTriangle2:n,Quad:t}}),base.require("tracing.trace_model.trace_model_event"),base.exportTo("tracing.trace_model",function(){function e(){tracing.trace_model.TraceModelEvent.apply(this,arguments),this.type=void 0}function t(){e.apply(this,arguments),this.type=r.GLOBAL}function i(){e.apply(this,arguments),this.type=r.PROCESS}function n(){e.apply(this,arguments),this.type=r.THREAD}var r={GLOBAL:1,PROCESS:2,THREAD:3};return e.prototype={__proto__:tracing.trace_model.TraceModelEvent.prototype},t.prototype={__proto__:e.prototype},i.prototype={__proto__:e.prototype},n.prototype={__proto__:e.prototype},{GlobalInstantEvent:t,ProcessInstantEvent:i,ThreadInstantEvent:n,InstantEventType:r}}),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 e(t){if(!(t instanceof Object)){if(void 0===t||null===t)return t;if("string"==typeof t)return t.substring();if("boolean"==typeof t||"number"==typeof t)return t;throw Error("Unrecognized: "+typeof t)}if(t instanceof Array){for(var i=Array(t.length),n=0;n<t.length;n++)i[n]=e(t[n]);return i}if(t.__proto__!=Object.prototype)throw Error("Can only clone simple types");i={};for(n in t)i[n]=e(t[n]);return i}function t(e,t){if(this.importPriority=1,this.model_=e,this.systemTraceEvents_=this.events_=void 0,this.eventsWereFromString_=!1,this.allAsyncEvents_=[],this.allObjectEvents_=[],"string"==typeof t||t instanceof String?("["===t[0]&&(t=t.replace(/[\r|\n]*$/,"").replace(/\s*,\s*$/,""),"]"!==t[t.length-1]&&(t+="]")),this.events_=JSON.parse(t),this.eventsWereFromString_=!0):this.events_=t,this.events_.traceEvents){var i=this.events_;this.events_=this.events_.traceEvents,this.systemTraceEvents_=i.systemTraceEvents;for(var n in i)"traceEvents"!==n&&"systemTraceEvents"!==n&&this.model_.metadata.push({name:n,value:i[n]})}}return t.canImport=function(e){return"string"==typeof e||e instanceof String?"{"==e[0]||"["==e[0]:e instanceof Array&&e.length&&e[0].ph?!0:e.traceEvents?e.traceEvents instanceof Array&&e.traceEvents[0].ph:!1},t.prototype={__proto__:Object.prototype,extractSubtrace:function(){var e=this.systemTraceEvents_;return this.systemTraceEvents_=void 0,e},deepCopyIfNeeded_:function(t){return this.eventsWereFromString_?t:e(t)},processAsyncEvent:function(e){var t=this.model_.getOrCreateProcess(e.pid).getOrCreateThread(e.tid);this.allAsyncEvents_.push({event:e,thread:t})},processCounterEvent:function(e){var t;if(t=void 0!==e.id?e.name+"["+e.id+"]":e.name,t=this.model_.getOrCreateProcess(e.pid).getOrCreateCounter(e.cat,t),0===t.numSeries){for(var i in e.args)t.addSeries(new tracing.trace_model.CounterSeries(i,tracing.getStringColorId(t.name+"."+i)));if(0===t.numSeries)return this.model_.importErrors.push("Expected counter "+e.name+" to have at least one argument to use as a value."),void delete t.parent.counters[t.name]}var n=e.ts/1e3;t.series.forEach(function(t){t.addSample(n,e.args[t.name]?e.args[t.name]:0)})},processObjectEvent:function(e){var t=this.model_.getOrCreateProcess(e.pid).getOrCreateThread(e.tid);this.allObjectEvents_.push({event:e,thread:t})},processDurationEvent:function(e){var t=this.model_.getOrCreateProcess(e.pid).getOrCreateThread(e.tid);if(t.sliceGroup.isTimestampValidForBeginOrEnd(e.ts/1e3))if("B"==e.ph)t.sliceGroup.beginSlice(e.cat,e.name,e.ts/1e3,this.deepCopyIfNeeded_(e.args));else if(t.sliceGroup.openSliceCount){var i,t=t.sliceGroup.endSlice(e.ts/1e3);for(i in e.args)void 0!==t.args[i]&&this.model_.importErrors.push("Both the B and E phases of "+t.name+"provided values for argument "+i+". The value of the E phase event will be used."),t.args[i]=this.deepCopyIfNeeded_(e.args[i])}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(e){if("process_name"==e.name){var t=this.model_.getOrCreateProcess(e.pid);t.name=e.args.name}else"process_labels"==e.name?(t=this.model_.getOrCreateProcess(e.pid),t.labels.push.apply(t.labels,e.args.labels.split(","))):"process_sort_index"==e.name?(t=this.model_.getOrCreateProcess(e.pid),t.sortIndex=e.args.sort_index):"thread_name"==e.name?(t=this.model_.getOrCreateProcess(e.pid).getOrCreateThread(e.tid),t.name=e.args.name):"thread_sort_index"==e.name?(t=this.model_.getOrCreateProcess(e.pid).getOrCreateThread(e.tid),t.sortIndex=e.args.sort_index):this.model_.importErrors.push("Unrecognized metadata name: "+e.name)},processInstantEvent:function(e){var t;switch(e.s){case"g":t=tracing.trace_model.GlobalInstantEvent;break;case"p":t=tracing.trace_model.ProcessInstantEvent;break;default:t=tracing.trace_model.ThreadInstantEvent}var i=tracing.getStringColorId(e.name);switch(t=new t(e.cat,e.name,i,e.ts/1e3,this.deepCopyIfNeeded_(e.args)),t.type){case tracing.trace_model.InstantEventType.GLOBAL:this.model_.pushInstantEvent(t);break;case tracing.trace_model.InstantEventType.PROCESS:this.model_.getOrCreateProcess(e.pid).pushInstantEvent(t);break;case tracing.trace_model.InstantEventType.THREAD:this.model_.getOrCreateProcess(e.pid).getOrCreateThread(e.tid).sliceGroup.pushInstantEvent(t);break;default:throw Error("Unknown instant event type: "+e.s)}},processSampleEvent:function(e){this.model_.getOrCreateProcess(e.pid).getOrCreateThread(e.tid).addSample(e.cat,e.name,e.ts/1e3,this.deepCopyIfNeeded_(e.args))},importEvents:function(){for(var e=this.events_,t=0;t<e.length;t++){var i=e[t];"B"===i.ph||"E"===i.ph?this.processDurationEvent(i):"S"===i.ph||"F"===i.ph||"T"===i.ph?this.processAsyncEvent(i):"I"==i.ph||"i"==i.ph?this.processInstantEvent(i):"P"==i.ph?this.processSampleEvent(i):"C"==i.ph?this.processCounterEvent(i):"M"==i.ph?this.processMetadataEvent(i):"N"===i.ph||"D"===i.ph||"O"===i.ph?this.processObjectEvent(i):"s"!==i.ph&&"t"!==i.ph&&"f"!==i.ph&&this.model_.importErrors.push("Unrecognized event phase: "+i.ph+" ("+i.name+")")}},finalizeImport:function(){this.createAsyncSlices_(),this.createExplicitObjects_(),this.createImplicitObjects_()},joinRefs:function(){this.joinObjectRefs_()},createAsyncSlices_:function(){if(0!=this.allAsyncEvents_.length){this.allAsyncEvents_.sort(function(e,t){return e.event.ts-t.event.ts});for(var e={},t=this.allAsyncEvents_,i=0;i<t.length;i++){var n=t[i],r=n.event,s=r.name;if(void 0===s)this.model_.importErrors.push("Async events (ph: S, T or F) require an name parameter.");else{var a=r.id;if(void 0===a)this.model_.importErrors.push("Async events (ph: S, T or F) require an id parameter.");else if("S"==r.ph)void 0===e[s]&&(e[s]={}),e[s][a]?this.model_.importErrors.push("At "+r.ts+", a slice of the same id "+a+" was alrady open."):(e[s][a]=[],e[s][a].push(n));else if(void 0===e[s])this.model_.importErrors.push("At "+r.ts+", no slice named "+s+" was open.");else if(void 0===e[s][a])this.model_.importErrors.push("At "+r.ts+", no slice named "+s+" with id="+a+" was open.");else{var o=e[s][a];if(o.push(n),"F"==r.ph){var c=new tracing.trace_model.AsyncSlice(o[0].event.cat,s,tracing.getStringColorId(s),o[0].event.ts/1e3);for(c.duration=r.ts/1e3-o[0].event.ts/1e3,c.startThread=o[0].thread,c.endThread=n.thread,c.id=a,c.args=this.deepCopyIfNeeded_(o[0].event.args),c.subSlices=[],n=1;n<o.length;++n){var l=s;"T"==o[n-1].event.ph&&(l=s+":"+o[n-1].event.args.step),l=new tracing.trace_model.AsyncSlice(o[0].event.cat,l,tracing.getStringColorId(s+n),o[n-1].event.ts/1e3),l.duration=o[n].event.ts/1e3-o[n-1].event.ts/1e3,l.startThread=o[n-1].thread,l.endThread=o[n].thread,l.id=a,l.args=this.deepCopyIfNeeded_(o[n-1].event.args),c.subSlices.push(l)}var h,o=c.subSlices[c.subSlices.length-1];for(h in r.args)o.args[h]=this.deepCopyIfNeeded_(r.args[h]);c.startThread.asyncSliceGroup.push(c),delete e[s][a]}}}}}},createExplicitObjects_:function(){function e(e){var t=e.event;e=e.thread,void 0===t.name&&this.model_.importErrors.push("While processing "+JSON.stringify(t)+": Object events require an name parameter."),void 0===t.id&&this.model_.importErrors.push("While processing "+JSON.stringify(t)+": Object events require an id parameter."),e=e.parent;var i,n=t.ts/1e3;if("N"==t.ph)try{i=e.objects.idWasCreated(t.id,t.cat,t.name,n)}catch(r){return void this.model_.importErrors.push("While processing create of "+t.id+" at ts="+n+": "+r)}else if("O"==t.ph){if(void 0===t.args.snapshot)return void this.model_.importErrors.push("While processing "+t.id+" at ts="+n+": Snapshots must have args: {snapshot: ...}");var s;try{s=e.objects.addSnapshot(t.id,t.cat,t.name,n,this.deepCopyIfNeeded_(t.args.snapshot))}catch(a){return void this.model_.importErrors.push("While processing snapshot of "+t.id+" at ts="+n+": "+a)}i=s.objectInstance}else if("D"==t.ph)try{i=e.objects.idWasDeleted(t.id,t.cat,t.name,n)}catch(o){return void this.model_.importErrors.push("While processing delete of "+t.id+" at ts="+n+": "+o)}i&&(i.colorId=tracing.getStringColorId(i.typeName))}if(0!=this.allObjectEvents_.length){this.allObjectEvents_.sort(function(e,t){return e.event.ts-t.event.ts});for(var t=this.allObjectEvents_,i=0;i<t.length;i++){var n=t[i];try{e.call(this,n)}catch(r){this.model_.importErrors.push(r.message)}}}},createImplicitObjects_:function(){base.iterItems(this.model_.processes,function(e,t){this.createImplicitObjectsForProcess_(t)},this)},createImplicitObjectsForProcess_:function(e){function t(t,i,n,r){if(n&&void 0!==n.id&&!(n instanceof tracing.trace_model.ObjectSnapshot)){var s=n.id,a=/(.+)\/(.+)/.exec(s);if(!a)throw Error("Implicit snapshots must have names.");delete n.id;var o,c=a[1],a=a[2];try{o=e.objects.addSnapshot(a,r.objectInstance.category,c,r.ts,n)}catch(l){return void this.model_.importErrors.push("While processing implicit snapshot of "+s+" at ts="+r.ts+": "+l)}if(o.objectInstance.hasImplicitSnapshots=!0,o.containingSnapshot=r,t[i]=o,!(o instanceof tracing.trace_model.ObjectSnapshot))throw Error("Created object must be instanceof snapshot");return o.args}}function i(e,t,n,r){if(e instanceof Object)if(e instanceof Array)for(var s=0;s<e.length;s++){var a=t.call(r,e,s,e[s],n);a?i(a,t,n,r):i(e[s],t,n,r)}else for(s in e)(a=t.call(r,e,s,e[s],n))?i(a,t,n,r):i(e[s],t,n,r)}e.objects.iterObjectInstances(function(e){e.snapshots.forEach(function(e){if(void 0!==e.args.id)throw Error("args cannot have an id field inside it");i(e.args,t,e,this)},this)},this)},joinObjectRefs_:function(){base.iterItems(this.model_.processes,function(e,t){this.joinObjectRefsForProcess_(t)},this)},joinObjectRefsForProcess_:function(e){var t=[];base.iterItems(e.threads,function(i,n){n.asyncSliceGroup.slices.forEach(function(i){this.searchItemForIDRefs_(t,e.objects,"start",i)},this),n.sliceGroup.slices.forEach(function(i){this.searchItemForIDRefs_(t,e.objects,"start",i)},this)},this),e.objects.iterObjectInstances(function(i){i.snapshots.forEach(function(i){this.searchItemForIDRefs_(t,e.objects,"ts",i)},this)},this),t.forEach(function(e){e.object[e.field]=e.value})},searchItemForIDRefs_:function(e,t,i,n){function r(r,s,a){void 0!==a&&(a.id_ref||a.idRef)&&(a=t.getSnapshotAt(a.id_ref||a.idRef,n[i]))&&e.push({object:r,field:s,value:a})}function s(e){if(e instanceof Object&&!(e instanceof tracing.trace_model.ObjectSnapshot||e instanceof Float32Array||e instanceof base.Quad))if(e instanceof Array)for(var t=0;t<e.length;t++)r(e,t,e[t]),s(e[t]);else for(t in e){var i=e[t];r(e,t,i),s(i)}}if(!n.args)throw Error("");s(n.args)}},tracing.TraceModel.registerImporter(t),{TraceEventImporter:t}}),base.exportTo("tracing.importer.v8",function(){function e(){}return e.prototype.root_=null,e.prototype.isEmpty=function(){return!this.root_},e.prototype.insert=function(t,i){if(this.isEmpty())this.root_=new e.Node(t,i);else if(this.splay_(t),this.root_.key!=t){var n=new e.Node(t,i);t>this.root_.key?(n.left=this.root_,n.right=this.root_.right,this.root_.right=null):(n.right=this.root_,n.left=this.root_.left,this.root_.left=null),this.root_=n}},e.prototype.remove=function(e){if(this.isEmpty())throw Error("Key not found: "+e);if(this.splay_(e),this.root_.key!=e)throw Error("Key not found: "+e);var t=this.root_;if(this.root_.left){var i=this.root_.right;this.root_=this.root_.left,this.splay_(e),this.root_.right=i}else this.root_=this.root_.right;return t},e.prototype.find=function(e){return this.isEmpty()?null:(this.splay_(e),this.root_.key==e?this.root_:null)},e.prototype.findMin=function(){if(this.isEmpty())return null;for(var e=this.root_;e.left;)e=e.left;return e},e.prototype.findMax=function(e){if(this.isEmpty())return null;for(e=e||this.root_;e.right;)e=e.right;return e},e.prototype.findGreatestLessThan=function(e){return this.isEmpty()?null:(this.splay_(e),this.root_.key<=e?this.root_:this.root_.left?this.findMax(this.root_.left):null)},e.prototype.exportKeysAndValues=function(){var e=[];return this.traverse_(function(t){e.push([t.key,t.value])}),e},e.prototype.exportValues=function(){var e=[];return this.traverse_(function(t){e.push(t.value)}),e},e.prototype.splay_=function(t){if(!this.isEmpty()){var i,n,r;i=n=r=new e.Node(null,null);for(var s=this.root_;;)if(t<s.key){if(!s.left)break;if(t<s.left.key){var a=s.left;if(s.left=a.right,a.right=s,s=a,!s.left)break}r=r.left=s,s=s.left}else{if(!(t>s.key))break;if(!s.right)break;if(t>s.right.key&&(a=s.right,s.right=a.left,a.left=s,s=a,!s.right))break;n=n.right=s,s=s.right}n.right=s.left,r.left=s.right,s.left=i.right,s.right=i.left,this.root_=s}},e.prototype.traverse_=function(e){for(var t=[this.root_];0<t.length;){var i=t.shift();null!=i&&(e(i),t.push(i.left),t.push(i.right))}},e.Node=function(e,t){this.key=e,this.value=t},e.Node.prototype.left=null,e.Node.prototype.right=null,{SplayTree:e}
+}),base.require("tracing.importer.v8.splaytree"),base.exportTo("tracing.importer.v8",function(){function e(){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_=[]}return e.PAGE_ALIGNMENT=12,e.PAGE_SIZE=1<<e.PAGE_ALIGNMENT,e.prototype.addCode=function(e,t){this.deleteAllCoveredNodes_(this.dynamics_,e,e+t.size),this.dynamics_.insert(e,t)},e.prototype.moveCode=function(e,t){var i=this.dynamics_.remove(e);this.deleteAllCoveredNodes_(this.dynamics_,t,t+i.value.size),this.dynamics_.insert(t,i.value)},e.prototype.deleteCode=function(e){this.dynamics_.remove(e)},e.prototype.addLibrary=function(e,t){this.markPages_(e,e+t.size),this.libraries_.insert(e,t)},e.prototype.addStaticCode=function(e,t){this.statics_.insert(e,t)},e.prototype.markPages_=function(t,i){for(var n=t;i>=n;n+=e.PAGE_SIZE)this.pages_[n>>>e.PAGE_ALIGNMENT]=1},e.prototype.deleteAllCoveredNodes_=function(e,t,i){for(var n=[],r=i-1;r>=t;){var s=e.findGreatestLessThan(r);if(!s)break;r=s.key,s=r+s.value.size,i>r&&s>t&&n.push(r),r-=1}for(t=0,i=n.length;i>t;++t)e.remove(n[t])},e.prototype.isAddressBelongsTo_=function(e,t){return e>=t.key&&e<t.key+t.value.size},e.prototype.findInTree_=function(e,t){var i=e.findGreatestLessThan(t);return i&&this.isAddressBelongsTo_(t,i)?i.value:null},e.prototype.findEntry=function(t){if(t>>>e.PAGE_ALIGNMENT in this.pages_)return this.findInTree_(this.statics_,t)||this.findInTree_(this.libraries_,t);var i=this.dynamics_.findMin(),n=this.dynamics_.findMax();return null!=n&&t<n.key+n.value.size&&t>=i.key?(t=this.findInTree_(this.dynamics_,t),null==t?null:(t.nameUpdated_||(t.name=this.dynamicsNameGen_.getName(t.name),t.nameUpdated_=!0),t)):null},e.prototype.findDynamicEntryByStartAddress=function(e){return(e=this.dynamics_.find(e))?e.value:null},e.prototype.getAllDynamicEntries=function(){return this.dynamics_.exportValues()},e.prototype.getAllDynamicEntriesWithAddresses=function(){return this.dynamics_.exportKeysAndValues()},e.prototype.getAllStaticEntries=function(){return this.statics_.exportValues()},e.prototype.getAllLibrariesEntries=function(){return this.libraries_.exportValues()},e.CodeEntry=function(e,t){this.size=e,this.name=t||"",this.nameUpdated_=!1},e.CodeEntry.prototype.getName=function(){return this.name},e.CodeEntry.prototype.toString=function(){return this.name+": "+this.size.toString(16)},e.NameGenerator=function(){this.knownNames_={}},e.NameGenerator.prototype.getName=function(e){if(!(e in this.knownNames_))return this.knownNames_[e]=0,e;var t=++this.knownNames_[e];return e+" {"+t+"}"},{CodeMap:e}}),base.exportTo("tracing.importer.v8",function(){function e(){}function t(t){this.dispatchTable_=t,this.lineNum_=0,this.csvParser_=new e}return e.CSV_FIELD_RE_=/^"((?:[^"]|"")*)"|([^,]*)/,e.DOUBLE_QUOTE_RE_=/""/g,e.prototype.parseLine=function(t){var i=e.CSV_FIELD_RE_,n=e.DOUBLE_QUOTE_RE_,r=0,s=t.length,a=[];if(s>0)do{var o=i.exec(t.substr(r));"string"==typeof o[1]?(o=o[1],r+=o.length+3,a.push(o.replace(n,'"'))):(o=o[2],r+=o.length+1,a.push(o))}while(s>=r);return a},t.prototype.printError=function(){},t.prototype.processLogChunk=function(e){this.processLog_(e.split("\n"))},t.prototype.processLogLine=function(e){this.processLog_([e])},t.prototype.processStack=function(e,t,i){t=t?[e,t]:[e];for(var n=0,r=i.length;r>n;++n){var s=i[n],a=s.charAt(0);"+"==a||"-"==a?(e+=parseInt(s,16),t.push(e)):"o"!=a&&t.push(parseInt(s,16))}return t},t.prototype.skipDispatch=function(){return!1},t.prototype.dispatchLogRow_=function(e){var t=e[0];if(t in this.dispatchTable_&&(t=this.dispatchTable_[t],null!==t&&!this.skipDispatch(t))){for(var i=[],n=0;n<t.parsers.length;++n){var r=t.parsers[n];if(null===r)i.push(e[1+n]);else{if("function"!=typeof r){i.push(e.slice(1+n));break}i.push(r(e[1+n]))}}t.processor.apply(this,i)}},t.prototype.processLog_=function(e){for(var t=0,i=e.length;i>t;++t,++this.lineNum_){var n=e[t];if(n)try{var r=this.csvParser_.parseLine(n);this.dispatchLogRow_(r)}catch(s){this.printError("line "+(this.lineNum_+1)+": "+(s.message||s))}}},{LogReader:t}}),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 e(e,t){this.importPriority=3,this.model_=e,this.logData_=t,this.code_map_=new tracing.importer.v8.CodeMap,this.v8_samples_thread_=this.v8_stack_thread_=this.v8_timer_thread_=void 0}var t=["/d8","/libv8.so"],i={"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}};return e.canImport=function(e){return"string"==typeof e||e instanceof String?"timer-event,"==e.substring(0,12)||"tick,"==e.substring(0,5)||"shared-library,"==e.substring(0,15)||"profiler,"==e.substring(0,9):!1},e.prototype={__proto__:Object.prototype,extractSubtrace:function(){},processTimerEvent_:function(e,t,n){var r=i[e];if(void 0!==r){t/=1e3,n/=1e3;var s=tracing.getStringColorId(e);e=new tracing.trace_model.Slice("v8",e,s,t,r,n),this.v8_timer_thread_.sliceGroup.pushSlice(e)}},processTimerEventStart_:function(e,t){var n=i[e];void 0!==n&&this.v8_timer_thread_.sliceGroup.beginSlice("v8",e,t/1e3,n)},processTimerEventEnd_:function(e,t){this.v8_timer_thread_.sliceGroup.endSlice(t/1e3)},processCodeCreateEvent_:function(e,t,i,n,r){e=new tracing.importer.v8.CodeMap.CodeEntry(n,r),e.kind=t,this.code_map_.addCode(i,e)},processCodeMoveEvent_:function(e,t){this.code_map_.moveCode(e,t)},processCodeDeleteEvent_:function(e){this.code_map_.deleteCode(e)},processSharedLibrary_:function(e,i,n){n=new tracing.importer.v8.CodeMap.CodeEntry(n-i,e),n.kind=-3;for(var r=0;r<t.length;r++){var s=t[r];if(0<=e.indexOf(s,e.length-s.length)){n.kind=-1;break}}this.code_map_.addLibrary(i,n)},findCodeKind_:function(e){for(name in CodeKinds)if(0<=CodeKinds[name].kinds.indexOf(e))return CodeKinds[name]},nameForCodeEntry_:function(e){return e?e.name:"UnknownCode"},processTickEvent_:function(e,t,i,n,r,s,a){if(t=this.code_map_.findEntry(e),t=this.nameForCodeEntry_(t),i/=1e3,this.v8_samples_thread_.addSample("v8",t,i),a&&a.length)for(e=0;8>e&&a[e];e++)t=this.code_map_.findEntry(a[e]),t=this.nameForCodeEntry_(t),n=tracing.getStringColorId(t),t=new tracing.trace_model.Slice("v8",t,n,i,{},0),this.v8_stack_thread_.sliceGroup.pushSlice(t)},processDistortion_:function(e){distortion_per_entry=e/1e6},processPlotRange_:function(e,t){xrange_start_override=e,xrange_end_override=t},importEvents:function(){var e=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 t=this.logData_.split("\n"),i=0;i<t.length;i++)e.processLogLine(t[i])},finalizeImport:function(){},joinRefs:function(){}},tracing.TraceModel.registerImporter(e),{V8LogImporter:e}}),base.require("tracing.importer.linux_perf_importer"),base.require("tracing.importer.trace_event_importer"),base.require("tracing.importer.v8_log_importer"),base.exportTo("tracing.analysis",function(){return{tsRound:function(e){return Math.round(1e3*e)/1e3}}}),base.require("base.events"),base.require("base.guid"),base.require("base.range"),base.exportTo("tracing",function(){function e(e,t){this.track=e,this.slice=t}function t(e,t,i){this.track=e,this.counter=t,this.sampleIndex=i}function i(e,t){this.track=e,this.objectSnapshot=t}function n(e,t){this.track=e,this.objectInstance=t}function r(e){this.bounds_dirty_=!0,this.bounds_=new base.Range,this.length_=0,this.guid_=base.GUID.allocate(),e&&this.pushHits(e)}e.prototype={get modelObject(){return this.slice},get selected(){return this.slice.selected},set selected(e){this.slice.selected=e},addBoundsToRange:function(e){e.addValue(this.slice.start),e.addValue(this.slice.end)}},t.prototype={get modelObject(){return this.sampleIndex},get selected(){return 1==this.track.selectedSamples[this.sampleIndex]},set selected(e){this.track.selectedSamples[this.sampleIndex]=e?!0:!1},addBoundsToRange:function(e){this.track.timestamps&&e.addValue(this.track.timestamps[this.sampleIndex])}},i.prototype={get modelObject(){return this.objectSnapshot},get selected(){return this.objectSnapshot.selected},set selected(e){this.objectSnapshot.selected=e},addBoundsToRange:function(e){e.addValue(this.objectSnapshot.ts)}},n.prototype={get modelObject(){return this.objectInstance},get selected(){return this.objectInstance.selected},set selected(e){this.objectInstance.selected=e},addBoundsToRange:function(e){e.addRange(this.objectInstance.bounds)}};var s=[{constructor:e,name:"slice",pluralName:"slices"},{constructor:t,name:"counterSample",pluralName:"counterSamples"},{constructor:i,name:"objectSnapshot",pluralName:"objectSnapshots"},{constructor:n,name:"objectInstance",pluralName:"objectInstances"}];return r.prototype={__proto__:Object.prototype,get bounds(){if(this.bounds_dirty_){this.bounds_.reset();for(var e=0;e<this.length_;e++)this[e].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 e=0;e<this.length_;++e)delete this[e];this.length_=0,this.bounds_dirty_=!0},pushHit:function(e){this.push_(e)},pushHits:function(e){for(var t=0;t<e.length;t++)this.pushHit(e[t])},push_:function(e){return this[this.length_++]=e,this.bounds_dirty_=!0,e},addSlice:function(t,i){return this.push_(new e(t,i))},addCounterSample:function(e,i,n){return this.push_(new t(e,i,n))},addObjectSnapshot:function(e,t){return this.push_(new i(e,t))},addObjectInstance:function(e,t){return this.push_(new n(e,t))},addSelection:function(e){for(var t=0;t<e.length;t++)this.push_(e[t])},subSelection:function(e,t){t=t||1;var i=new r;if(i.bounds_dirty_=!0,0>e||e+t>this.length_)throw Error("Index out of bounds");for(var n=e;e+t>n;n++)i.push_(this[n]);return i},getCounterSampleHitsAsSelection:function(){var e=new r;return this.enumHitsOfType(t,e.push_.bind(e)),e},getSliceHitsAsSelection:function(){var t=new r;return this.enumHitsOfType(e,t.push_.bind(t)),t},getHitsOrganizedByType:function(){var e={};s.forEach(function(t){e[t.pluralName]=new r});for(var t=0;t<this.length_;t++){var i=this[t];s.forEach(function(t){i instanceof t.constructor&&e[t.pluralName].push_(i)})}return e},enumHitsOfType:function(e,t){for(var i=0;i<this.length_;i++)this[i]instanceof e&&t(this[i])},getNumSliceHits:function(){var t=0;return this.enumHitsOfType(e,function(){t++}),t},getNumCounterHits:function(){var e=0;return this.enumHitsOfType(t,function(){e++}),e},getNumObjectSnapshotHits:function(){var e=0;return this.enumHitsOfType(i,function(){e++}),e},getNumObjectInstanceHits:function(){var e=0;return this.enumHitsOfType(n,function(){e++}),e},map:function(e){for(var t=0;t<this.length_;t++)e(this[t])},getShiftedSelection:function(e){for(var t=new r,i=0;i<this.length_;i++){var n=this[i];n.track.addItemNearToProvidedHitToSelection(n,e,t)}return 0==t.length?void 0:t}},{SelectionSliceHit:e,SelectionCounterSampleHit:t,SelectionObjectSnapshotHit:i,SelectionObjectInstanceHit:n,Selection:r,createSelectionFromObjectAndView:function(e){var t=new r;if(e instanceof tracing.trace_model.Slice)t.addSlice(void 0,e);else if(e instanceof tracing.trace_model.ObjectSnapshot)t.addObjectSnapshot(void 0,e);else{if(!(e instanceof tracing.trace_model.ObjectInstance))throw Error("Unrecognized selection type");t.addObjectInstance(void 0,e)}return t}}}),base.exportTo("ui",function(){return{decorate:function(e,t){var i;i="string"==typeof e?base.doc.querySelectorAll(e):[e];for(var n,r=0;n=i[r];r++)n instanceof t||t.decorate(n)},define:function(e,t){function i(){if(t&&i.prototype.__proto__!=t.prototype)throw Error(e+" prototye's __proto__ field is messed up. It MUST be the prototype of "+t.tagName);var n=e;if(t)for(var r=t;r&&r.tagName;)n=r.tagName,r=r.parentConstructor;return n=base.doc.createElement(n),i.decorate.call(this,n,arguments),n}if("function"==typeof e)throw Error("Passing functions as tagName is deprecated. Please use (tagName, opt_parentConstructor) to subclass");if(e=e.toLowerCase(),t&&!t.tagName)throw Error("opt_parentConstructor was not created by ui.define");return i.decorate=function(e,t){e.__proto__=i.prototype,e.decorate.apply(e,t)},i.tagName=e,i.parentConstructor=t?t:void 0,i.toString=function(){return i.parentConstructor?i.parentConstructor.toString()+"::"+i.tagName:i.tagName},i},elementIsChildOf:function(e,t){if(e==t)return!1;for(var i=e;i.parentNode;){if(i==t)return!0;i=i.parentNode}return!1}}}),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 e=tracing.analysis.tsRound,t=base.Event.bind(void 0,"requestSelectionChange",!0,!1),i=ui.define("a");i.prototype={__proto__:HTMLAnchorElement.prototype,decorate:function(){this.classList.add("analysis-link"),this.selectionGenerator,this.addEventListener("click",this.onClicked_.bind(this))},onClicked_:function(){var e=new t;e.selection=this.selectionGenerator(),this.dispatchEvent(e)}};var n=ui.define("object-snapshot-link",i);n.prototype={__proto__:i.prototype,decorate:function(){i.prototype.decorate.apply(this)},set objectSnapshot(t){this.textContent=t.objectInstance.typeName+" "+t.objectInstance.id+" @ "+e(t.ts)+" ms",this.selectionGenerator=function(){return tracing.createSelectionFromObjectAndView(t,this)}.bind(this)}};var r=ui.define("object-instance-link",i);return r.prototype={__proto__:i.prototype,decorate:function(){i.prototype.decorate.apply(this)},set objectInstance(e){this.textContent=e.typeName+" "+e.id,this.selectionGenerator=function(){return tracing.createSelectionFromObjectAndView(e,this)}.bind(this)}},{RequestSelectionChangeEvent:t,AnalysisLink:i,ObjectSnapshotLink:n,ObjectInstanceLink:r}}),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 e=ui.define("x-generic-object-view");return e.prototype={__proto__:HTMLUnknownElement.prototype,decorate:function(){this.object_=void 0},get object(){return this.object_},set object(e){this.object_=e,this.updateContents_()},updateContents_:function(){this.textContent="",this.appendElementsForType_("",this.object_,0,0,5,"")},appendElementsForType_:function(e,t,i,n,r,s){n>r?this.appendSimpleText_(e,i,"<recursion limit reached>",s):void 0===t?this.appendSimpleText_(e,i,"undefined",s):null===t?this.appendSimpleText_(e,i,"null",s):t instanceof Object?t instanceof tracing.trace_model.ObjectSnapshot?(n=new tracing.analysis.ObjectSnapshotLink(t),n.objectSnapshot=t,this.appendElementWithLabel_(e,i,n,s)):t instanceof tracing.trace_model.ObjectInstance?(n=new tracing.analysis.ObjectInstanceLink(t),n.objectInstance=t,this.appendElementWithLabel_(e,i,n,s)):t instanceof Array?this.appendElementsForArray_(e,t,i,n,r,s):this.appendElementsForObject_(e,t,i,n,r,s):"string"==typeof t?this.appendSimpleText_(e,i,'"'+t+'"',s):this.appendSimpleText_(e,i,t,s)},appendElementsForArray_:function(e,t,i,n,r,s){if(0==t.length)this.appendSimpleText_(e,i,"[]",s);else{this.appendElementsForType_(e+"[",t[0],i,n+1,r,1<t.length?",":"]"+s);for(var a=1;a<t.length;a++)this.appendElementsForType_("",t[a],i+e.length+1,n+1,r,a<t.length-1?",":"]"+s)}},appendElementsForObject_:function(e,t,i,n,r,s){var a=base.dictionaryKeys(t);if(0==a.length)this.appendSimpleText_(e,i,"{}",s);else{this.appendElementsForType_(e+"{"+a[0]+": ",t[a[0]],i,n,r,1<a.length?",":"}"+s);for(var o=1;o<a.length;o++)this.appendElementsForType_(a[o]+": ",t[a[o]],i+e.length+1,n+1,r,o<a.length-1?",":"}"+s)}},appendElementWithLabel_:function(e,t,i,n){var r=document.createElement("div"),s=document.createElement("span");s.style.whiteSpace="pre";for(var a=0;t>a;a++)s.textContent+=" ";r.appendChild(s),t=document.createElement("span"),t.textContent=e,r.appendChild(t),r.appendChild(i),e=document.createElement("span"),e.textContent=n,r.appendChild(e),r.dataElement=i,this.appendChild(r)},appendSimpleText_:function(e,t,i,n){var r=this.ownerDocument.createElement("span");return r.textContent=i,this.appendElementWithLabel_(e,t,r,n),r}},{GenericObjectView:e}}),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 e=ui.define("div");return e.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="analysis-results"},clear:function(){this.textContent=""},createSelectionChangingLink:function(e,t,i){var n=this.ownerDocument.createElement("a");return tracing.analysis.AnalysisLink.decorate(n),n.textContent=e,n.selectionGenerator=t,i&&(n.title=i),n},appendElement_:function(e,t,i){return t=e.ownerDocument.createElement(t),e.appendChild(t),void 0!=i&&(t.textContent=i),t},appendText_:function(e,t){return e.ownerDocument.createTextNode(t),e.appendChild(textNode),textNode},appendTableCell_:function(e,t,i,n){return t=this.appendElement_(t,"td",n),t.className=e.className+"-col-"+i,t},appendTableCell:function(e,t,i){return this.appendTableCell_(e,t,t.children.length,i)},appendTableCellWithTooltip_:function(e,t,i,n,r){return r?(t=this.appendElement_(t,"td"),t.className=e.className+"-col-"+i,e=this.appendElement_(t,"span",n),e.className="tooltip",e.title=r,t):void this.appendTableCell_(e,t,i,n)},appendTable:function(e,t){var i=this.appendElement_(this,"table");return i.headerRow=this.appendElement_(i,"tr"),i.className=e+" analysis-table",i.numColumns=t,i},appendTableHeader:function(e,t){this.appendElement_(e.headerRow,"th",t).className="analysis-table-header"},appendTableRow:function(e){return this.appendElement_(e,"tr")},appendSummaryRow:function(e,t,i){var n=this.appendElement_(e,"tr");for(n.className="analysis-table-row",this.appendTableCell_(e,n,0,t),void 0!==i?(t=new tracing.analysis.GenericObjectView,t.object=i,t.classList.add("analysis-table-col-1"),t.style.display="table-cell",n.appendChild(t)):this.appendTableCell_(e,n,1,""),i=2;i<e.numColumns;i++)this.appendTableCell_(e,n,i,"")},appendSpacingRow:function(e){var t=this.appendElement_(e,"tr");t.className="analysis-table-row";for(var i=0;i<e.numColumns;i++)this.appendTableCell_(e,t,i," ")},appendSummaryRowTime:function(e,t,i){this.appendSummaryRow(e,t,tracing.analysis.tsRound(i)+" ms")},appendDataRow:function(e,t,i,n,r,s){var a=void 0;if(r&&(a="Min Duration:    "+tracing.analysis.tsRound(r.min)+" ms \rMax Duration:  "+tracing.analysis.tsRound(r.max)+" ms \rAvg Duration:  "+tracing.analysis.tsRound(r.avg)+" ms (σ = "+tracing.analysis.tsRound(r.avg_stddev)+")",r.start&&(a+="\rStart Time:   "+tracing.analysis.tsRound(r.start)+" ms"),r.end&&(a+="\rEnd Time:      "+tracing.analysis.tsRound(r.end)+" ms"),r.frequency&&r.frequency_stddev&&(a+="\rFrequency:     "+tracing.analysis.tsRound(r.frequency)+" occurrences/s (σ = "+tracing.analysis.tsRound(r.frequency_stddev)+")")),r=this.appendElement_(e,"tr"),r.className="analysis-table-row",s){var o=this.appendTableCellWithTooltip_(e,r,0,t,a);o.textContent="",o.appendChild(this.createSelectionChangingLink(t,s,a))}else this.appendTableCellWithTooltip_(e,r,0,t,a);void 0!==i?i instanceof Array?this.appendTableCellWithTooltip_(e,r,1,"["+i.join(", ")+"]",a):this.appendTableCellWithTooltip_(e,r,1,tracing.analysis.tsRound(i)+" ms",a):this.appendTableCell_(e,r,1,""),void 0!==n?this.appendTableCellWithTooltip_(e,r,2,String(n)+" occurrences",a):this.appendTableCell_(e,r,2,"")}},{AnalysisResults:e}}),base.require("tracing.analysis.util"),base.require("ui"),base.exportTo("tracing.analysis",function(){return{analyzeSingleCounterSampleHit:function(e,t){for(var i=t.counter,n=t.sampleIndex,r=[],s=0;s<i.numSeries;++s)r.push(i.getSeries(s).getSample(n).value);var a=e.appendTable("analysis-counter-table",2);for(e.appendTableHeader(a,"Selected counter:"),e.appendSummaryRow(a,"Title",i.name),e.appendSummaryRowTime(a,"Timestamp",i.timestamps[n]),s=0;s<i.numSeries;s++)e.appendSummaryRow(a,i.getSeries(s).name,r[s])},analyzeMultipleCounterSampleHits:function(e,t){for(var i={},n=0;n<t.length;n++){var r=t[n].counter;i[r.guid]||(i[r.guid]=[]),i[r.guid].push(t[n])}var s=e.appendTable("analysis-counter-table",2);e.appendTableHeader(s,"Counters:");for(var a in i){for(var o=i[a],r=o[0].counter,c=[],n=0;n<o.length;n++)c.push(o[n].sampleIndex);for(o=r.getSampleStatistics(c),n=0;n<o.length;n++){for(var l=[],h=0;h<c.length;++h)l.push(r.getSeries(n).getSample(c[h]).value);e.appendDataRow(s,r.name+": series("+r.getSeries(n).name+")",l,l.length,o[n])}}}}}),base.requireStylesheet("tracing.analysis.analyze_slices"),base.require("tracing.analysis.util"),base.require("ui"),base.exportTo("tracing.analysis",function(){function e(e,t){var i=t.slice,n=e.appendTable("analysis-slice-table",2);e.appendTableHeader(n,"Selected slice:"),e.appendSummaryRow(n,"Title",i.title),i.category&&e.appendSummaryRow(n,"Category",i.category),e.appendSummaryRowTime(n,"Start",i.start),e.appendSummaryRowTime(n,"Duration",i.duration),i.durationInUserTime&&e.appendSummaryRowTime(n,"Duration (U)",i.durationInUserTime);var r,s=0;for(r in i.args)s+=1;if(s>0)for(r in e.appendSummaryRow(n,"Args"),i.args)e.appendSummaryRow(n," "+r,i.args[r])}return{analyzeSingleSliceHit:e,analyzeMultipleSliceHits:function(t,i){var n=i.bounds.min,r=i.bounds.max;i.map(function(e){return e.slice.title});for(var s=0,a={},o=0;o<i.length;o++){var c=i[o].slice;a[c.title]||(a[c.title]={hits:[]},s++),a[c.title].hits.push(i[o])}var l;l=t.appendTable("analysis-slices-table",3),t.appendTableHeader(l,"Slices:");var h=0;base.iterItems(a,function(i,n){for(var r=0,a=0,o=Number.MAX_VALUE,c=-Number.MAX_VALUE,d=Number.MAX_VALUE,u=-Number.MAX_VALUE,a=0;a<n.hits.length;a++)var p=n.hits[a].slice,r=r+p.duration,o=Math.min(p.start,o),c=Math.max(p.start,c),d=Math.min(p.duration,d),u=Math.max(p.duration,u);for(h+=r,0==n.hits.length&&(a=0),a=r/n.hits.length,d={min:d,max:u,avg:a,avg_stddev:void 0,frequency:void 0,frequency_stddev:void 0},a=u=0;a<n.hits.length;a++)p=d.avg-n.hits[a].slice.duration,u+=p*p;if(d.avg_stddev=Math.sqrt(u/(n.hits.length-1)),c-=o,2<n.hits.length&&c>0){for(o=n.hits.length-1,d.frequency=1e3*o/c,u=0,a=1;a<n.hits.length;a++)p=d.frequency-1e3/(n.hits[a].slice.start-n.hits[a-1].slice.start),u+=p*p;d.frequency_stddev=Math.sqrt(u/(o-1))}if(t.appendDataRow(l,i,r,n.hits.length,d,function(){return new tracing.Selection(n.hits)}),1===s)for(a=0;a<n.hits.length;a++)e(t,n.hits[a])}),1!==s&&(t.appendDataRow(l,"*Totals",h,i.length),t.appendSpacingRow(l)),t.appendSummaryRowTime(l,"Selection start",n),t.appendSummaryRowTime(l,"Selection extent",r-n)}}}),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 e(e,i){var n=i.slices,r=i.counterSamples,s=new tracing.Selection;s.addSelection(i.objectSnapshots),s.addSelection(i.objectInstances),1==n.length?tracing.analysis.analyzeSingleSliceHit(e,n[0]):1<n.length&&tracing.analysis.analyzeMultipleSliceHits(e,n),1==r.length?tracing.analysis.analyzeSingleCounterSampleHit(e,r[0]):1<r.length&&tracing.analysis.analyzeMultipleCounterSampleHits(e,r),s.length&&t(e,s)}function t(e,t){t=base.asArray(t).sort(base.Range.compareByMinTimes);var i=e.appendTable("analysis-object-sample-table",2);e.appendTableHeader(i,"Selected Objects:"),t.forEach(function(t){var n,r,s,a=e.appendTableRow(i);if(t instanceof tracing.SelectionObjectSnapshotHit){var o=t.objectSnapshot;n=tracing.analysis.tsRound(o.ts),r=o.objectInstance.typeName+" "+o.objectInstance.id,s=function(){var e=new tracing.Selection;return e.addObjectSnapshot(t.track,o),e}}else{var c=t.objectInstance;n=c.deletionTs==Number.MAX_VALUE?"":tracing.analysis.tsRound(c.deletionTs),n=tracing.analysis.tsRound(c.creationTs)+"-"+n,r=c.typeName+" "+c.id,s=function(){var e=new tracing.Selection;return e.addObjectInstance(t.track,c),e}}e.appendTableCell(i,a,n),e.appendTableCell(i,a,"").appendChild(e.createSelectionChangingLink(r,s))})}return{analyzeSelection:function(t,i){e(t,i.getHitsOrganizedByType())},analyzeHitsByType:e}}),base.require("ui"),base.exportTo("tracing.analysis",function(){var e=ui.define("object-instance-view");return e.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.objectInstance_=void 0},set modelObject(e){this.objectInstance=e},get modelObject(){return this.objectInstance},get objectInstance(){return this.objectInstance_},set objectInstance(e){this.objectInstance_=e,this.updateContents()},updateContents:function(){throw Error("Not implemented")}},e.typeNameToViewInfoMap={},e.register=function(t,i,n){if(e.typeNameToViewInfoMap[t])throw Error("Handler already registerd for "+t);e.typeNameToViewInfoMap[t]={constructor:i,options:n||{showInTrackView:!0}}},e.unregister=function(t){if(void 0===e.typeNameToViewInfoMap[t])throw Error(t+" not registered");delete e.typeNameToViewInfoMap[t]},e.getViewInfo=function(t){return e.typeNameToViewInfoMap[t]},{ObjectInstanceView:e}}),base.require("ui"),base.exportTo("tracing.analysis",function(){var e=ui.define("object-snapshot-view");return e.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.objectSnapshot_=void 0},set modelObject(e){this.objectSnapshot=e},get modelObject(){return this.objectSnapshot},get objectSnapshot(){return this.objectSnapshot_},set objectSnapshot(e){this.objectSnapshot_=e,this.updateContents()},updateContents:function(){throw Error("Not implemented")}},e.typeNameToViewInfoMap={},e.register=function(t,i,n){if(e.typeNameToViewInfoMap[t])throw Error("Handler already registered for "+t);e.typeNameToViewInfoMap[t]={constructor:i,options:n||{showInTrackView:!0}}},e.unregister=function(t){if(void 0===e.typeNameToViewInfoMap[t])throw Error(t+" not registered");delete e.typeNameToViewInfoMap[t]},e.getViewInfo=function(t){return e.typeNameToViewInfoMap[t]},{ObjectSnapshotView:e}}),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 e=tracing.analysis.tsRound,t=ui.define("default-object-snapshot-view",tracing.analysis.ObjectSnapshotView);t.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 t=this.objectSnapshot;if(t){var i,n=t.objectInstance;i=""+('<div class="title">Snapshot of <a id="instance-link"></a> @ '+e(t.ts)+"ms</div>\n"),i+="<table><tr>",i+='<tr><td>args:</td><td id="args"></td></tr>\n',this.innerHTML=i+="</table>",i=new tracing.analysis.ObjectInstanceLink,i.objectInstance=n,n=this.querySelector("#instance-link"),n.parentElement.replaceChild(i,n),this.querySelector("#args").textContent=JSON.stringify(t.args,null,2)}else this.textContent=""}};var i=ui.define("default-object-instance-view",tracing.analysis.ObjectInstanceView);return i.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 e=this.objectInstance;if(e){var t;t=""+('<div class="title">'+e.typeName+" "+e.id+"</div>\n"),t+="<table><tr>",t+="<tr><td>creationTs:</td><td>"+e.creationTs+"</td></tr>\n",t=e.deletionTs!=Number.MAX_VALUE?t+("<tr><td>deletionTs:</td><td>"+e.deletionTs+"</td></tr>\n"):t+"<tr><td>deletionTs:</td><td>not deleted</td></tr>\n",t+='<tr><td>snapshots:</td><td id="snapshots"></td></tr>\n',this.innerHTML=t+="</table>";var i=this.querySelector("#snapshots");e.snapshots.forEach(function(e){var t=new tracing.analysis.ObjectSnapshotLink;t.objectSnapshot=e,i.appendChild(t)})}else this.textContent=""}},{DefaultObjectSnapshotView:t,DefaultObjectInstanceView:i}}),base.require("ui"),base.exportTo("tracing.analysis",function(){var e=ui.define("slice-view");return e.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.objectInstance_=void 0},set modelObject(e){this.slice=e},get modelObject(){return this.slice},get slice(){return this.slice_},set slice(e){this.slice_=e,this.updateContents()},updateContents:function(){throw Error("Not implemented")}},e.titleToViewInfoMap={},e.register=function(t,i){if(e.titleToViewInfoMap[t])throw Error("Handler already registerd for "+t);e.titleToViewInfoMap[t]={constructor:i}},e.unregister=function(t){if(void 0===e.titleToViewInfoMap[t])throw Error(t+" not registered");delete e.titleToViewInfoMap[t]},e.getViewInfo=function(t){return e.titleToViewInfoMap[t]},{SliceView:e}}),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 e=ui.define("div");return e.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(e){if(!(this.currentView_ instanceof e)){this.textContent="";try{this.currentView_=new e,this.appendChild(this.currentView_)}catch(t){throw this.currentView_=void 0,t}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(e){this.selections_.push(e),this.processSelection(e)},clearSelectionHistory:function(){this.selections_=[]},onPopState:function(e){if(null!==e.state&&e.state.view_guid===this.guid_){var t;for(t=0;t<this.selections_.length&&this.selections_[t].guid!==e.state.selection_guid;++t);t>=this.selections_.length||(this.processSelection(this.selections_[t]),e.stopPropagation())}},processSelection:function(e){var t=e.getHitsOrganizedByType();1==e.length&&0==t.counterSamples.length&&this.tryToProcessSelectionUsingCustomViewer(e[0])||(this.changeViewType(tracing.analysis.AnalysisResults),this.currentView.clear(),this.currentSelection_=e,tracing.analysis.analyzeHitsByType(this.currentView,t))},tryToProcessSelectionUsingCustomViewer:function(e){var t,i,n;if(t=e.modelObject,e instanceof tracing.SelectionObjectSnapshotHit)i=t.objectInstance.typeName,n=tracing.analysis.ObjectSnapshotView,e=tracing.analysis.DefaultObjectSnapshotView;else if(e instanceof tracing.SelectionObjectInstanceHit)i=t.typeName,n=tracing.analysis.ObjectInstanceView,e=tracing.analysis.DefaultObjectInstanceView;else{if(!(e instanceof tracing.SelectionSliceHit))return!1;i=t.title,n=tracing.analysis.SliceView,e=void 0}return(e=(i=n.getViewInfo(i))?i.constructor:e)?(this.changeViewType(e),this.currentView.modelObject=t,!0):!1}},{AnalysisView:e}}),base.require("base.events"),base.exportTo("base",function(){function e(e,t,i,n,r,s){r=new base.Event(t+"Change",r,s),r.propertyName=t,r.newValue=i,r.oldValue=n;var a;if(r.throwError=function(e){a=e},e.dispatchEvent(r),a)throw a}function t(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(e,i){switch(i){case r.JS:var n=e+"_base_";return function(){return this[n]};case r.ATTR:var s=t(e);return function(){return this.getAttribute(s)};case r.BOOL_ATTR:return s=t(e),function(){return this.hasAttribute(s)}}}function n(i,n,s,a,o){switch(n){case r.JS:var c=i+"_base_";return function(t){var n=this[c];t!==n&&(this[c]=t,s&&s.call(this,t,n),e(this,i,t,n,a,o))};case r.ATTR:var l=t(i);return function(t){var n=this.getAttribute(l);t!==n&&(void 0==t?this.removeAttribute(l):this.setAttribute(l,t),s&&s.call(this,t,n),e(this,i,t,n,a,o))};case r.BOOL_ATTR:return l=t(i),function(t){var n=this.getAttribute(l)===i;t!==n&&(t?this.setAttribute(l,i):this.removeAttribute(l),s&&s.call(this,t,n),e(this,i,t,n,a,o))}}}var r={JS:"js",ATTR:"attr",BOOL_ATTR:"boolAttr"};return{PropertyKind:r,defineProperty:function(e,t,s,a,o,c){console.error("Don't use base.defineProperty"),"function"==typeof e&&(e=e.prototype),s=s||r.JS,e.__lookupGetter__(t)||e.__defineGetter__(t,i(t,s)),e.__lookupSetter__(t)||e.__defineSetter__(t,n(t,s,a,o,c))},dispatchPropertyChange:e,setPropertyAndDispatchChange:function(e,t,i){var n=e[t];e[t+"_"]=i,n!==i&&base.dispatchPropertyChange(e,t,i,n,!0,!1)}}}),base.requireStylesheet("ui.overlay"),base.require("base.properties"),base.require("base.events"),base.require("ui"),base.exportTo("ui",function(){var e=ui.define("div");e.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(e){e?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(e){e.oldParent_=e.parentNode,this.contentHost.appendChild(e),this.contentHost.appendChild(this.tabCatcher),this.ownerDocument.body.classList.add("disabled-by-overlay"),e.tabIndex=0;var t=e.querySelector("button, input, list, select, a");t||(t=e),t.focus(),this.ownerDocument.addEventListener("focusin",this.onFocusIn_,!0),e.addEventListener("keydown",this.onKeydown_)},onMousedown_:function(e){e.target==this&&e.preventDefault()},onFocusIn_:function(e){e.target==this.tabCatcher&&window.setTimeout(this.focusOverlay_.bind(this),0)},focusOverlay_:function(){this.contentHost.firstChild.focus()},onKeydown_:function(e){9==e.keyCode&&e.shiftKey&&e.target==this.contentHost.firstChild&&e.preventDefault()},hideOverlay:function(e){this.visible=!1,this.ownerDocument.body.classList.remove("disabled-by-overlay"),this.lastFocusOut_=void 0,e.parentNode.removeChild(this.tabCatcher),e.oldParent_?(e.oldParent_.appendChild(e),delete e.oldParent_):this.contentHost.removeChild(e),e.removeEventListener("keydown",this.onKeydown_),this.ownerDocument.removeEventListener("focusin",this.onFocusIn_)}};var t=ui.define("div");return t.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){if(!this.ownerDocument.querySelector(".overlay-root")){var i=this.ownerDocument.createElement("div");ui.decorate(i,e),this.ownerDocument.body.appendChild(i)}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",t.prototype.onVisibleChange_.bind(this),!0),this.obeyCloseEvents=!0},get visible(){return this.visible_},set visible(e){base.setPropertyAndDispatchChange(this,"visible",e)},get obeyCloseEvents(){return this.obeyCloseEvents_},set obeyCloseEvents(e){base.setPropertyAndDispatchChange(this,"obeyCloseEvents",e),this.ownerDocument.querySelector(".overlay-root").toggleToolbar(e)},get toolbar(){return this.ownerDocument.querySelector(".overlay-root .tool-bar")},onVisibleChange_:function(){var e=this.ownerDocument.querySelector(".overlay-root");this.visible?(e.setAttribute("visible","visible"),e.showOverlay(this),document.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("keypress",this.onKeyPress,!0),document.addEventListener("click",this.onDocumentClick,!0)):(e.removeAttribute("visible"),document.removeEventListener("keydown",this.onKeyDown,!0),document.removeEventListener("keypress",this.onKeyPress,!0),document.removeEventListener("click",this.onDocumentClick,!0),e.hideOverlay(this))},onKeyDown:function(e){this.obeyCloseEvents&&27==e.keyCode&&(this.visible=!1,e.preventDefault())},onKeyPress:function(e){if(this.obeyCloseEvents)for(var t=0;t<this.additionalCloseKeyCodes.length;t++)if(e.keyCode==this.additionalCloseKeyCodes[t]){this.visible=!1,e.preventDefault();break}},onDocumentClick:function(e){if(this.obeyCloseEvents){for(var t=e.target;null!==t;){if(t===this)return;t=t.parentNode}this.visible=!1,e.preventDefault()}}},{Overlay:t}}),base.requireTemplate("tracing.category_filter_dialog"),base.require("base.utils"),base.require("tracing.filter"),base.require("ui.overlay"),base.exportTo("tracing",function(){var e=ui.define("div");return e.prototype={__proto__:ui.Overlay.prototype,decorate:function(){ui.Overlay.prototype.decorate.call(this),this.className="view-category-filter-overlay",this.obeyCloseEvents=!0;var e=base.instantiateTemplate("#view-category-filter-dialog-template");this.appendChild(e),this.formEl_=this.querySelector("form"),this.categoriesEl_=this.querySelector(".categories"),this.addEventListener("visibleChange",this.onVisibleChange_.bind(this))},set categories(e){this.categories_=e},set settingUpdatedCallback(e){this.settingUpdatedCallback_=e},unselectedCategories_:function(){for(var e=this.formEl_.querySelectorAll("input"),t=[],i=0;i<e.length;++i){var n=e[i];!1===n.checked&&t.push(n.value)}return t},onVisibleChange_:function(){this.visible&&this.updateForm_()},updateForm_:function(){this.categoriesEl_.innerHTML="";for(var e=this.categories_.sort(),t=0;t<e.length;t++){var i=e[t],n=document.createElement("input");n.type="checkbox",n.id=i,n.value=i,n.checked=!0,n.onchange=this.updateSetting_.bind(this);var r=document.createElement("label");r.textContent=i,r.setAttribute("for",i),i=document.createElement("div"),i.appendChild(n),i.appendChild(r),this.categoriesEl_.appendChild(i)}},updateSetting_:function(){void 0!==this.settingUpdatedCallback_&&this.settingUpdatedCallback_(this.unselectedCategories_())}},{CategoryFilterDialog:e}}),base.exportTo("tracing",function(){return{mouseModeConstants:{MOUSE_MODE_SELECTION:1,MOUSE_MODE_PANSCAN:2,MOUSE_MODE_ZOOM:3}}}),base.require("base.events"),base.exportTo("tracing",function(){function e(e){this.parentEl_=e,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 t(e,t){this.viewport_=e,this.positionWorld_=t,this.selected_=!1}return e.prototype={__proto__:base.EventTarget.prototype,setWhenPossible:function(e){this.pendingSetFunction_=e},get isAttachedToDocument_(){var e=this.parentEl_;if(void 0!==e){for(;e.parentNode;)e=e.parentNode;return e==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 e=this.parentEl_.clientWidth+"x"+this.parentEl_.clientHeight;if(this.pendingSetFunction_){this.lastSize_=e;try{this.pendingSetFunction_()}catch(t){console.log("While running setWhenPossible:",t.message?t.message+"\n"+t.stack:t.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(e){this.panX=this.xViewVectorToWorld(e.panX),this.panY=e.panY},onModelTrackControllerScroll_:function(){this.panY_=this.modelTrackContainer_.scrollTop},set modelTrackContainer(e){this.modelTrackContainer_&&this.modelTrackContainer_.removeEventListener("scroll",this.onModelTrackControllerScroll_),this.modelTrackContainer_=e,this.modelTrackContainer_.addEventListener("scroll",this.onModelTrackControllerScroll_)},get scaleX(){return this.scaleX_},set scaleX(e){this.scaleX_!=e&&(this.scaleX_=e,this.dispatchChangeEvent())},get panX(){return this.panX_},set panX(e){this.panX_!=e&&(this.panX_=e,this.dispatchChangeEvent())},get panY(){return this.panY_},set panY(e){this.panY_=e,this.modelTrackContainer_.scrollTop=e},setPanAndScale:function(e,t){(this.scaleX_!=t||this.panX_!=e)&&(this.scaleX_=t,this.panX_=e,this.dispatchChangeEvent())},xWorldToView:function(e){return(e+this.panX_)*this.scaleX_},xWorldVectorToView:function(e){return e*this.scaleX_},xViewToWorld:function(e){return e/this.scaleX_-this.panX_},xViewVectorToWorld:function(e){return e/this.scaleX_},xPanWorldPosToViewPos:function(e,t,i){if("string"==typeof t)if("left"==t)t=0;else if("center"==t)t=i/2;else{if("right"!=t)throw Error("unrecognized string for viewPos. left|center|right");t=i-1}this.panX=t/this.scaleX_-e},xPanWorldBoundsIntoView:function(e,t,i){0>this.xWorldToView(e)?this.xPanWorldPosToViewPos(e,"left",i):this.xWorldToView(t)>i&&this.xPanWorldPosToViewPos(t,"right",i)},xSetWorldBounds:function(e,t,i){this.setPanAndScale(-e,i/(t-e))},get gridEnabled(){return this.gridEnabled_},set gridEnabled(e){this.gridEnabled_!=e&&(this.gridEnabled_=e&&!0,this.dispatchChangeEvent())},get gridTimebase(){return this.gridTimebase_},set gridTimebase(e){this.gridTimebase_!=e&&(this.gridTimebase_=e,this.dispatchChangeEvent())},get gridStep(){return this.gridStep_},applyTransformToCanvas:function(e){e.transform(this.scaleX_,0,0,1,this.panX_*this.scaleX_,0)},addMarker:function(e){return e=new t(this,e),this.markers.push(e),this.dispatchChangeEvent(),this.dispatchMarkersChangeEvent_(),e},removeMarker:function(e){for(var t=0;t<this.markers.length;++t)if(this.markers[t]===e)return this.markers.splice(t,1),this.dispatchChangeEvent(),this.dispatchMarkersChangeEvent_(),!0},findMarkerNear:function(e,t){for(var i=this.xViewVectorToWorld(t),n=0;n<this.markers.length;++n)if(Math.abs(this.markers[n].positionWorld-e)<=i)return this.markers[n]},drawGridLines:function(e,t,i){if(this.gridEnabled){var n=this.gridTimebase;for(e.beginPath();i>n;){if(n>=t){var r=this.xWorldToView(n);e.moveTo(r,0),e.lineTo(r,e.canvas.height)}n+=this.gridStep}e.strokeStyle="rgba(255,0,0,0.25)",e.stroke()}},drawMarkerArrows:function(e,t,i,n){for(var r=0;r<this.markers.length;++r)this.markers[r].drawTriangle_(e,t,i,e.canvas.height,n,this)},drawMarkerLines:function(e,t,i){for(var n=0;n<this.markers.length;++n)this.markers[n].drawLine(e,t,i,e.canvas.height,this)}},t.prototype={get positionWorld(){return this.positionWorld_},set positionWorld(e){this.positionWorld_=e,this.viewport_.dispatchChangeEvent()},set selected(e){this.selected_=e,this.viewport_.dispatchChangeEvent()},get selected(){return this.selected_},get color(){return this.selected?"rgb(255,0,0)":"rgb(0,0,0)"},drawTriangle_:function(e,t,i,n,r,s){e.beginPath();var a=this.positionWorld_;t>a||a>i||(t=s.xWorldToView(a),e.moveTo(t,r),e.lineTo(t-3,r/2),e.lineTo(t+3,r/2),e.lineTo(t,r),e.closePath(),e.fillStyle=this.color,e.fill(),r!==n&&(e.beginPath(),e.moveTo(t,r),e.lineTo(t,n),e.closePath(),e.strokeStyle=this.color,e.stroke()))},drawLine:function(e,t,i,n,r){e.beginPath();var s=this.positionWorld_;s>=t&&i>s&&(t=r.xWorldToView(s),e.moveTo(t,0),e.lineTo(t,n)),e.strokeStyle=this.color,e.stroke()}},{TimelineViewport:e,ViewportMarker:t}}),base.require("base.utils"),base.exportTo("base",function(){function e(e){try{e.callback.call(e.context)}catch(t){base.onAnimationFrameError(t,e.stack)}}function t(){c=!1;var t=s;o=a,s=[],a=[];for(var i=0;i<t.length;i++)e(t[i]);for(;0<o.length;)e(o.shift());o=void 0}function i(){if(!r)return"";var e=base.stackTrace();return e.shift(),e.join("\n")}function n(e,n){a.push({callback:e,context:n||window,stack:i()}),c||(c=!0,window.webkitRequestAnimationFrame(t))}var r=!1,s=[],a=[],o=void 0,c=!1;return{onAnimationFrameError:function(e,t){t&&console.log(t),e.message?console.error(e.message,e.stack):console.error(e)},requestPreAnimationFrame:function(e,n){s.push({callback:e,context:n||window,stack:i()}),c||(c=!0,window.webkitRequestAnimationFrame(t))},requestAnimationFrame:n,requestAnimationFrameInThisFrameIfPossible:function(e,t){o?o.push({callback:e,context:t||window,stack:i()}):n(e,t)}}}),base.require("base.events"),base.require("ui"),base.exportTo("ui",function(){var e=ui.define("div");return e.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(e){HTMLUnknownElement.prototype.appendChild.call(this,e),this.didMutate_(this.observer_.takeRecords())},insertBefore:function(e,t){HTMLUnknownElement.prototype.insertBefore.call(this,e,t),this.didMutate_(this.observer_.takeRecords())},removeChild:function(e){HTMLUnknownElement.prototype.removeChild.call(this,e),this.didMutate_(this.observer_.takeRecords())},replaceChild:function(e,t){HTMLUnknownElement.prototype.replaceChild.call(this,e,t),this.didMutate_(this.observer_.takeRecords())},onSetTextContent_:function(e){if(""!=e)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(e){this.beginDecorating_();for(var t=0;t<e.length;t++){var i=e[t].addedNodes;if(i)for(var n=0;n<i.length;n++)this.decorateChild_(i[n]);if(i=e[t].removedNodes)for(n=0;n<i.length;n++)this.undecorateChild_(i[n])}this.doneDecoratingForNow_()},decorateChild_:function(){throw Error("Not implemented")},undecorateChild_:function(){throw Error("Not implemented")},beginDecorating_:function(){},doneDecoratingForNow_:function(){}},{ContainerThatDecoratesItsChildren:e}}),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 e=tracing.getColorPaletteHighlightIdBoost(),t=ui.define("track",ui.ContainerThatDecoratesItsChildren);return t.prototype={__proto__:ui.ContainerThatDecoratesItsChildren.prototype,decorate:function(e){if(ui.ContainerThatDecoratesItsChildren.prototype.decorate.call(this),void 0===e)throw Error("viewport is required when creating a Track.");this.viewport_=e,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(e){this.categoryFilter_!=e&&(this.categoryFilter_=e,this.updateContents_())},decorateChild_:function(e){e instanceof t&&(e.categoryFilter=this.categoryFilter)},undecorateChild_:function(e){e.detach&&e.detach()},updateContents_:function(){},drawTrack:function(e){var t=this.context();if(void 0!==t){t.save();var i=this.setupCanvasForDraw_();this.draw(e,i.left,i.right),t.restore()}},draw:function(){},setupCanvasForDraw_:function(){var e=this.context(),t=window.devicePixelRatio||1,i=this.getBoundingClientRect(),n=e.canvas.getBoundingClientRect();return e.translate(0,t*(i.top-n.top)),e=this.viewport.xViewToWorld(0),t=this.viewport.xViewToWorld(i.width*t),{left:e,right:t}},decorateHit:function(){},addIntersectingItemsInRangeToSelection:function(e,t,i,n,r){var s=window.devicePixelRatio||1,a=this.viewport.xViewVectorToWorld(1);e=this.viewport.xViewToWorld(e*s),t=this.viewport.xViewToWorld(t*s),s=this.getBoundingClientRect(),i=Math.max(i,s.top),n=Math.min(n,s.bottom),i>n||this.addIntersectingItemsInRangeToSelectionInWorldSpace(e,t,a,r)},addIntersectingItemsInRangeToSelectionInWorldSpace:function(){},drawInstantEvents_:function(t,i,n){var r=this.context(),s=window.devicePixelRatio||1,s=this.getBoundingClientRect().height*s,a=this.viewport,o=a.xViewVectorToWorld(1),c=tracing.getColorPalette();for(r.save(),a.applyTransformToCanvas(r),a=new tracing.FastRectRenderer(r,2*o,2*o,c),a.setYandH(0,s),i=base.findLowIndexInSortedArray(t,function(e){return e.start},i);i<t.length;++i){var l=t[i],h=l.start;if(h>n)break;Math.max(l.duration,.001),l=l.selected?l.colorId+e:l.colorId,o>.001?a.fillRect(h,o,l):(r.fillStyle=c[l],r.beginPath(),r.moveTo(h-4*o,s),r.lineTo(h,0),r.lineTo(h+4*o,s),r.closePath(),r.fill())}a.flush(),r.restore()}},{Track:t}}),base.requireStylesheet("tracing.tracks.drawing_container"),base.require("base.raf"),base.require("tracing.tracks.track"),base.require("ui"),base.exportTo("tracing.tracks",function(){var e={SLICE:1,INSTANT_EVENT:2},t=ui.define("drawing-container",tracing.tracks.Track);return t.prototype={__proto__:tracing.tracks.Track.prototype,decorate:function(e){tracing.tracks.Track.prototype.decorate.call(this,e),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 t=0;t<this.children.length;++t)this.children[t]instanceof tracing.tracks.Track&&this.children[t].drawTrack(e.INSTANT_EVENT);for(t=0;t<this.children.length;++t)this.children[t]instanceof tracing.tracks.Track&&this.children[t].drawTrack(e.SLICE);var i=window.devicePixelRatio||1,n=this.canvas_.getBoundingClientRect(),t=this.viewport.xViewToWorld(0),i=this.viewport.xViewToWorld(n.width*i);this.viewport.drawGridLines(this.ctx_,t,i),this.viewport.drawMarkerLines(this.ctx_,t,i)},this)},this))},updateCanvasSizeIfNeeded_:function(){var e=base.asArray(this.children).filter(this.visibleFilter_),t=this.getBoundingClientRect(),i=e[0].getBoundingClientRect(),n=e[e.length-1].getBoundingClientRect(),e=i.width-tracing.constants.HEADING_WIDTH,n=n.bottom-i.top,r=window.devicePixelRatio||1;this.canvas_.width!=e*r&&(this.canvas_.width=e*r,this.canvas_.style.width=e+"px"),this.canvas_.height!=n*r&&(this.canvas_.height=n*r,this.canvas_.style.height=n+"px"),t=i.top-t.top+this.scrollTop,this.canvas_.style.top+"px"!==t&&(this.canvas_.style.top=t+"px")},visibleFilter_:function(e){return e instanceof tracing.tracks.Track?"none"!==window.getComputedStyle(e).display:!1}},{DrawingContainer:t,DrawType:e}}),base.exportTo("tracing",function(){return{constants:{HEADING_WIDTH:250}}}),base.requireStylesheet("tracing.tracks.heading_track"),base.require("tracing.constants"),base.require("tracing.tracks.track"),base.require("ui"),base.exportTo("tracing.tracks",function(){var e=ui.define("heading-track",tracing.tracks.Track);return e.prototype={__proto__:tracing.tracks.Track.prototype,decorate:function(e){tracing.tracks.Track.prototype.decorate.call(this,e),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(e){this.headingDiv_.textContent=e},set tooltip(e){this.headingDiv_.title=e},draw:function(){throw Error("draw implementation missing")}},{HeadingTrack:e}}),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 e=ui.define("ruler-track",tracing.tracks.HeadingTrack),t=Math.log(10);return e.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,decorate:function(e){tracing.tracks.HeadingTrack.prototype.decorate.call(this,e),this.classList.add("ruler-track"),this.strings_secs_=[],this.strings_msecs_=[],this.addEventListener("mousedown",this.onMouseDown),this.viewportMarkersChange_=this.viewportMarkersChange_.bind(this),e.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(e){0===e.button&&this.placeAndBeginDraggingMarker(e.clientX)},placeAndBeginDraggingMarker:function(e){var t=window.devicePixelRatio||1;e=this.viewport.xViewToWorld((e-this.offsetLeft-tracing.constants.HEADING_WIDTH)*t);var i=this.viewport.findMarkerNear(e,6),n=!1,r=!1;i||(i=this.viewport.addMarker(e),n=!0),i.selected=!0;var s=function(e){e=this.viewport.xViewToWorld((e.clientX-this.offsetLeft-tracing.constants.HEADING_WIDTH)*t),i.positionWorld=e,r=!0}.bind(this),a=function(){i.selected=!1,r||n||this.viewport.removeMarker(i),document.removeEventListener("mouseup",a),document.removeEventListener("mousemove",s)}.bind(this);document.addEventListener("mouseup",a),document.addEventListener("mousemove",s)},drawLine_:function(e,t,i,n,r,s){e.beginPath(),e.moveTo(t,i),e.lineTo(n,r),e.closePath(),e.strokeStyle=s,e.stroke()},drawArrow_:function(e,t,i,n,r,s,a){this.drawLine_(e,t,i,n,r,a);var o=n-t,c=r-i,l=Math.sqrt(o*o+c*c),h=(l-10)/l;t+=h*o,i+=h*c,c=c/l*s,s*=-(o/l),e.beginPath(),e.fillStyle=a,e.moveTo(t+c,i+s),e.lineTo(n,r),e.lineTo(t-c,i-s),e.lineTo(t+c,i+s),e.closePath(),e.fill()},draw:function(e,t,i){switch(e){case tracing.tracks.DrawType.SLICE:this.drawSlices_(t,i)}},drawSlices_:function(e,i){var n=this.context(),r=window.devicePixelRatio||1,s=this.getBoundingClientRect(),a=s.width*r,o=s.height*r,c=this.classList.contains("ruler-track-with-distance-measurements"),s=c?o/2:o,l=this.viewport;l.drawMarkerArrows(n,e,i,s);var h,d,u,p,r=150*r,_=l.xViewVectorToWorld(r);for(p=Math.pow(10,Math.ceil(Math.log(_)/t)),d=[10,5,2,1],_=0;_<d.length;++_)if(!(l.xWorldVectorToView(p/d[_])<r)){h=p/d[_-1];break}p=void 0,100>h?(d="ms",u=1,p=this.strings_msecs_):(d="s",u=1e3,p=this.strings_secs_);var g=l.xWorldVectorToView(h/5),_=Math.floor(e/h)*h,o=Math.floor(.25*o);n.fillStyle="rgb(0, 0, 0)",n.strokeStyle="rgb(0, 0, 0)",n.textAlign="left",n.textBaseline="top",r=window.devicePixelRatio||1,n.font=9*r+"px sans-serif";for(var m=_;i>m;m+=h){var f=Math.floor(l.xWorldToView(m)),_=Math.floor(1e5*(m/u))/1e5;for(p[_]||(p[_]=_+" "+d),n.fillText(p[_],f+2*r,0),n.beginPath(),n.moveTo(f,0),n.lineTo(f,s),_=1;5>_;++_){var b=Math.floor(f+g*_);n.moveTo(b,s-o),n.lineTo(b,s)}n.stroke()}if(n.moveTo(0,s),n.lineTo(a,s),n.stroke(),c){for(h=l.markers.slice(),h.sort(function(e,t){return e.positionWorld_-t.positionWorld_}),c=s+2,r=c+4,_=0;_<h.length-1;_++){o=h[_+1],m=h[_],f=o.positionWorld-m.positionWorld,g=l.xWorldVectorToView(f),p=l.xWorldToView(m.positionWorld+f/2),100>f?(d="ms",u=1):(d="s",u=1e3),u=f/u,d=Math.abs(Math.floor(1e3*u)/1e3)+" "+d,u=n.measureText(d).width,b=l.xViewVectorToWorld(u),u=u+26+10;var v=m.positionWorld+f/2-b/2,y=v+b,f=c,b=l.xWorldToView(v),v=l.xWorldToView(y),m=l.xWorldToView(m.positionWorld),o=l.xWorldToView(o.positionWorld),y=!1;g>=u&&(n.fillStyle="rgb(0,0,0)",n.fillText(d,b,f),y=!0),g>=26&&(y?(d=b-10,p=v+10):d=p,this.drawArrow_(n,d,r,m,r,3,"rgb(128,121,121)"),this.drawArrow_(n,p,r,o,r,3,"rgb(128,121,121)"))}n.moveTo(0,2*s),n.lineTo(a,2*s),n.stroke()}},addIntersectingItemsInRangeToSelection:function(){},addAllObjectsMatchingFilterToSelection:function(){}},{RulerTrack:e}}),base.exportTo("base",function(){function e(){this.iframe_=void 0}return e.prototype={__proto__:Object.prototype,measure:function(e){this.iframe_.contentDocument.body.appendChild(e);var t=this.iframe_.contentWindow.getComputedStyle(e),i=parseInt(t.width,10),t=parseInt(t.height,10);return this.iframe_.contentDocument.body.removeChild(e),{width:i,height:t}},attach:function(){var e=document.createElement("iframe");e.style.cssText="position:absolute;width:100%;height:0;border:0;visibility:hidden",document.body.appendChild(e),this.iframe_=e,this.iframe_.contentDocument.body.style.cssText="padding:0;margin:0;overflow:hidden";for(var e=document.querySelectorAll("link[rel=stylesheet]"),t=0;t<e.length;t++){var i=e[t],n=this.iframe_.contentDocument.createElement("link");n.rel="stylesheet",n.href=i.href,this.iframe_.contentDocument.head.appendChild(n)}},detach:function(){document.body.removeChild(this.iframe_),this.iframe_=void 0}},{MeasuringStick:e}}),base.require("tracing.tracks.track"),base.require("tracing.filter"),base.require("ui"),base.exportTo("tracing.tracks",function(){var e=ui.define("container-track",tracing.tracks.Track);return e.prototype={__proto__:tracing.tracks.Track.prototype,decorate:function(e){tracing.tracks.Track.prototype.decorate.call(this,e)},detach:function(){this.textContent=""},get tracks_(){for(var e=[],t=0;t<this.children.length;t++)this.children[t].classList.contains("track")&&e.push(this.children[t]);return e},drawTrack:function(e){for(var t=0;t<this.children.length;++t)this.children[t]instanceof tracing.tracks.Track&&this.children[t].drawTrack(e)},addIntersectingItemsInRangeToSelection:function(e,t,i,n,r){for(var s=0;s<this.tracks_.length;s++){var a=this.tracks_[s].getBoundingClientRect(),o=Math.max(i,a.top),a=Math.min(n,a.bottom);a>=o&&this.tracks_[s].addIntersectingItemsInRangeToSelection(e,t,i,n,r)}tracing.tracks.Track.prototype.addIntersectingItemsInRangeToSelection.apply(this,arguments)},addAllObjectsMatchingFilterToSelection:function(e,t){for(var i=0;i<this.tracks_.length;i++)this.tracks_[i].addAllObjectsMatchingFilterToSelection(e,t)}},{ContainerTrack:e}}),base.exportTo("tracing",function(){function e(e,t,i,n){this.ctx_=e,this.minRectSize_=t,this.maxMergeDist_=i,this.pallette_=n}return e.prototype={y_:0,h_:0,merging_:!1,mergeStartX_:0,mergeCurRight_:0,setYandH:function(e,t){this.flush(),this.y_=e,this.h_=t},fillRect:function(e,t,i){var n=e+t;t<this.minRectSize_?(n-this.mergeStartX_>this.maxMergeDist_&&this.flush(),this.merging_?(this.mergeCurRight_=n,this.mergedColorId=Math.max(this.mergedColorId,i)):(this.merging_=!0,this.mergeStartX_=e,this.mergeCurRight_=n,this.mergedColorId=i)):(this.merging_&&this.flush(),this.ctx_.fillStyle=this.pallette_[i],this.ctx_.fillRect(e,this.y_,t,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)}},{FastRectRenderer:e}}),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 e(){}function t(e,t){this.string=e,this.width=t}var i=tracing.getColorPalette(),n=ui.define("slice-track",tracing.tracks.HeadingTrack);n.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,SHOULD_ELIDE_TEXT:!0,decorate:function(t){tracing.tracks.HeadingTrack.prototype.decorate.call(this,t),this.classList.add("slice-track"),this.elidedTitleCache=new e,this.asyncStyle_=!1,this.slices_=null},get asyncStyle(){return this.asyncStyle_},set asyncStyle(e){this.asyncStyle_=!!e},get slices(){return this.slices_},set slices(e){this.slices_=e||[]},get height(){return window.getComputedStyle(this).height},set height(e){this.style.height=e},get hasVisibleContent(){return 0<this.slices.length},labelWidth:function(e){var t=this.context(),i=s[e];return i||(i=t.measureText(e).width,s[e]=i),i+2},labelWidthWorld:function(e,t){return this.labelWidth(e)*t},draw:function(e,t,i){switch(e){case tracing.tracks.DrawType.SLICE:this.drawSlices_(t,i)}},drawSlices_:function(e,t){var n=this.context(),s=window.devicePixelRatio||1,a=this.getBoundingClientRect().height*s,o=this.viewport,c=o.xViewVectorToWorld(1);n.save(),o.applyTransformToCanvas(n),this.asyncStyle_&&(n.globalAlpha=.25);var l=new tracing.FastRectRenderer(n,2*c,2*c,i);l.setYandH(0,a);for(var h=this.slices_,d=base.findLowIndexInSortedArray(h,function(e){return e.start+e.duration
+},e),u=d;u<h.length;++u){var p=h[u],_=p.start;if(_>t)break;var g=Math.max(p.duration,.001),m=p.selected?p.colorId+r:p.colorId;c>g&&(g=c),0<p.duration?l.fillRect(_,g,m):c>.001?l.fillRect(_,c,m):(n.fillStyle=i[m],n.beginPath(),n.moveTo(_-4*c,a),n.lineTo(_,0),n.lineTo(_+4*c,a),n.closePath(),n.fill())}if(l.flush(),n.restore(),a>8)for(n.textAlign="center",n.textBaseline="top",n.font=10*s+"px sans-serif",n.strokeStyle="rgb(0,0,0)",n.fillStyle="rgb(0,0,0)",a=20*c,l=this.SHOULD_ELIDE_TEXT,u=d;u<h.length&&(p=h[u],!(p.start>t));++u)p.duration<=a||(d=p.title+(p.didNotFinish?" (Did Not Finish)":""),_=this.labelWidth(d),l&&this.labelWidthWorld(d,c)>p.duration&&(_=this.elidedTitleCache.get(this,c,d,_,p.duration),d=_.string,_=_.width),_*c<p.duration&&(p=o.xWorldToView(p.start+.5*p.duration),n.fillText(d,p,2.5*s,_)))},addIntersectingItemsInRangeToSelectionInWorldSpace:function(e,t,i,n){base.iterateOverIntersectingIntervals(this.slices_,function(e){return e.start},function(e){return e.duration},e,t,function(e){e=n.addSlice(this,e),this.decorateHit(e)}.bind(this))},indexOfSlice_:function(e){for(var t=base.findLowIndexInSortedArray(this.slices_,function(e){return e.start},e.start);t<this.slices_.length&&e.start==this.slices_[t].start&&e.colorId!=this.slices_[t].colorId;)t++;return t<this.slices_.length?t:void 0},addItemNearToProvidedHitToSelection:function(e,t,i){return e.slice?(e=this.indexOfSlice_(e.slice),void 0===e?!1:(t=e+t,0>t||t>=this.slices_.length?!1:(e=i.addSlice(this,this.slices_[t]),this.decorateHit(e),!0))):!1},addAllObjectsMatchingFilterToSelection:function(e,t){for(var i=0;i<this.slices_.length;++i)if(e.matchSlice(this.slices_[i])){var n=t.addSlice(this,this.slices_[i]);this.decorateHit(n)}}};var r=tracing.getColorPaletteHighlightIdBoost(),s={},a={};return e.prototype={get:function(e,i,n,r,s){var o=a[n];if(o||(o={},a[n]=o),r=o[i],r||(o[i]={},r=o[i]),o=r[s],void 0===o){for(o=!1;e.labelWidthWorld(n,i)>s&&!(1>.75*n.length);)n=n.substring(0,.75*n.length),o=!0;o&&3<n.length&&(n=n.substring(0,n.length-3)+"..."),o=new t(n,e.labelWidth(n)),r[s]=o}return o}},{SliceTrack:n}}),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 e=ui.define("cpu-track",tracing.tracks.ContainerTrack);return e.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(e){tracing.tracks.ContainerTrack.prototype.decorate.call(this,e),this.classList.add("cpu-track")},get cpu(){return this.cpu_},set cpu(e){this.cpu_=e,this.updateContents_()},get tooltip(){return this.tooltip_},set tooltip(e){this.tooltip_=e,this.updateContents_()},get hasVisibleContent(){return 0<this.children.length},updateContents_:function(){if(this.detach(),this.cpu_){var e=tracing.filterSliceArray(this.categoryFilter_,this.cpu_.slices);if(e.length){var t=new tracing.tracks.SliceTrack(this.viewport);t.slices=e,t.heading="CPU "+this.cpu_.cpuNumber+":",this.appendChild(t)}for(var i in this.cpu_.counters){if(e=this.cpu_.counters[i],!this.categoryFilter_.matchCounter(e))break;t=new tracing.tracks.CounterTrack(this.viewport),t.heading="CPU "+this.cpu_.cpuNumber+" "+e.name+":",t.counter=e,t.categoryFilter=this.categoryFilter_,this.appendChild(t)}}}},{CpuTrack:e}}),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 e=tracing.getColorPalette(),t=tracing.getColorPaletteHighlightIdBoost(),i=ui.define("object-instance-track",tracing.tracks.HeadingTrack);return i.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,decorate:function(e){tracing.tracks.HeadingTrack.prototype.decorate.call(this,e),this.classList.add("object-instance-track"),this.objectInstances_=[],this.objectSnapshots_=[]},get objectInstances(){return this.objectInstances_},set objectInstances(e){e&&0!=e.length?(this.heading=e[0].typeName,this.objectInstances_=e,this.objectSnapshots_=[],this.objectInstances_.forEach(function(e){this.objectSnapshots_.push.apply(this.objectSnapshots_,e.snapshots)},this)):(this.heading="",this.objectInstances_=[],this.objectSnapshots_=[])},get height(){return window.getComputedStyle(this).height},set height(e){this.style.height=e},get snapshotRadiusView(){return 7*(window.devicePixelRatio||1)},draw:function(e,t,i){switch(e){case tracing.tracks.DrawType.SLICE:this.drawSlices_(t,i)}},drawSlices_:function(i,n){var r,s=this.context(),a=window.devicePixelRatio||1,o=this.getBoundingClientRect().height*a,c=.5*o,l=2*Math.PI,h=this.viewport,d=this.snapshotRadiusView,u=h.xViewVectorToWorld(o);s.save(),h.applyTransformToCanvas(s);var p=this.objectInstances_;for(r=base.findLowIndexInSortedArray(p,function(e){return e.deletionTs},i),s.globalAlpha=.25,s.strokeStyle="rgb(0,0,0)";r<p.length;++r){var _=p[r],g=_.creationTs;if(g>n)break;var m=_.selected?_.colorId+t:_.colorId,_=_.deletionTs==Number.MAX_VALUE?n:_.deletionTs;s.fillStyle=e[m],s.fillRect(g,a,_-g,o-2*a)}for(s.globalAlpha=1,s.restore(),a=this.objectSnapshots_,r=base.findLowIndexInSortedArray(a,function(e){return e.ts+u},i);r<a.length&&(o=a[r],g=o.ts,!(g-u>n));++r)g=h.xWorldToView(g),m=o.selected?o.objectInstance.colorId+t:o.objectInstance.colorId,s.fillStyle=e[m],s.beginPath(),s.arc(g,c,d,0,l),s.fill(),o.selected?(s.lineWidth=5,s.strokeStyle="rgb(100,100,0)",s.stroke(),s.beginPath(),s.arc(g,c,d-1,0,l),s.lineWidth=2,s.strokeStyle="rgb(255,255,0)"):(s.lineWidth=1,s.strokeStyle="rgb(0,0,0)"),s.stroke();s.lineWidth=1},addIntersectingItemsInRangeToSelectionInWorldSpace:function(e,t,i,n){function r(e){n.addObjectInstance(s,e)}var s=this,a=!1,o=i*this.snapshotRadiusView;base.iterateOverIntersectingIntervals(this.objectSnapshots_,function(e){return e.ts-o},function(){return 2*o},e,t,function(e){n.addObjectSnapshot(s,e),a=!0}),a||base.iterateOverIntersectingIntervals(this.objectInstances_,function(e){return e.creationTs},function(e){return e.deletionTs-e.creationTs},e,t,r)},addItemNearToProvidedHitToSelection:function(e,t,i){if(e instanceof tracing.SelectionObjectSnapshotHit){if(e=this.objectSnapshots_.indexOf(e.objectSnapshot),t=e+t,t>=0&&t<this.objectSnapshots_.length)return i.addObjectSnapshot(this,this.objectSnapshots_[t]),!0}else{if(!(e instanceof tracing.SelectionObjectInstanceHit))throw Error("Unrecognized hit");if(e=this.objectInstances_.indexOf(e.objectInstance),t=e+t,t>=0&&t<this.objectInstances_.length)return i.addObjectInstance(this,this.objectInstances_[t]),!0}return!1},addAllObjectsMatchingFilterToSelection:function(){}},i.typeNameToTrackConstructorMap={},i.register=function(e,t){if(i.typeNameToTrackConstructorMap[e])throw Error("Handler already registered for "+e);i.typeNameToTrackConstructorMap[e]=t},i.getTrackConstructor=function(e){return i.typeNameToTrackConstructorMap[e]},{ObjectInstanceTrack:i}}),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 e=tracing.getColorPalette(),t=tracing.getColorPaletteHighlightIdBoost(),i=ui.define("heap-instance-track",tracing.tracks.HeadingTrack);return i.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,decorate:function(e){tracing.tracks.HeadingTrack.prototype.decorate.call(this,e),this.classList.add("heap-instance-track"),this.objectInstance_=null},set objectInstances(e){if(e){if(1!=e.length)throw Error("Bad object instance count.");this.objectInstance_=e[0],this.maxBytes_=this.computeMaxBytes_(this.objectInstance_.snapshots)}else this.objectInstance_=[]},computeMaxBytes_:function(e){for(var t=0,i=0;i<e.length;i++){for(var n=e[i],r=Object.keys(n.heap_.children),s=0,a=0;a<r.length;a++)s+=n.heap_.children[r[a]].currentBytes;s>t&&(t=s)}return t},get height(){return window.getComputedStyle(this).height},set height(e){this.style.height=e},draw:function(e,t,i){switch(e){case tracing.tracks.DrawType.SLICE:this.drawSlices_(t,i)}},drawSlices_:function(i,n){var r=this.context(),s=window.devicePixelRatio||1,a=this.getBoundingClientRect(),o=a.width*s,s=a.height*s,a=this.viewport,c=this.maxBytes_,l=this.objectInstance_.snapshots,h=base.findLowIndexInSortedArray(l,function(e){return e.ts},i);for(h>0&&(h-=1);h<l.length;++h){var d=l[h],u=d.ts;if(u>n)break;u=a.xWorldToView(u),0>u&&(u=0);var p=a.xWorldToView(h<l.length-1?l[h+1].ts:l[l.length-1].ts+5e3);p>o&&(p=o);for(var u=Math.floor(u),p=Math.floor(p),_=s,g=Object.keys(d.heap_.children),m=g.length-1;m>=0;m--){var f=d.heap_.children[g[m]];r.fillStyle=this.objectInstance_.selectedTraces&&0<this.objectInstance_.selectedTraces.length&&this.objectInstance_.selectedTraces[0]==g[m]?"rgb(239, 248, 206)":e[(d.selected?d.objectInstance.colorId+t:d.objectInstance.colorId)+m],f=s*f.currentBytes/c,r.fillRect(u,_-f,Math.max(p-u,1),f),_-=f}}r.lineWidth=1},addIntersectingItemsInRangeToSelectionInWorldSpace:function(e,t,i,n){var r=this;base.iterateOverIntersectingIntervals(this.objectInstance_.snapshots,function(e){return e.ts},function(){return 5e3},e,t,function(e){n.addObjectSnapshot(r,e)})},addItemNearToProvidedHitToSelection:function(e,t,i){if(!(e instanceof tracing.SelectionObjectSnapshotHit))throw Error("Unrecognized hit");var n=this.objectInstance_.snapshots;return e=n.indexOf(e.objectSnapshot)+t,e>=0&&e<n.length?(i.addObjectSnapshot(this,n[e]),!0):!1},addAllObjectsMatchingFilterToSelection:function(){}},tracing.tracks.ObjectInstanceTrack.register("memory::Heap",i),{HeapInstanceTrack:i}}),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 e=tracing.getColorPalette(),t=ui.define("counter-track",tracing.tracks.HeadingTrack);return t.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,decorate:function(e){tracing.tracks.HeadingTrack.prototype.decorate.call(this,e),this.classList.add("counter-track"),this.selectedSamples_={},this.categoryFilter_=new tracing.Filter},decorateHit:function(){},get counter(){return this.counter_},set counter(e){this.counter_=e,this.heading=e.name+": "},get categoryFilter(){return this.categoryFilter_},set categoryFilter(e){this.categoryFilter_=e},get selectedSamples(){return this.selectedSamples_},draw:function(e,t,i){switch(e){case tracing.tracks.DrawType.SLICE:this.drawSlices_(t,i)}},drawSlices_:function(t,i){var n=this.context(),r=window.devicePixelRatio||1,r=this.getBoundingClientRect().height*r,s=this.counter_,a=this.viewport,o=a.xViewVectorToWorld(1),c=a.xViewVectorToWorld(1);n.save(),a.applyTransformToCanvas(n);for(var a=s.numSeries,l=s.numSamples,h=base.findLowIndexInSortedArray(s.timestamps,function(e){return e},t),h=h-1>0?h-1:0,d=r/s.maxTotal,u=s.numSeries-1;u>=0;u--){n.fillStyle=e[s.series[u].color],n.beginPath();for(var p=h-1,_=p>=0?s.timestamps[p]-c:-1,g=r,m=!1;;){var f=p+1;if(f>=l){n.lineTo(_,g),n.lineTo(_+8*o,g),n.lineTo(_+8*o,r);break}var b=s.timestamps[f],v=s.totals[f*a+u],v=r-d*v;if(b>i){n.lineTo(b,g),n.lineTo(b,r);break}l>f+1&&(p=s.timestamps[f+1],c>=p-_&&i>p)?p=f:(m||(n.moveTo(t,r),m=!0),c>b-_&&(b=_+c),n.lineTo(b,g),n.lineTo(b,v),p=f,_=b,g=v)}n.closePath(),n.fill()}n.fillStyle="rgba(255, 0, 0, 1)";for(f in this.selectedSamples_)if(this.selectedSamples_[f])for(b=s.timestamps[f],u=s.numSeries-1;u>=0;u--)v=s.totals[f*a+u],v=r-d*v,n.fillRect(b-o,v-1,3*o,3);n.restore()},addIntersectingItemsInRangeToSelectionInWorldSpace:function(e,t,i,n){function r(e,t){return t===s.timestamps.length-1?0:s.timestamps[t+1]-s.timestamps[t]}var s=this.counter_;for(e=base.findLowIndexInSortedIntervals(s.timestamps,function(e){return e},r,e),t=base.findLowIndexInSortedIntervals(s.timestamps,function(e){return e},r,t);t>=e;e++)0>e||e>=s.timestamps.length||(i=n.addCounterSample(this,this.counter,e),this.decorateHit(i))},addAllObjectsMatchingFilterToSelection:function(){}},{CounterTrack:t}}),base.requireStylesheet("tracing.tracks.spacing_track"),base.require("tracing.tracks.heading_track"),base.exportTo("tracing.tracks",function(){var e=ui.define("spacing-track",tracing.tracks.HeadingTrack);return e.prototype={__proto__:tracing.tracks.HeadingTrack.prototype,decorate:function(e){tracing.tracks.HeadingTrack.prototype.decorate.call(this,e),this.classList.add("spacing-track")},draw:function(){},addAllObjectsMatchingFilterToSelection:function(){}},{SpacingTrack:e}}),base.require("base.sorted_array_utils"),base.require("tracing.tracks.container_track"),base.require("ui"),base.exportTo("tracing.tracks",function(){var e=ui.define("slice-group-track",tracing.tracks.ContainerTrack);return e.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(e){tracing.tracks.ContainerTrack.prototype.decorate.call(this,e),this.classList.add("slice-group-track"),this.heading_=this.tooltip_=""},get group(){return this.group_},set group(e){this.group_=e,this.updateContents_()},get heading(){return this.heading_},set heading(e){this.heading_=e,this.updateContents_()},get tooltip(){return this.tooltip_},set tooltip(e){this.tooltip_=e,this.updateContents_()},set decorateHit(e){this.decorateHit_=e,this.updateContents_()},addSliceTrack_:function(e){var t=new tracing.tracks.SliceTrack(this.viewport);return t.slices=e,t.decorateHit=this.decorateHit_,t.categoryFilter_=this.categoryFilter,this.appendChild(t),t},get subRows(){return base.asArray(this.children).map(function(e){return e.slices})},get hasVisibleContent(){return 0<this.children.length},updateContents_:function(){if(this.group_){var e=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);if(this.areArrayContentsSame_(this.filteredSlices_,e))this.updateHeadingAndTooltip_();else if(this.filteredSlices_=e,this.detach(),e.length){for(var e=this.buildSubRows_(e),t=0;t<e.length;t++){var i=e[t];i.length&&this.addSliceTrack_(i)}this.updateHeadingAndTooltip_()}}else this.updateHeadingAndTooltip_()},updateHeadingAndTooltip_:function(){this.firstChild&&(this.firstChild.heading=this.heading_,this.firstChild.tooltip=this.tooltip_)},buildSubRows_:function(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)e[i].subSlices&&e[i].subSlices.splice(0,e[i].subSlices.length),t.push(i);t.sort(function(t,i){var n=e[t],r=e[i];return n.start!=r.start?n.start-r.start:i-t});var n=[[]];for(this.badSlices_=[],i=0;i<t.length;i++){for(var r=e[t[i]],s=!1,a=n.length-1;a>=0;a--)if(0!=n[a].length){var o=n[a][n[a].length-1];if(r.start<o.start&&(this.badSlices_.push(r),s=!0),r.start>=o.start&&r.end<=o.end){for(;n.length<=a+1;)n.push([]);n[a+1].push(r),o.subSlices&&o.subSlices.push(r),s=!0;break}}s||n[0].push(r)}return n},areArrayContentsSame_:function(e,t){if(!(e&&t&&e.length&&t.length)||e.length!=t.length)return!1;for(var i=0;i<e.length;++i)if(e[i]!=t[i])return!1;return!0}},{SliceGroupTrack:e}}),base.require("tracing.tracks.slice_group_track"),base.require("ui"),base.exportTo("tracing.tracks",function(){var e=ui.define("async-slice-group-track",tracing.tracks.SliceGroupTrack);return e.prototype={__proto__:tracing.tracks.SliceGroupTrack.prototype,decorate:function(e){tracing.tracks.SliceGroupTrack.prototype.decorate.call(this,e),this.classList.add("async-slice-group-track")},addSliceTrack_:function(e){return e=tracing.tracks.SliceGroupTrack.prototype.addSliceTrack_.call(this,e),e.asyncStyle=!0,e},buildSubRows_:function(){var e=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);e.sort(function(e,t){return e.start-t.start});for(var t=[],i=0;i<e.length;i++){for(var n=e[i],r=!1,s=0;s<t.length;s++){var a=t[s];if(n.start>=a[a.length-1].end){if(r=!0,void 0===n.subSlices||1>n.subSlices.length)throw Error("AsyncEvent missing subSlices: ")+n.name;for(s=0;s<n.subSlices.length;s++)a.push(n.subSlices[s]);break}}if(!r&&(a=[],void 0!==n.subSlices)){for(s=0;s<n.subSlices.length;s++)a.push(n.subSlices[s]);t.push(a)}}return t}},{AsyncSliceGroupTrack:e}}),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 e=ui.define("thread-track",tracing.tracks.ContainerTrack);return e.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(e){tracing.tracks.ContainerTrack.prototype.decorate.call(this,e),this.classList.add("thread-track")},get thread(){return this.thread_},set thread(e){this.thread_=e,this.updateContents_()},get hasVisibleContent(){return 0<this.tracks_.length},updateContents_:function(){if(this.detach(),this.thread_){if(this.heading=this.thread_.userFriendlyName+": ",this.tooltip=this.thread_.userFriendlyDetails,this.thread_.asyncSliceGroup.length){var e=new tracing.tracks.AsyncSliceGroupTrack(this.viewport);e.categoryFilter=this.categoryFilter,e.decorateHit=function(){},e.group=this.thread_.asyncSliceGroup,e.hasVisibleContent&&this.appendChild(e)}this.thread_.samples.length&&(e=new tracing.tracks.SliceTrack(this.viewport),e.categoryFilter=e,e.group=this.thread_,e.slices=this.thread_.samples,e.decorateHit=function(e){e.thread=this.thread_},this.appendChild(e)),this.thread_.cpuSlices&&(e=new tracing.tracks.SliceTrack(this.viewport),e.categoryFilter=this.categoryFilter,e.heading="",e.height="4px",e.decorateHit=function(e){e.thread=this.thread_},e.slices=this.thread_.cpuSlices,e.hasVisibleContent&&this.appendChild(e)),this.thread_.sliceGroup.length&&(e=new tracing.tracks.SliceGroupTrack(this.viewport),e.categoryFilter=this.categoryFilter,e.heading=this.thread_.userFriendlyName,e.tooltip=this.thread_.userFriendlyDetails,e.decorateHit=function(e){e.thread=this.thread_},e.group=this.thread_.sliceGroup,e.hasVisibleContent&&this.appendChild(e))}},collapsedDidChange:function(e){if(e){e=parseInt(this.tracks[0].height);for(var t=0;t<this.tracks.length;++t)e>2?this.tracks[t].height=Math.floor(e)+"px":this.tracks[t].style.display="none",e*=.5}else for(t=0;t<this.tracks.length;++t)this.tracks[t].height=this.tracks[0].height,this.tracks[t].style.display=""}},{ThreadTrack:e}}),base.require("ui"),base.require("base.settings"),base.exportTo("ui",function(){function e(e){var t=document.createElement("span");return e&&(e.className&&(t.className=e.className),e.textContent&&(t.textContent=e.textContent),e.parent&&e.parent.appendChild(t)),t}var t=1;return{createSpan:e,createDiv:function(e){var t=document.createElement("div");return e&&(e.className&&(t.className=e.className),e.parent&&e.parent.appendChild(t)),t},createScopedStyle:function(e){var t=document.createElement("style");return t.scoped=!0,t.innerHTML=e,t},createSelector:function(e,t,i,n,r){function s(n){n=l.selectedOptions[0].targetPropertyValue,base.Settings.set(i,n),e[t]=n}for(var a,o=0;o<r.length;o++){var c=r[o];if(c.value==n){a=o;break}}if(void 0===a)throw Error("defaultValue must be in the items list");var l=document.createElement("select");for(l.addEventListener("change",s),o=0;o<r.length;o++){var c=r[o],h=document.createElement("option");h.textContent=c.label,h.targetPropertyValue=c.value,l.appendChild(h)}for(e.__lookupSetter__("selectedIndex"),l.__defineGetter__("selectedValue",function(){return l.children[l.selectedIndex].targetPropertyValue}),l.__defineSetter__("selectedValue",function(e){for(var t=0;t<l.children.length;t++)if(l.children[t].targetPropertyValue==e)return l.selectedIndex=t,void s();throw Error("Not a valid value")}),r=base.Settings.get(i,n),c=!1,o=0;o<l.children.length;o++)if(l.children[o].targetPropertyValue==r){c=!0,e[t]=r,l.selectedIndex=o;break}return c||(l.selectedIndex=a,e[t]=n),l},createCheckBox:function(i,n,r,s,a){function o(){base.Settings.set(r,c.checked),i[n]=c.checked}var c=document.createElement("input");c.type="checkbox",s=base.Settings.get(r,s),c.checked=!!s,i[n]=s,c.addEventListener("change",o),s="#checkbox-"+t++;var l=e({className:"labeled-checkbox"});c.setAttribute("id",s);var h=document.createElement("label");return h.textContent=a,h.setAttribute("for",s),l.appendChild(c),l.appendChild(h),l.__defineSetter__("checked",function(e){c.checked=!!e,o()}),l.__defineGetter__("checked",function(){return c.checked}),l}}}),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 e=tracing.analysis.ObjectSnapshotView,t=tracing.analysis.ObjectInstanceView,i=tracing.TraceModelSettings,n=tracing.tracks.SpacingTrack,r=ui.define("process-track-base",tracing.tracks.ContainerTrack);return r.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(e){tracing.tracks.ContainerTrack.prototype.decorate.call(this,e),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(e){(this.processBase_=e)&&(this.expanded=new i(this.processBase_.model).getSettingFor(this.processBase_,"expanded",!0)),this.updateContents_()},get expanded(){return this.expandEl_.classList.contains("expand-button-expanded")},set expanded(e){e=!!e,this.expandEl_.classList.contains("expand-button-expanded")!==e&&(e?(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 i(this.processBase_.model).setSettingFor(this.processBase_,"expanded",e))},get hasVisibleContent(){return this.expanded?1<this.children.length:!0},onHeaderClick_:function(e){e.stopPropagation(),e.preventDefault(),this.expanded=!this.expanded},updateContents_:function(){this.tracks_.forEach(function(e){this.removeChild(e)},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 i=this.processBase_.objects.getAllInstancesByTypeName(),r=base.dictionaryKeys(i);r.sort();var s=!1;r.forEach(function(n){var r=i[n],a=t.getViewInfo(n),o=e.getViewInfo(n);a&&!a.options.showInTrackView&&(a=void 0),o&&!o.options.showInTrackView&&(o=void 0);for(var o=a||o,a=[],c=0;c<r.length;c++){var l=r[c];0!==l.snapshots.length&&(l.hasImplicitSnapshots&&!o||a.push(l))}0!==a.length&&(n=tracing.tracks.ObjectInstanceTrack.getTrackConstructor(n),n||(n=tracing.tracks.ObjectInstanceTrack),n=new n(this.viewport),n.categoryFilter=this.categoryFilter_,n.objectInstances=a,this.appendChild(n),s=!0)},this),s&&this.appendChild(new n(this.viewport))},appendCounterTracks_:function(){var e=base.dictionaryValues(this.processBase.counters).filter(this.categoryFilter.matchCounter,this.categoryFilter);e.sort(tracing.trace_model.Counter.compare),e.forEach(function(e){var t=new tracing.tracks.CounterTrack(this.viewport);t.categoryFilter=this.categoryFilter_,t.counter=e,this.appendChild(t),this.appendChild(new n(this.viewport))}.bind(this))},appendThreadTracks_:function(){var e=base.dictionaryValues(this.processBase.threads).filter(function(e){return this.categoryFilter_.matchThread(e)},this);e.sort(tracing.trace_model.Thread.compare),e.forEach(function(e){var t=new tracing.tracks.ThreadTrack(this.viewport);t.categoryFilter=this.categoryFilter_,t.thread=e,t.hasVisibleContent&&(this.appendChild(t),this.appendChild(new n(this.viewport)))}.bind(this))}},{ProcessTrackBase:r}}),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 e=tracing.tracks.ProcessTrackBase,t=tracing.tracks.SpacingTrack,i=ui.define("kernel-track",e);return i.prototype={__proto__:e.prototype,decorate:function(e){tracing.tracks.ProcessTrackBase.prototype.decorate.call(this,e)},set kernel(e){this.processBase=e},get kernel(){return this.processBase},willAppendTracks_:function(){var e=this.categoryFilter,i=base.dictionaryValues(this.kernel.cpus);i.sort(tracing.trace_model.Cpu.compare);for(var n=!1,r=0;r<i.length;++r){var s=i[r];if(!e.matchCpu(s))return;var a=new tracing.tracks.CpuTrack(this.viewport);a.categoryFilter=e,a.cpu=s,a.hasVisibleContent&&(this.appendChild(a),n=!0)}n&&this.appendChild(new t(this.viewport))}},{KernelTrack:i}}),base.require("tracing.tracks.process_track_base"),base.exportTo("tracing.tracks",function(){var e=tracing.tracks.ProcessTrackBase,t=ui.define("process-track",e);return t.prototype={__proto__:e.prototype,decorate:function(e){tracing.tracks.ProcessTrackBase.prototype.decorate.call(this,e)},drawTrack:function(e){switch(e){case tracing.tracks.DrawType.INSTANT_EVENT:if(!this.processBase.instantEvents||0===this.processBase.instantEvents.length)break;var t=this.context();if(void 0===t)break;t.save();var i=this.setupCanvasForDraw_();this.drawInstantEvents_(this.processBase.instantEvents,i.left,i.right),t.restore()}tracing.tracks.ContainerTrack.prototype.drawTrack.call(this,e)},set process(e){this.processBase=e},get process(){return this.processBase},addIntersectingItemsInRangeToSelectionInWorldSpace:function(e,t,i,n){base.iterateOverIntersectingIntervals(this.processBase.instantEvents,function(e){return e.start},function(e){return e.duration},e,t,function(e){e=n.addSlice(this,e),this.decorateHit(e)}.bind(this)),tracing.tracks.ContainerTrack.prototype.addIntersectingItemsInRangeToSelectionInWorldSpace.apply(this,arguments)}},{ProcessTrack:t}}),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 e=ui.define("trace-model-track",tracing.tracks.ContainerTrack);return e.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(e){tracing.tracks.ContainerTrack.prototype.decorate.call(this,e),this.classList.add("model-track")},detach:function(){tracing.tracks.ContainerTrack.prototype.detach.call(this)},get model(){return this.model_},set model(e){this.model_=e,this.updateContents_()},get hasVisibleContent(){return 0<this.children.length},applyCategoryFilter_:function(){this.updateContents_()},updateContents_:function(){if(this.textContent="",this.model_&&this.categoryFilter){var e=this.categoryFilter;this.appendKernelTrack_();var t=this.model_.getAllProcesses();t.sort(tracing.trace_model.Process.compare);for(var i=0;i<t.length;++i){var n=t[i];if(!e.matchProcess(n))break;var r=new tracing.tracks.ProcessTrack(this.viewport);r.categoryFilter=e,r.process=n,r.hasVisibleContent&&this.appendChild(r)}}},appendKernelTrack_:function(){if(this.categoryFilter.matchProcess(this.model.kernel)){var e=new tracing.tracks.KernelTrack(this.viewport);e.categoryFilter=this.categoryFilter,e.kernel=this.model.kernel,e.hasVisibleContent&&this.appendChild(e)}},drawTrack:function(e){switch(e){case tracing.tracks.DrawType.INSTANT_EVENT:if(!this.model_.instantEvents||0===this.model_.instantEvents.length)break;var t=this.context();if(void 0===t)break;t.save();var i=this.setupCanvasForDraw_();this.drawInstantEvents_(this.model_.instantEvents,i.left,i.right),t.restore()}tracing.tracks.ContainerTrack.prototype.drawTrack.call(this,e)},addIntersectingItemsInRangeToSelectionInWorldSpace:function(e,t,i,n){base.iterateOverIntersectingIntervals(this.model_.instantEvents,function(e){return e.start},function(e){return e.duration},e,t,function(e){e=n.addSlice(this,e),this.decorateHit(e)}.bind(this)),tracing.tracks.ContainerTrack.prototype.addIntersectingItemsInRangeToSelectionInWorldSpace.apply(this,arguments)}},{TraceModelTrack:e}}),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 e=ui.define("div");return e.prototype={__proto__:HTMLDivElement.prototype,decorate:function(e){this.classList.add("mouse-mode-selector"),this.parentEl_=e,e=base.instantiateTemplate("#mouse-mode-selector-template"),this.appendChild(e),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(e){if(this.currentMode_!==e){var t=tracing.mouseModeConstants;switch(this.currentMode_=e,this.panScanModeButton_.classList.remove("active"),this.selectionModeButton_.classList.remove("active"),this.zoomModeButton_.classList.remove("active"),e){case t.MOUSE_MODE_PANSCAN:this.panScanModeButton_.classList.add("active");break;case t.MOUSE_MODE_SELECTION:this.selectionModeButton_.classList.add("active");break;case t.MOUSE_MODE_ZOOM:this.zoomModeButton_.classList.add("active");break;default:throw Error("Unknown selection mode: "+e)}base.Settings.set("mouse_mode_selector.mouseMode",e)}},getCurrentModeEventNames_:function(){var e=tracing.mouseModeConstants,t={begin:"",update:"",end:""};switch(this.mode){case e.MOUSE_MODE_PANSCAN:t.begin="beginpan",t.update="updatepan",t.end="endpan";
+break;case e.MOUSE_MODE_SELECTION:t.begin="beginselection",t.update="updateselection",t.end="endselection";break;case e.MOUSE_MODE_ZOOM:t.begin="beginzoom",t.update="updatezoom",t.end="endzoom";break;default:throw Error("Unsupported interaction mode")}return t},onMouseDown_:function(e){var t=this.getCurrentModeEventNames_(),t=new base.Event(t.begin,!0,!0);t.data=e,this.dispatchEvent(t),this.isInteracting_=!0},onMouseMove_:function(e){var t=this.getCurrentModeEventNames_(),t=new base.Event(t.update,!0,!0);t.data=e,this.dispatchEvent(t)},onMouseUp_:function(e){var t=this.getCurrentModeEventNames_(),t=new base.Event(t.end,!0,!0),i=!e.shiftKey,n=base.isMac&&!e.metaKey||!base.isMac&&!e.ctrlKey;t.data=e,this.dispatchEvent(t),this.isInteracting_=!1,this.isInTemporaryAlternativeMouseMode_&&i&&n&&(this.mode=tracing.mouseModeConstants.MOUSE_MODE_PANSCAN)},onButtonMouseDown_:function(e){e.preventDefault(),e.stopImmediatePropagation()},onButtonMouseUp_:function(e){e.preventDefault(),e.stopImmediatePropagation()},onButtonPress_:function(e){var t=tracing.mouseModeConstants;switch(e.target){case this.panScanModeButton_:this.mode=t.MOUSE_MODE_PANSCAN;break;case this.selectionModeButton_:this.mode=t.MOUSE_MODE_SELECTION;break;case this.zoomModeButton_:this.mode=t.MOUSE_MODE_ZOOM;break;default:throw Error("Unknown mouse mode button pressed")}e.preventDefault(),this.isInTemporaryAlternativeMouseMode_=!1},onKeyPress_:function(e){if(!this.isInteracting_){var t=tracing.mouseModeConstants;switch(e.keyCode){case 49:this.mode=t.MOUSE_MODE_PANSCAN;break;case 50:this.mode=t.MOUSE_MODE_SELECTION;break;case 51:this.mode=t.MOUSE_MODE_ZOOM}}},onKeyDown_:function(e){if(!this.isInteracting_){var t=tracing.mouseModeConstants,i=base.isMac&&e.metaKey||!base.isMac&&e.ctrlKey,n=e.shiftKey;this.mode===t.MOUSE_MODE_PANSCAN&&(i||n)&&(this.mode=i?t.MOUSE_MODE_ZOOM:t.MOUSE_MODE_SELECTION,this.isInTemporaryAlternativeMouseMode_=!0,e.preventDefault())}},onKeyUp_:function(e){if(!this.isInteracting_){var t=tracing.mouseModeConstants,i=base.isMac&&!e.metaKey||!base.isMac&&!e.ctrlKey;e=e.shiftKey,this.isInTemporaryAlternativeMouseMode_&&(i||e)&&(this.mode=t.MOUSE_MODE_PANSCAN),this.isInTemporaryAlternativeMouseMode_=!1}},constrainPositionToWindowBounds_:function(){var e=window.innerHeight-this.offsetHeight,t=window.innerWidth-this.offsetWidth;this.pos_.x=Math.max(this.pos_.x,0),this.pos_.x=Math.min(this.pos_.x,t),this.pos_.y=Math.max(this.pos_.y,0),this.pos_.y=Math.min(this.pos_.y,e)},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(e){e.preventDefault(),e.stopImmediatePropagation(),this.isDraggingModeSelectorDragHandle_=!0,this.initialRelativeMouseDownPos_.x=e.clientX-this.offsetLeft,this.initialRelativeMouseDownPos_.y=e.clientY-this.offsetTop},onDragHandleMouseMove_:function(e){this.isDraggingModeSelectorDragHandle_&&(this.pos_.x=e.clientX-this.initialRelativeMouseDownPos_.x,this.pos_.y=e.clientY-this.initialRelativeMouseDownPos_.y,this.constrainPositionToWindowBounds_(),this.updateStylesFromPosition_())},onDragHandleMouseUp_:function(){this.isDraggingModeSelectorDragHandle_=!1},onWindowResize_:function(){this.constrainPositionToWindowBounds_(),this.updateStylesFromPosition_()}},{MouseModeSelector:e}}),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 e=tracing.Selection,t=tracing.TimelineViewport,i=ui.define("div");return i.prototype={__proto__:HTMLDivElement.prototype,model_:null,decorate:function(){this.classList.add("timeline-track-view"),this.categoryFilter_=new tracing.CategoryFilter,this.viewport_=new t(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 e,this.isZooming_=this.isPanningAndScanning_=!1},distanceCoveredInPanScan_:function(e){e=this.lastMouseViewPos_.x-this.mouseViewPosAtMouseDown_.x;var t=this.lastMouseViewPos_.y-this.mouseViewPosAtMouseDown_.y;return Math.sqrt(e*e+t*t)},bindEventListener_:function(e,t,i,n){this.boundListeners_||(this.boundListeners_=[]),i=i.bind(n),this.boundListeners_.push({object:e,event:t,boundFunc:i}),e.addEventListener(t,i)},detach:function(){this.modelTrack_.detach();for(var e=0;e<this.boundListeners_.length;e++){var t=this.boundListeners_[e];t.object.removeEventListener(t.event,t.boundFunc)}this.boundListeners_=void 0,this.viewport_.detach()},get viewport(){return this.viewport_},get categoryFilter(){return this.categoryFilter_},set categoryFilter(e){this.modelTrackContainer_.invalidate(),this.categoryFilter_=e,this.modelTrack_.categoryFilter=e},get model(){return this.model_},set model(e){if(!e)throw Error("Model cannot be null");var t=this.model_!=e;this.model_=e,this.modelTrack_.model=e,this.modelTrack_.categoryFilter=this.categoryFilter,t&&this.viewport_.setWhenPossible(this.setInitialViewport_.bind(this)),base.setPropertyAndDispatchChange(this,"model",e)},get hasVisibleContent(){return this.modelTrack_.hasVisibleContent},setInitialViewport_:function(){var e,t,i=this.modelTrackContainer_.canvas.width;this.model_.bounds.isEmpty?(e=0,t=1e3):0==this.model_.bounds.range?(e=this.model_.bounds.min,t=1e3):(e=this.model_.bounds.min,t=this.model_.bounds.range);var n=.15*t;this.viewport_.xSetWorldBounds(e-n,e+t+n,i)},addAllObjectsMatchingFilterToSelection:function(e,t){this.modelTrack_.addAllObjectsMatchingFilterToSelection(e,t)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},set focusElement(e){this.focusElement_=e},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},onMouseMove_:function(e){this.isZooming_||this.storeLastMousePos_(e)},onKeypress_:function(e){var t=this.viewport_;if(this.listenToKeys_&&"INPUT"!=document.activeElement.nodeName){var i=this.modelTrackContainer_.canvas.clientWidth;switch(e.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_(.1);break;case 97:t.panX+=t.xViewVectorToWorld(.1*i);break;case 100:case 101:t.panX-=t.xViewVectorToWorld(.1*i);break;case 65:t.panX+=t.xViewVectorToWorld(.5*i);break;case 68:t.panX-=t.xViewVectorToWorld(.5*i);break;case 48:case 122:this.setInitialViewport_();break;case 102:this.zoomToSelection()}}},onKeydown_:function(e){if(this.listenToKeys_){var t,i=this.viewport_,n=this.modelTrackContainer_.canvas.clientWidth;switch(e.keyCode){case 37:(t=this.selection.getShiftedSelection(-1))?(this.selection=t,this.panToSelection(),e.preventDefault()):i.panX+=i.xViewVectorToWorld(.1*n);break;case 39:(t=this.selection.getShiftedSelection(1))?(this.selection=t,this.panToSelection(),e.preventDefault()):i.panX-=i.xViewVectorToWorld(.1*n);break;case 9:-1==this.focusElement.tabIndex&&(e.shiftKey?this.selectPrevious_(e):this.selectNext_(e),e.preventDefault())}}},onKeyup_:function(e){this.listenToKeys_&&(e.shiftKey||this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_))},zoomBy_:function(e){var t=this.viewport_,i=this.modelTrackContainer_.canvas.clientWidth,n=this.lastMouseViewPos_.x*(window.devicePixelRatio||1),r=t.xViewToWorld(n);t.scaleX*=e,t.xPanWorldPosToViewPos(r,n,i)},zoomToSelection:function(){if(this.selection&&this.selection.length){var e=this.selection.bounds;if(e.range){var t=e.center,e=.5*e.range,i=.5*e;this.viewport_.xSetWorldBounds(t-e-i,t+e+i,this.modelTrackContainer_.canvas.width)}}},panToSelection:function(){if(this.selection&&this.selection.length){var e=this.selection.bounds,t=e.center,i=this.modelTrackContainer_.canvas.width;if(e.range){var n=.5*e.range,r=.5*n;this.viewport_.xPanWorldBoundsIntoView(t-n-r,t+n+r,i),this.viewport_.xPanWorldBoundsIntoView(e.min,e.max,i)}else(0>this.viewport_.xWorldToView(e.center)||this.viewport_.xWorldToView(e.center)>i)&&this.viewport_.xPanWorldPosToViewPos(t,"center",i)}},get keyHelp(){var e="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",e=this.focusElement.tabIndex?e+" <-                 : Select previous event on current timeline\n ->                 : Select next event on current timeline\n":e+"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 e+"\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(t){if(!(t instanceof e))throw Error("Expected Selection");var i;for(i=0;i<this.selection_.length;i++)this.selection_[i].selected=!1;for(this.selection_.clear(),this.selection_.addSelection(t),base.dispatchSimpleEvent(this,"selectionChange"),i=0;i<this.selection_.length;i++)this.selection_[i].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(e,t,i,n){var r=Math.min(t,n);n=Math.max(t,n),t=Math.min(e,i),e=Math.max(e,i),this.modelTrack_.getBoundingClientRect(),i=t+(e-t),n=r+(n-r);var s=this.modelTrackContainer_.getBoundingClientRect(),a=s.left,o=s.top,c=s.right,s=s.bottom,l=window.getComputedStyle(this.querySelector("heading")).width,l=parseInt(l),a=a+l;l={},t>c||a>i||r>s||o>n?r=!1:(l.left=Math.max(a,t),l.top=Math.max(o,r),l.right=Math.min(c,i),l.bottom=Math.min(s,n),l.width=l.right-l.left,l.height=l.bottom-l.top,r=l),this.dragBox_.style.left=r.left+"px",this.dragBox_.style.width=r.width+"px",this.dragBox_.style.top=r.top+"px",this.dragBox_.style.height=r.height+"px",r=window.devicePixelRatio||1,i=this.modelTrackContainer_.canvas,t=this.viewport_.xViewToWorld((t-i.offsetLeft)*r),r=this.viewport_.xViewToWorld((e-i.offsetLeft)*r),e=Math.round(100*(r-t))/100,this.dragBox_.textContent=e+"ms",e=new base.Event("selectionChanging"),e.loWX=t,e.hiWX=r,this.dispatchEvent(e)},onGridToggle_:function(e){var t=e?this.selection_.bounds.min:this.selection_.bounds.max;if(this.viewport_.gridEnabled&&this.viewport_.gridSide===e&&this.viewport_.gridTimebase===t)this.viewport_.gridside=void 0,this.viewport_.gridEnabled=!1,this.viewport_.gridTimebase=void 0;else{var i=Math.ceil((t-this.model_.bounds.min)/this.viewport_.gridStep_);this.viewport_.gridTimebase=t-(i+1)*this.viewport_.gridStep_,this.viewport_.gridEnabled=!0,this.viewport_.gridSide=e,this.viewport_.gridTimebase=t}},canBeginInteraction_:function(e){return 0!=e.button||ui.elementIsChildOf(e.target,this.rulerTrack_)?!1:!0},onDblClick_:function(e){if(this.isPanningAndScanning_){var t=new base.Event("endpan");t.data=e,this.onEndPanScan_(t)}this.isZooming_&&(t=new base.Event("endzoom"),t.data=e,this.onEndZoom_(t)),this.rulerTrack_.placeAndBeginDraggingMarker(e.clientX),e.preventDefault()},storeLastMousePos_:function(e){this.lastMouseViewPos_=this.extractRelativeMousePosition_(e)},extractRelativeMousePosition_:function(e){var t=this.modelTrackContainer_.canvas;return{x:e.clientX-t.offsetLeft,y:e.clientY-t.offsetTop}},storeInitialMouseDownPos_:function(e){e=this.extractRelativeMousePosition_(e),this.mouseViewPosAtMouseDown_.x=e.x,this.mouseViewPosAtMouseDown_.y=e.y},focusElements_:function(){document.activeElement&&document.activeElement.blur(),0<=this.focusElement.tabIndex&&this.focusElement.focus()},storeInitialInteractionPositionsAndFocus_:function(e){this.storeInitialMouseDownPos_(e),this.storeLastMousePos_(e),this.focusElements_()},onBeginPanScan_:function(e){var t=this.viewport_;e=e.data,this.canBeginInteraction_(e)&&(this.viewportStateAtMouseDown_=t.getStateInViewCoordinates(),this.isPanningAndScanning_=!0,this.storeInitialInteractionPositionsAndFocus_(e),e.preventDefault())},onUpdatePanScan_:function(e){this.isPanningAndScanning_&&(e=e.data,this.viewport_.setStateInViewCoordinates({panX:this.viewportStateAtMouseDown_.panX+(this.lastMouseViewPos_.x-this.mouseViewPosAtMouseDown_.x),panY:this.viewportStateAtMouseDown_.panY-(this.lastMouseViewPos_.y-this.mouseViewPosAtMouseDown_.y)}),e.preventDefault(),e.stopPropagation(),this.storeLastMousePos_(e))},onEndPanScan_:function(e){var t=e.data;this.isPanningAndScanning_=!1,this.storeLastMousePos_(t),4<this.distanceCoveredInPanScan_(t)||(this.dragBeginEvent_=t,this.onEndSelection_(e))},onBeginSelection_:function(e){if(e=e.data,this.canBeginInteraction_(e)){var t=this.modelTrackContainer_.canvas,i=this.modelTrack_.getBoundingClientRect(),t=t.getBoundingClientRect();i&&e.clientX>=i.left&&e.clientX<i.right&&e.clientY>=i.top&&e.clientY<i.bottom&&e.clientX>=t.left&&e.clientX<t.right&&(this.dragBeginEvent_=e,this.storeInitialInteractionPositionsAndFocus_(e),e.preventDefault())}},onUpdateSelection_:function(e){e=e.data,this.dragBeginEvent_&&(this.dragBoxXStart_=this.dragBeginEvent_.clientX,this.dragBoxXEnd_=e.clientX,this.dragBoxYStart_=this.dragBeginEvent_.clientY,this.dragBoxYEnd_=e.clientY,this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_))},onEndSelection_:function(t){if(this.dragBeginEvent_){var i=t.data;this.hideDragBox_();var n=this.dragBeginEvent_||i;this.dragBeginEvent_=null;var r=Math.min(n.clientY,i.clientY),s=Math.max(n.clientY,i.clientY),a=Math.min(n.clientX,i.clientX),i=Math.max(n.clientX,i.clientX);this.modelTrackContainer_.getBoundingClientRect(),n=this.modelTrackContainer_.canvas,a-=n.offsetLeft,i-=n.offsetLeft,n=new e,this.modelTrack_.addIntersectingItemsInRangeToSelection(a,i,r,s,n),this.selection=n,(base.isMac&&t.metaKey||!base.isMac&&t.ctrlKey)&&this.zoomToSelection_()}},onBeginZoom_:function(e){e=e.data,this.canBeginInteraction_(e)&&(this.isZooming_=!0,this.storeInitialInteractionPositionsAndFocus_(e),e.preventDefault())},onUpdateZoom_:function(e){if(this.isZooming_){e=e.data;var t=this.extractRelativeMousePosition_(e);this.zoomBy_(1+.01*(this.lastMouseViewPos_.y-t.y)),this.storeLastMousePos_(e)}},onEndZoom_:function(){this.isZooming_=!1}},{TimelineTrackView:i}}),base.require("tracing.timeline_track_view"),base.require("tracing.filter"),base.require("ui.overlay"),base.exportTo("tracing",function(){function e(){this.model_=this.timeline_=void 0,this.filterText_="",this.filterHits_=new tracing.Selection,this.filterHitsDirty_=!0,this.currentHitIndex_=-1}var t=ui.define("div");return t.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 e=document.createElement("div");e.className="button find-previous",e.textContent="←",e.addEventListener("click",this.findPrevious_.bind(this));var t=document.createElement("div");t.className="button find-next",t.textContent="→",t.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(e){13==e.keyCode?e.shiftKey?this.findPrevious_():this.findNext_():27==e.keyCode&&(this.filterEl_.blur(),this.updateHitCountEl_())}.bind(this)),this.filterEl_.addEventListener("blur",function(){this.updateHitCountEl_()}.bind(this)),this.filterEl_.addEventListener("focus",function(){this.controller.reset(),this.filterTextChanged_(),this.filterEl_.select()}.bind(this)),this.filterEl_.addEventListener("mouseup",function(e){e.preventDefault()}),this.appendChild(this.filterEl_),this.appendChild(e),this.appendChild(t),this.appendChild(this.hitCountEl_),this.updateHitCountEl_()},get controller(){return this.controller_},set controller(e){this.controller_=e,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 e=this.controller.currentHitIndex,t=this.controller.filterHits.length;this.hitCountEl_.textContent=0==t?"0 of 0":e+1+" of "+t}else this.hitCountEl_.textContent=""}},e.prototype={__proto__:Object.prototype,get timeline(){return this.timeline_},set timeline(e){this.timeline_=e,this.filterHitsDirty_=!0},get filterText(){return this.filterText_},set filterText(e){e!=this.filterText_&&(this.filterText_=e,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 e=new tracing.TitleFilter(this.filterText);this.timeline.addAllObjectsMatchingFilterToSelection(e,this.filterHits_)}return this.filterHits_},get currentHitIndex(){return this.currentHitIndex_},showHits_:function(e,t,i){this.timeline&&(this.timeline.selection=e,t?this.timeline.zoomToSelection():i&&this.timeline.panToSelection())},find_:function(e){var t=-1===this.currentHitIndex_;t&&0>e&&(this.currentHitIndex_=0);var i=this.filterHits.length;this.currentHitIndex_=(this.currentHitIndex_+e+i)%i,e=this.filterHits.subSelection(this.currentHitIndex_),this.showHits_(e,t,!0)},findNext:function(){this.find_(1)},findPrevious:function(){this.find_(-1)},reset:function(){this.filterText_="",this.filterHitsDirty_=!0}},{FindControl:t,FindController:e}}),base.require("ui"),base.requireStylesheet("ui.drag_handle"),base.exportTo("ui",function(){var e=ui.define("x-drag-handle");return e.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(e){this.observer_.disconnect(),(this.target_=e)&&this.observer_.observe(this.target_,{attributes:!0,attributeFilter:["class"]})},get horizontal(){return this.horizontal_},set horizontal(e){this.className=(this.horizontal_=e)?"horizontal-drag-handle":"vertical-drag-handle"},get vertical(){return!this.horizontal_},set vertical(e){this.horizontal=!e},forceMutationObserverFlush_:function(){var e=this.observer_.takeRecords();e.length&&this.didTargetMutate_(e)},didTargetMutate_:function(e){e=this.targetSizesByModeKey_[this.modeKey_],void 0!==e?this.setTargetSize_(e):this.target_.style[this.targetStyleKey_]=""},get targetStyleKey_(){return this.horizontal_?"height":"width"},getTargetSize_:function(){var e=this.targetStyleKey_;return this.target_.style[e]||(this.target_.style[e]=window.getComputedStyle(this.target_)[e]),e=parseInt(this.target_.style[e]),this.targetSizesByModeKey_[this.modeKey_]=e},setTargetSize_:function(e){this.target_.style[this.targetStyleKey_]=e+"px",this.targetSizesByModeKey_[this.modeKey_]=e},applyDelta_:function(e){var t=this.getTargetSize_();if(this.target_==this.nextSibling)e=t+e;else{if(this.target_!=this.previousSibling)throw Error("Must be next sibling");e=t-e}this.setTargetSize_(e)},onMouseMove_:function(e){var t=this.horizontal_?e.clientY:e.clientX;return this.applyDelta_(this.lastMousePos_-t),this.lastMousePos_=t,e.preventDefault(),!0},onMouseDown_:function(e){return this.target_?(this.forceMutationObserverFlush_(),this.lastMousePos_=this.horizontal_?e.clientY:e.clientX,document.addEventListener("mousemove",this.onMouseMove_),document.addEventListener("mouseup",this.onMouseUp_),e.preventDefault(),!0):void 0},onMouseUp_:function(e){document.removeEventListener("mousemove",this.onMouseMove_),document.removeEventListener("mouseup",this.onMouseUp_),e.preventDefault()}},{DragHandle:e}}),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 e=ui.define("div");return e.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("timeline-view");var e=base.instantiateTemplate("#timeline-view-template");this.appendChild(e),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 e=base.instantiateTemplate("#import-errors-btn-template"),t=e.querySelector(".view-import-errors-button"),e=e.querySelector(".info-button-container"),i=e.querySelector(".info-button-text"),n=new ui.Overlay;return n.classList.add("view-import-errors-overlay"),n.obeyCloseEvents=!0,n.appendChild(e),t.addEventListener("click",function(){n.visible=!0,i.textContent=this.model.importErrors.join("\n")}.bind(this)),e=function(){t.style.display=this.model&&this.model.importErrors.length?"":"none"}.bind(this),e(),this.addEventListener("modelChange",e),t},updateCategoryFilter_:function(e){this.timeline_&&(this.timeline_.categoryFilter=new tracing.CategoryFilter(e))},createCategoryFilterButton_:function(){var e=base.instantiateTemplate("#category-filter-btn-template").querySelector(".view-info-button");e.addEventListener("click",function(){var e=new tracing.CategoryFilterDialog;e.categories=this.model.categories,e.settings_key="categories",e.settingUpdatedCallback=this.updateCategoryFilter_.bind(this),e.visible=!0}.bind(this));var t=function(){e.style.display=this.model?"":"none"}.bind(this);return t(),this.addEventListener("modelChange",t),e},createHelpButton_:function(){var e=base.instantiateTemplate("#help-btn-template"),t=e.querySelector(".view-help-button"),i=e.querySelector(".view-help-text"),n=new ui.Overlay;return n.classList.add("view-help-overlay"),n.obeyCloseEvents=!0,n.additionalCloseKeyCodes.push(63),n.appendChild(i),t.addEventListener("click",function(e){return n.visible=!0,i.textContent=this.timeline_?this.timeline_.keyHelp:"No content loaded. For interesting help, load something.",e.stopPropagation(),!1}.bind(this)),t},createMetadataButton_:function(){var e=base.instantiateTemplate("#metadata-btn-template"),t=e.querySelector(".view-metadata-button"),e=e.querySelector(".info-button-container"),i=e.querySelector(".info-button-text"),n=new ui.Overlay;return n.classList.add("view-metadata-overlay"),n.obeyCloseEvents=!0,n.appendChild(e),t.addEventListener("click",function(){n.visible=!0;var e,t=[],r=this.model;for(e in r.metadata){var s=r.metadata[e],a=JSON.stringify(s.name),s=JSON.stringify(s.value,void 0," ");t.push(a+": "+s)}i.textContent=t.join("\n")}.bind(this)),e=function(){t.style.display=this.model&&this.model.metadata.length?"":"none"}.bind(this),e(),this.addEventListener("modelChange",e),t},get leftControls(){return this.leftControlsEl_},get rightControls(){return this.rightControlsEl_},get viewTitle(){return this.titleEl_.textContent.substring(this.titleEl_.textContent.length-2)},set viewTitle(e){void 0===e?(this.titleEl_.textContent="",this.titleEl_.hidden=!0):(this.titleEl_.hidden=!1,this.titleEl_.textContent=e)},set traceData(e){this.model=new tracing.TraceModel(e)},get model(){return this.timeline_?this.timeline_.model:void 0},set model(e){var t=e!=this.model,i=e&&!e.bounds.isEmpty;t&&(this.timelineContainer_.textContent="",this.timeline_&&(this.timeline_.removeEventListener("selectionChange",this.onSelectionChanged_),this.timeline_.detach(),this.timeline_=void 0,this.findCtl_.controller.timeline=void 0)),i&&!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()),i&&(this.timeline_.model=e),base.dispatchSimpleEvent(this,"modelChange"),t&&this.onSelectionChanged_()},get timeline(){return this.timeline_},get settings(){return this.settings_||(this.settings_=new base.Settings),this.settings_},set focusElement(e){this.focusElement_=e,this.timeline_&&(this.timeline_.focusElement=e)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},get isAttachedToDocument_(){for(var e=this;e.parentNode;)e=e.parentNode;return e==this.ownerDocument},get listenToKeys_(){return this.isAttachedToDocument_?this.focusElement_&&0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0:void 0},onKeypress_:function(e){this.listenToKeys_&&(47==event.keyCode?(this.findCtl_.focus(),event.preventDefault()):63==e.keyCode&&(this.querySelector(".view-help-button").click(),e.preventDefault()))},beginFind:function(){if(!this.findInProgress_){this.findInProgress_=!0;var e=tracing.FindControl();e.controller=new tracing.FindController,e.controller.timeline=this.timeline,e.visible=!0,e.addEventListener("close",function(){this.findInProgress_=!1}.bind(this)),e.addEventListener("findNext",function(){}),e.addEventListener("findPrevious",function(){})}},onSelectionChanged_:function(e){e=this.timelineContainer_.scrollTop;var t=this.timeline_?this.timeline_.selection:new tracing.Selection;this.analysisEl_.selection=t,this.timelineContainer_.scrollTop=e},onRequestSelectionChange_:function(e){this.timeline_.selection=e.selection,e.stopPropagation()}},{TimelineView:e}}),base.require("tracing.timeline_view"),base.require("tracing.importer");
diff --git a/tools/ttrace_parser/scripts/ttrace.py b/tools/ttrace_parser/scripts/ttrace.py
new file mode 100755 (executable)
index 0000000..199cceb
--- /dev/null
@@ -0,0 +1,549 @@
+#!/usr/bin/env python
+###########################################################################
+#
+# Copyright 2017 Samsung Electronics All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+# either express or implied. See the License for the specific
+# language governing permissions and limitations under the License.
+#
+###########################################################################
+
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#    * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#    * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#    * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Android system-wide tracing utility.
+
+This is a tool for capturing a trace that includes data from both userland and
+the kernel.  It creates an HTML file for visualizing the trace.
+"""
+import os
+import sys
+import time
+import zlib
+import errno
+import string
+import select
+import optparse
+import pid_parser
+import subprocess
+
+flattened_css_file = 'style.css'
+flattened_js_file = 'tscript.js'
+
+g_device_serial = None
+
+
+class OptionParserIgnoreErrors(optparse.OptionParser):
+    def error(self, msg):
+        pass
+
+    def exit(self):
+        pass
+
+    def print_usage(self):
+        pass
+
+    def print_help(self):
+        pass
+
+    def print_version(self):
+        pass
+
+
+def compose_html_win(script_dir, options, css, js, templates):
+    data = []
+
+    ret_fd = os.open(options.from_file_win, os.O_RDONLY | os.O_BINARY)
+
+    out = os.read(ret_fd, 4096)
+    parts = out.split('TRACE:', 1)
+    data.append(parts[1])
+
+    while True:
+        out = os.read(ret_fd, 4096)
+        keepReading = False
+        if len(out) > 0:
+            keepReading = True
+            data.append(out)
+        if not keepReading:
+            break
+
+    data = ''.join(data)
+
+    if data.startswith('\r\n'):
+        data = data.replace('\r\n', '\n')
+
+    data = data[1:]
+
+    html_filename = options.output_file
+    html_prefix = read_asset(script_dir, 'prefix.html')
+    html_suffix = read_asset(script_dir, 'suffix.html')
+
+    html_file = open(html_filename, 'w')
+    html_file.write(html_prefix % (css, js, templates))
+
+    size = 4096
+    dec = zlib.decompressobj()
+
+    for chunk in (data[i:i + size] for i in xrange(0, len(data), size)):
+        decoded_chunk = dec.decompress(chunk)
+        html_chunk = decoded_chunk.replace('\n', '\\n\\\n')
+        html_file.write(html_chunk)
+
+    html_out = dec.flush().replace('\n', '\\n\\\n')
+
+    # write body
+    html_file.write(html_out)
+
+    # write suffix
+    html_file.write(html_suffix)
+    html_file.close()
+    print "\n    wrote file://%s\n" % os.path.abspath(options.output_file)
+
+    return
+
+
+def compose_html(script_dir, options, css, js, templates):
+    html_filename = options.output_file
+    html_prefix = read_asset(script_dir, 'prefix.html')
+    html_suffix = read_asset(script_dir, 'suffix.html')
+
+    html_file = open(html_filename, 'w')
+    html_file.write(html_prefix % (css, js, templates))
+
+    cur_dir = os.getcwd()
+
+    # remove useless 2 lines
+    with open(os.path.join(cur_dir, options.from_text_file), "r") as input:
+        with open(os.path.join(cur_dir, options.from_text_file + 'composing'), "wb") as output:
+            for line in input:
+                if "capturing trace" in line:
+                    continue
+                elif "TRACE:" in line:
+                    continue
+                elif " done" in line:
+                    continue
+                elif '\n' == line:
+                    continue
+                else:
+                    output.write(line)
+
+    # case not compressed, boot case
+    html_out = read_asset(script_dir, os.path.join(cur_dir, options.from_text_file + 'composing'))
+    html_out = html_out.replace('\n', '\\n\\\n')
+    os.remove(os.path.join(cur_dir, options.from_text_file + 'composing'))
+
+    # write body
+    html_file.write(html_out)
+
+    # Write suffix
+    html_file.write(html_suffix)
+    html_file.close()
+    print "\n    wrote file://%s\n" % os.path.abspath(options.output_file)
+
+    return
+
+
+def get_os_cmd(cmdARGS):
+    fd_popen = subprocess.Popen(cmdARGS.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    ready = select.select([fd_popen.stdout, fd_popen.stderr], [], [fd_popen.stdout, fd_popen.stderr])
+    if fd_popen.stdout in ready[0]:
+        out = os.read(fd_popen.stdout.fileno(), 4096)
+        return out
+    else:
+        return 0
+
+
+def sdb_shell(str_param):
+    global g_options
+    cmd_str = ['sdb']
+    if g_device_serial:
+        cmd_str.extend(['-s', str(g_device_serial)])
+    cmd_str.extend([str(str_param)])
+    os.system(string.join(cmd_str))
+    os.system('sleep 2')
+
+
+def is_sdb_available():
+    no = 0
+    max_no = 10
+    sdb_shell('kill-server')
+    while(no < max_no):
+        str_cmd = get_os_cmd('sdb start-server')
+        str_cmd = get_os_cmd('sdb devices')
+        os.system('sleep 2')
+        l_devices = str_cmd.split('\n')
+        if len(l_devices) > 3:
+            if g_device_serial is None:
+                    print 'Please specify serial with -e option'
+                    sys.exit(1)
+        dev_type = str_cmd.split("List of devices attached")[-1].split()
+        if 'device' in dev_type:
+            print 'Ready to connect'
+            return dev_type[0]
+        else:
+            no = no + 1
+            print 'retry...' + str(no)
+            sdb_shell('kill-server')
+    if no == max_no:
+        print 'Could not connect to SDB devices'
+        sys.exit(1)
+
+
+def set_sdb_root():
+    dev_type = is_sdb_available()
+    if dev_type == 0:
+        return 0
+
+    sdb_shell('root on')
+    if not ('emulator' in dev_type):
+        sdb_shell('shell change-booting-mode.sh --update')
+
+    print 'SDB was rooted!!!'
+    return 1
+
+
+def trace_bootup(cmd):
+    if set_sdb_root() == 0:
+        return
+
+    print cmd + ' > /etc/ttrace.conf\''
+    str_cmd = cmd + ' > /etc/ttrace.conf\''
+    os.system(str_cmd)
+    os.system('sleep 2')
+
+    sdb_shell('shell sync')
+    sdb_shell('shell reboot')
+    sdb_shell('kill-server')
+
+
+def add_sdb_serial(command, serial):
+    if serial is not None:
+        command.insert(1, serial)
+        command.insert(1, '-s')
+
+
+def main():
+    global g_device_serial
+    usage = "Usage: %prog [options] [category1 [category2 ...]]"
+    desc = "Example: %prog -b 32768 -t 15 gfx input view sched freq"
+    parser = optparse.OptionParser(usage=usage, description=desc)
+    parser.add_option('-o', dest='output_file', help='write HTML to FILE',
+            default='trace.html', metavar='FILE')
+    parser.add_option('-t', '--time', dest='trace_time', type='int',
+            help='trace for N seconds', metavar='N')
+    parser.add_option('-b', '--buf-size', dest='trace_buf_size', type='int',
+            help='use a trace buffer size of N KB', metavar='N')
+    parser.add_option('-l', '--list-categories', dest='list_categories', default=False,
+            action='store_true', help='list the available categories and exit')
+    parser.add_option('-u', '--bootup', dest='trace_bootup', default=False,
+            action='store_true', help='trace boot up')
+    parser.add_option('--link-assets', dest='link_assets', default=False,
+            action='store_true', help='link to original CSS or JS resources '
+            'instead of embedding them')
+    parser.add_option('--from-file', dest='from_file', action='store',
+            help='read the trace from a file (compressed) rather than running a live trace')
+    parser.add_option('--from-file-win', dest='from_file_win', action='store',
+            help='read the trace from a file (compressed) rather than running a live trace on windows')
+    parser.add_option('--from-text-file', dest='from_text_file', action='store',
+            help='read the trace from a file (not compressed) rather than running a live trace')
+    parser.add_option('--asset-dir', dest='asset_dir', default='trace-viewer',
+            type='string', help='')
+    parser.add_option('-e', '--serial', dest='device_serial', type='string',
+            help='sdb device serial number')
+    parser.add_option('--async_start', dest='async_start', default=False, action='store_true',
+            help='start circular trace and return immediately')
+    parser.add_option('--async_dump', dest='async_dump', default=False, action='store_true',
+            help='dump the current contents of circular trace buffer')
+    parser.add_option('--async_stop', dest='async_stop', default=False, action='store_true',
+            help='stop tracing and dump the current contents of circular trace buffer')
+    parser.add_option('--append', dest='append', default=False, action='store_true',
+            help='append traces to the existing traces. do not clear the trace buffer')
+    parser.add_option('--backup', dest='backup', default=False, action='store_true',
+            help='back up the existing traces to /tmp/trace.backup and then clear the trace buffer')
+
+    options, args = parser.parse_args()
+
+    if options.list_categories:
+        atrace_args = ['sdb', 'shell', 'atrace', '--list_categories']
+        expect_trace = False
+    elif options.from_file is not None:
+        atrace_args = ['cat', options.from_file]
+        expect_trace = True
+    elif options.from_file_win is not None:
+        atrace_args = ['type', options.from_file_win]
+        expect_trace = True
+    elif options.from_text_file is not None:
+        atrace_args = ['cat', options.from_text_file]
+        expect_trace = True
+    else:
+        if options.trace_bootup:
+            atrace_args = ['sdb', 'shell', '\'echo', 'atrace']
+            expect_trace = True
+        else:
+            atrace_args = ['sdb', 'shell', 'atrace', '-z']
+            expect_trace = True
+
+        if options.trace_time is not None:
+            if options.trace_time > 0:
+                atrace_args.extend(['-t', str(options.trace_time)])
+            else:
+                parser.error('the trace time must be a positive number')
+
+        if options.trace_buf_size is not None:
+            if options.trace_buf_size > 0:
+                atrace_args.extend(['-b', str(options.trace_buf_size)])
+            else:
+                parser.error('the trace buffer size must be a positive number')
+
+        atrace_args.extend(args)
+
+    if atrace_args[0] == 'sdb':
+        add_sdb_serial(atrace_args, options.device_serial)
+        if options.device_serial:
+            g_device_serial = str(options.device_serial).strip()
+        else:
+            g_device_serial = None
+
+    script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
+
+    if options.link_assets:
+        src_dir = os.path.join(script_dir, options.asset_dir, 'src')
+        build_dir = os.path.join(script_dir, options.asset_dir, 'build')
+
+        js_files, js_flattenizer, css_files, templates = get_assets(src_dir, build_dir)
+
+        css = '\n'.join(linked_css_tag % (os.path.join(src_dir, f)) for f in css_files)
+        js = '<script language="javascript">\n%s</script>\n' % js_flattenizer
+        js += '\n'.join(linked_js_tag % (os.path.join(src_dir, f)) for f in js_files)
+
+    else:
+        css_filename = os.path.join(script_dir, flattened_css_file)
+        js_filename = os.path.join(script_dir, flattened_js_file)
+        css = compiled_css_tag % (open(css_filename).read())
+        js = compiled_js_tag % (open(js_filename).read())
+        templates = ''
+
+    html_filename = options.output_file
+
+    if options.trace_bootup:
+        print "Trace for bootup"
+        atrace_args.extend(['--async_start'])
+        trace_bootup(string.join(atrace_args))
+
+        print "Please pull out the usb cable on target"
+        os.system('sleep ' + '40')
+        print "Please plug the usb cable to target"
+        os.system('sleep ' + '20')
+
+        atrace_args.remove('--async_start')
+        atrace_args.remove('\'echo')
+        atrace_args.extend(['-z', '--async_stop'])
+        expect_trace = True
+    if options.from_text_file:
+        compose_html(script_dir, options, css, js, templates)
+        return
+    elif options.from_file_win:
+        compose_html_win(script_dir, options, css, js, templates)
+        return
+    elif options.from_file:
+        print "From file"
+
+    if options.async_start:
+        atrace_args.extend(['--async_start'])
+    if options.async_dump:
+        atrace_args.extend(['--async_dump'])
+    if options.async_stop:
+        atrace_args.extend(['--async_stop'])
+    if options.append:
+        atrace_args.extend(['--append'])
+    if options.backup:
+        atrace_args.extend(['--backup'])
+        backup_trace = True
+
+    sdb = subprocess.Popen(atrace_args, stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE)
+
+    if options.async_start:
+        return
+
+    result = None
+    data = []
+
+    # Read the text portion of the output and watch for the 'TRACE:' marker that
+    # indicates the start of the trace data.
+    while result is None:
+        ready = select.select([sdb.stdout, sdb.stderr], [], [sdb.stdout, sdb.stderr])
+        if sdb.stderr in ready[0]:
+            err = os.read(sdb.stderr.fileno(), 4096)
+            sys.stderr.write(err)
+            sys.stderr.flush()
+        if sdb.stdout in ready[0]:
+            out = os.read(sdb.stdout.fileno(), 4096)
+            parts = out.split('\nTRACE:', 1)
+
+            txt = parts[0].replace('\r', '')
+            if len(parts) == 2:
+                # The '\nTRACE:' match stole the last newline from the text, so add it
+                # back here.
+                txt += '\n'
+            sys.stdout.write(txt)
+            sys.stdout.flush()
+
+            if len(parts) == 2:
+                data.append(parts[1])
+                sys.stdout.write("downloading trace...")
+                sys.stdout.flush()
+                break
+
+        result = sdb.poll()
+
+    # Read and buffer the data portion of the output.
+    while True:
+        ready = select.select([sdb.stdout, sdb.stderr], [], [sdb.stdout, sdb.stderr])
+        keepReading = False
+        if sdb.stderr in ready[0]:
+            err = os.read(sdb.stderr.fileno(), 4096)
+            if len(err) > 0:
+                keepReading = True
+                sys.stderr.write(err)
+                sys.stderr.flush()
+        if sdb.stdout in ready[0]:
+            out = os.read(sdb.stdout.fileno(), 4096)
+            if len(out) > 0:
+                keepReading = True
+                data.append(out)
+
+        if result is not None and not keepReading:
+            break
+
+        result = sdb.poll()
+
+    if result == 0:
+        if expect_trace:
+            if not data:
+                print >> sys.stderr, ('No data was captured.    Output file was not ' +
+                    'written.')
+                sys.exit(1)
+            else:
+                # Indicate to the user that the data download is complete.
+                print " done\n"
+
+            data = ''.join(data)
+
+            # Collapse CRLFs that are added by sdb shell.
+            if data.startswith('\r\n'):
+                data = data.replace('\r\n', '\n')
+
+            # Skip the initial newline.
+            data = data[1:]
+
+            html_prefix = read_asset(script_dir, 'prefix.html')
+            html_suffix = read_asset(script_dir, 'suffix.html')
+
+            html_file = open(html_filename, 'w')
+            trace_filename = html_filename + '.trace.raw'
+            trace_file = open(trace_filename, 'w')
+            html_file.write(html_prefix % (css, js, templates))
+
+            size = 4096
+            dec = zlib.decompressobj()
+            for chunk in (data[i:i + size] for i in xrange(0, len(data), size)):
+                decoded_chunk = dec.decompress(chunk)
+                html_chunk = decoded_chunk.replace('\n', '\\n\\\n')
+                html_file.write(html_chunk)
+                trace_file.write(html_chunk)
+
+            html_out = dec.flush().replace('\n', '\\n\\\n')
+            html_file.write(html_out)
+
+            # Write suffix
+            html_file.write(html_suffix)
+            html_file.close()
+            trace_file.close()
+            pid_parser.parse(trace_filename)
+            os.remove(trace_filename)
+            print "\nwrote file://%s\n" % os.path.abspath(options.output_file)
+
+    else:  # i.e. result != 0
+        print >> sys.stderr, 'sdb returned error code %d' % result
+        sys.exit(1)
+
+
+def read_asset(src_dir, filename):
+    return open(os.path.join(src_dir, filename)).read()
+
+
+def get_assets(src_dir, build_dir):
+    sys.path.append(build_dir)
+    gen = __import__('generate_standalone_timeline_view', {}, {})
+    parse_deps = __import__('parse_deps', {}, {})
+    gen_templates = __import__('generate_template_contents', {}, {})
+    filenames = gen._get_input_filenames()
+    load_sequence = parse_deps.calc_load_sequence(filenames, src_dir)
+
+    js_files = []
+    js_flattenizer = "window.FLATTENED = {};\n"
+    js_flattenizer += "window.FLATTENED_RAW_SCRIPTS = {};\n"
+    css_files = []
+
+    for module in load_sequence:
+        js_files.append(os.path.relpath(module.filename, src_dir))
+        js_flattenizer += "window.FLATTENED['%s'] = true;\n" % module.name
+        for dependent_raw_script_name in module.dependent_raw_script_names:
+            js_flattenizer += (
+                    "window.FLATTENED_RAW_SCRIPTS['%s'] = true;\n"
+                    % dependent_raw_script_name)
+        for style_sheet in module.style_sheets:
+            css_files.append(os.path.relpath(style_sheet.filename, src_dir))
+
+    templates = gen_templates.generate_templates()
+
+    sys.path.pop()
+
+    return (js_files, js_flattenizer, css_files, templates)
+
+
+compiled_css_tag = """<style type="text/css">%s</style>"""
+compiled_js_tag = """<script language="javascript">%s</script>"""
+
+linked_css_tag = """<link rel="stylesheet" href="%s"></link>"""
+linked_js_tag = """<script language="javascript" src="%s"></script>"""
+
+
+if __name__ == '__main__':
+    main()
diff --git a/tools/ttrace_parser/scripts/ttrace_tinyaraDump.py b/tools/ttrace_parser/scripts/ttrace_tinyaraDump.py
new file mode 100755 (executable)
index 0000000..cc9afc0
--- /dev/null
@@ -0,0 +1,294 @@
+#!/usr/bin/python
+###########################################################################
+#
+# Copyright (c) 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 Samsung Electronics All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+# either express or implied. See the License for the specific
+# language governing permissions and limitations under the License.
+#
+###########################################################################
+
+from operator import itemgetter
+from distutils import util
+import os
+import sys
+import time
+import glob
+import select
+import optparse
+import subprocess
+
+
+def get_os_cmd(cmdARGS):
+    fd_popen = subprocess.Popen(cmdARGS.split(),
+            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    ready = select.select([fd_popen.stdout, fd_popen.stderr],
+            [], [fd_popen.stdout, fd_popen.stderr])
+    if fd_popen.stdout in ready[0]:
+        out = os.read(fd_popen.stdout.fileno(), 4096)
+        return out
+    else:
+        return False
+
+
+class GdbManager:
+    def __init__(self):
+        self.targetName = None
+        self.openocdPath = None
+        self.gdbCommandsPath = None
+        self.binaryPath = None
+        self.addrBegin = None
+        self.addrEnd = None
+        self.addrDump = None
+        self.dumpFile = None
+        self.traceFile = None
+        return None
+
+    def setTargetName(self, name):
+        self.targetName = name
+
+    def setopenocdPath(self, path):
+        self.openocdPath = path
+
+    def setBinaryPath(self, path):
+        self.binaryPath = path
+
+    def setDumpFile(self, name):
+        self.dumpFile = name
+
+    def setTraceFile(self, name):
+        self.traceFile = name
+
+    def checkopenocdPath(self):
+        if self.openocdPath == None:
+            print "You should set openocd path"
+            return False
+        print "openocdPath: " + self.openocdPath
+        return True
+
+    def checkBinaryPath(self):
+        if self.binaryPath == None:
+            print "You should set binary path that contains tinyara,\
+            System.map files"
+            return False
+        print "binaryPath: " + self.binaryPath
+        return True
+
+    def checkRamdump(self):
+        if os.access("ramdump", os.F_OK):
+            print "Ramdump generated"
+            return True
+        print "Failed to generate ramdump"
+        return False
+
+    def connectTarget_artik053(self):
+        if self.checkopenocdPath() == False:
+            return False
+        print("%s -f %s &"
+                % (os.path.join(self.openocdPath, 'linux64/openocd'),
+                os.path.join(self.openocdPath, "artik053.cfg")))
+        print os.system("%s -f %s &"
+                % (os.path.join(self.openocdPath, 'linux64/openocd'),
+                os.path.join(self.openocdPath, "artik053.cfg")))
+        time.sleep(3)
+        print os.system("telnet localhost 4444 &")
+        time.sleep(3)
+        return True
+
+    def connectTarget(self):
+        if (self.targetName == "artik053"):
+            return self.connectTarget_artik053()
+        else:
+            print "Could not found target name: " + self.targetName
+        return False
+
+    def checkELF(self):
+        if os.access("%s/tinyara" % self.binaryPath, os.F_OK):
+            return True
+        print "ELF file(tinyara) doesn't exist"
+        return False
+
+    def checkSystemMap(self):
+        if os.access("%s/System.map" % self.binaryPath, os.F_OK) == False:
+            print "Symbol table file(System.map) doesn't exist"
+            return False
+        return True
+
+    def generateGdbCommands_artik051(self):
+        self.gdbCommandsPath = os.path.join(self.openocdPath, "gdbCommands")
+        gdbCmdFile = open(self.gdbCommandsPath, 'w')
+        gdbCmdFile.write("target remote:3333\n")
+        gdbCmdFile.write("set confirm off\n")
+        gdbCmdFile.write("file %s\n"
+                % (os.path.join(self.binaryPath, "tinyara")))
+        gdbCmdFile.write("break wait_ttrace_dump\n")
+        gdbCmdFile.write("continue\n")
+        gdbCmdFile.write("delete 1\n")
+        gdbCmdFile.write("dump binary memory ramdump %s %s\n"
+                % (self.addrBegin, self.addrEnd))
+        gdbCmdFile.write("quit\n")
+        gdbCmdFile.close()
+        return True
+
+    def generateGdbCommands_artik053(self):
+        self.gdbCommandsPath = os.path.join(self.openocdPath, "gdbCommands")
+        gdbCmdFile = open(self.gdbCommandsPath, 'w')
+        gdbCmdFile.write("target remote:3333\n")
+        gdbCmdFile.write("monitor reset halt\n")
+        gdbCmdFile.write("monitor cortex_r4 maskisr on\n")
+        gdbCmdFile.write("set confirm off\n")
+        gdbCmdFile.write("file %s\n"
+                % (os.path.join(self.binaryPath, "tinyara")))
+        gdbCmdFile.write("break wait_ttrace_dump\n")
+        gdbCmdFile.write("continue\n")
+        gdbCmdFile.write("delete 1\n")
+        gdbCmdFile.write("dump binary memory ramdump %s %s\n"
+                % (self.addrBegin, self.addrEnd))
+        gdbCmdFile.write("quit\n")
+        gdbCmdFile.close()
+        return True
+
+    def generateGdbCommands(self):
+        self.gdbCommandsPath = os.path.join(self.openocdPath, "gdbCommands")
+        if (self.targetName == "artik051"):
+            return self.generateGdbCommands_artik051()
+        elif (self.targetName == "artik053"):
+            return self.generateGdbCommands_artik053()
+        else:
+            print "Could not found target name: " + self.targetName
+        return False
+
+    def runGdbCommands(self):
+        out = os.system("arm-none-eabi-gdb %s --command=%s\n" \
+                % (os.path.join(self.openocdPath, "binary/tinyara"), \
+                    self.gdbCommandsPath))
+        print "-----------------------------------------\n"
+        if self.checkRamdump() == False:
+            return False
+        os.system("mv ramdump %s" % (self.dumpFile))
+        return out
+
+    def setAddrBegin(self):
+        self.addrBegin = self.findAddr(
+                os.path.join(self.binaryPath, "System.map"), "packets")
+        if self.addrBegin == False:
+            return False
+        self.addrBegin = "0x" + self.addrBegin
+        print "addrBegin: " + self.addrBegin
+        return True
+
+    def setAddrEnd(self):
+        self.addrEnd = self.findEndAddr(
+                os.path.join(self.binaryPath, "System.map"), "packets")
+        if self.addrEnd == False:
+            return False
+        self.addrEnd = "0x" + self.addrEnd
+        print "addrEnd: " + self.addrEnd
+        return True
+
+    def setAddrDump(self):
+        self.addrDump = self.findAddr(
+                os.path.join(self.binaryPath, "System.map"),
+                "wait_ttrace_dump")
+        if self.addrDump == False:
+            return False
+        self.addrDump = "0x" + self.addrDump
+        print "addrDump: " + self.addrDump
+        return True
+
+    def findAddr(self, filename, target):
+        with open(filename, "r") as sysmap:
+            for line in sysmap:
+                if line.isspace():
+                    continue
+                if target in line:
+                    return line.strip().split()[0]
+        return False
+
+    def findEndAddr(self, filename, target):
+        flag = False
+        with open(filename, "r") as sysmap:
+            for line in sysmap:
+                if line.isspace():
+                    continue
+                if flag == True:
+                    return line.strip().split()[0]
+                if target in line:
+                    flag = True
+        return False
+
+    def extractDump(self, options):
+        out = subprocess.check_output(["./scripts/parse_dump", self.dumpFile])
+        if options.verbose == True:
+            print out
+        with open(self.traceFile, "w") as dump:
+            dump.write(out)
+        return True
+
+
+def main():
+    usage = "Usage: %prog -t [targetname] -o [filename]"
+    desc = "Example: %prog -t artik053 -o dump.trace"
+    parser = optparse.OptionParser(usage=usage, description=desc)
+    parser.add_option('-t', '--target', dest='targetName',
+            default='artik053',
+            metavar='TARGETNAME',
+            help="Specify target device name, "
+            "[default:%default]")
+    parser.add_option('-o', '--output', dest='dumpFile',
+            default='dump',
+            metavar='FILENAME',
+            help="Specify dumpped file name, "
+            "[default:%default]")
+    parser.add_option('-b', '--binary', dest='binaryPath',
+            default='../../build/output/bin',
+            metavar='PATH',
+            help="Specify tinyara binary path, "
+            "[default:%default]")
+    parser.add_option('-d', '--openocd', dest='openocdPath',
+            default='../../build/configs/artik053/tools/openocd',
+            metavar='PATH',
+            help="Specify openocd path, "
+            "[default:%default]")
+    parser.add_option('-v', '--verbose', dest='verbose',
+            action='store_true',
+            default=False,
+            help="Generate verbose output, "
+            "[default:%default]")
+    options, arg = parser.parse_args()
+    options.curDir = os.path.dirname(os.path.abspath(sys.argv[0]))
+
+    gdbman = GdbManager()
+    gdbman.setTargetName(options.targetName)
+    gdbman.setBinaryPath(options.binaryPath)
+    gdbman.setopenocdPath(options.openocdPath)
+    gdbman.setDumpFile(options.dumpFile)
+
+    traceFile = os.path.splitext(options.dumpFile)[0] + '.trace'
+    gdbman.setTraceFile(traceFile)
+
+    gdbman.checkELF()
+    gdbman.checkSystemMap()
+
+    gdbman.setAddrBegin()
+    gdbman.setAddrEnd()
+    gdbman.setAddrDump()
+
+    gdbman.generateGdbCommands()
+    gdbman.connectTarget()
+    time.sleep(3)
+    gdbman.runGdbCommands()
+    gdbman.extractDump(options)
+
+if __name__ == '__main__':
+    main()
diff --git a/tools/ttrace_parser/ttrace_tinyara.py b/tools/ttrace_parser/ttrace_tinyara.py
new file mode 100755 (executable)
index 0000000..34f012b
--- /dev/null
@@ -0,0 +1,236 @@
+#!/usr/bin/python
+###########################################################################
+#
+# Copyright (c) 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 Samsung Electronics All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+# either express or implied. See the License for the specific
+# language governing permissions and limitations under the License.
+#
+###########################################################################
+
+from operator import itemgetter
+import os
+import sys
+import time
+import glob
+import optparse
+
+cycleIdDict = dict()
+workIdDict = dict()
+beginDict = dict()
+endDict = dict()
+cycleGap = 0
+temporalId = 1000
+parserDirPath = "scripts"
+
+ftraceLogs = []
+
+
+class TraceItem:
+    def __init__(self):
+        self.taskname = "null"
+        self.pid = "0"
+        self.tgid = "0"
+        self.core = "[000]"
+        self.flags = "...1"
+        self.timestamp = "0"
+        self.function_type = "null"
+        self.pair_type = "B"
+        self.message = "0"
+
+    def extractTime(self, line):
+        self.timestamp = line.strip('[]').replace(':', '.')
+        return self.timestamp
+
+    def extractPid(self, line):
+        self.pid = line.strip(':')
+        return self.pid
+
+    def extractPairType(self, line):
+        self.pair_type = line.split('|')[0].upper()
+        return self.pair_type
+
+    def extractMsg(self, line):
+        self.message = (line.split('|'))[1]
+        return self.message
+
+    def composeSchedLine(self):
+        self.function_type = "sched_switch"
+        line = "%s-%s %s %s %s: %s: %s" % (
+                self.taskname, self.pid, self.core, self.flags, self.timestamp,
+                self.function_type, self.message)
+        return line
+
+    def composeNormalLine(self):
+        self.function_type = "tracing_mark_write"
+        line = "%s-%s %s %s %s: %s: %s|%s|%s" % (self.taskname, self.pid,
+                self.core, self.flags, self.timestamp,
+                self.function_type, self.pair_type, self.pid, self.message)
+        return line
+
+    def composeLine(self):
+        if self.pair_type == 'S':
+            line = self.composeSchedLine()
+        else:
+            line = self.composeNormalLine()
+        return line
+
+    def addLineToFtraceLogs(self, line):
+        ftraceLogs.append(line)
+        return
+
+
+def writeFtraceLogs(options):
+    with open(options.outputFile, "wb") as output:
+        for line in ftraceLogs:
+            if (options.verbose == True):
+                print line
+            output.write(line + "\n")
+    return True
+
+
+def translateTinyaraLogs(options):
+    item = TraceItem()
+    filename = os.path.join(options.inputFile)
+    with open(filename, "r") as rawLogs:
+        for line in rawLogs:
+            if (line.isspace()):
+                continue
+            lineList = line.strip().split(None, 2)
+            time = item.extractTime(lineList[0])
+            pid = item.extractPid(lineList[1])
+            pair_type = item.extractPairType(lineList[2])
+            msg = item.extractMsg(lineList[2])
+            translatedLine = item.composeLine()
+            if (options.verbose == True):
+                print translatedLine
+            item.addLineToFtraceLogs(translatedLine)
+    return True
+
+
+def get_os_cmd(cmdARGS):
+        fd_popen = subprocess.Popen(cmdARGS.split(),
+                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        ready = select.select([fd_popen.stdout, fd_popen.stderr],
+                [], [fd_popen.stdout, fd_popen.stderr])
+        if fd_popen.stdout in ready[0]:
+                out = os.read(fd_popen.stdout.fileno(), 4096)
+                return out
+        else:
+                return False
+
+
+def makeHtml(options):
+    htmlfile = options.outputFile.replace(options.outputExt, '.html')
+    if os.name == 'nt':
+        os.system("%s/ttrace.py --from-text-file=%s -o %s\n"
+                % (parserDirPath, options.outputFile, htmlfile))
+    else:
+        os.system("./%s/ttrace.py --from-text-file=%s -o %s\n"
+                % (parserDirPath, options.outputFile, htmlfile))
+    return True
+
+
+def findAddr(filename, target):
+    with open(filename, "r") as sysmap:
+        for line in sysmap:
+            if line.isspace():
+                continue
+            if target in line:
+                return line.strip().split()[0]
+    return False
+
+
+def main():
+        usage = "Usage: %prog [options]"
+        desc = "Example: %prog -i logs.txt -o ttrace_dump"
+        parser = optparse.OptionParser(usage=usage, description=desc)
+        parser.add_option('-i', '--input', dest='inputFile',
+                default=None,
+                metavar='FILENAME',
+                help="Parsed text file only, Not support dumpped file, "
+                "[default:%default]")
+        parser.add_option('-d', '--dump', dest='dump',
+                default=None,
+                metavar='MODELNAME',
+                help="Dump trace buffer and generate html report, "
+                "[default:%default]")
+        parser.add_option('-o', '--output', dest='outputFile',
+                default=None,
+                metavar='FILENAME',
+                help="Output file that html report saved, "
+                "[default:%default]")
+        parser.add_option('-v', '--verbose', dest='verbose',
+                action="store_true",
+                default=False,
+                help="Generate verbose output, "
+                "[default:%default]")
+
+        options, arg = parser.parse_args()
+        options.curDir = os.path.dirname(os.path.abspath(sys.argv[0]))
+
+        if (options.inputFile == None and options.dump == None):
+            print "Please specify reading from file or dump"
+            exit()
+
+        if (options.inputFile != None and options.dump != None):
+            print "Please choose just one option for reading logs"
+            exit()
+
+        if (options.dump != None):
+            if (options.dump != "artik051" and options.dump != "artik053"):
+                print "%s is not supported" % (options.dump)
+                print "T-trace dump supports artik051, artik053"
+                exit()
+            os.system("./%s/ttrace_tinyaraDump.py -t %s -o %s\n" \
+                    % (parserDirPath, options.dump, "dump.bin"))
+            options.inputFile = "%s/dump.trace" % (options.curDir)
+
+        if (options.inputFile != None):
+            # Check inputFile existance,
+            if not os.access(options.inputFile, os.F_OK | os.R_OK):
+                print "ERROR: " + "Can not read " + options.inputFile
+                return
+            print "Input file: " + options.inputFile
+
+            options.inputFolder = os.path.split(options.inputFile)[0]
+            options.inputFilenameExt = os.path.split(options.inputFile)[1]
+            options.inputFileName = \
+            os.path.splitext(options.inputFilenameExt)[0]
+
+        if (options.outputFile != None):
+            options.outputFolder = os.path.split(options.outputFile)[0]
+            options.outputFileName = os.path.split(options.outputFile)[1]
+            if not os.access(options.outputFolder, os.F_OK | os.W_OK):
+                os.mkdir(options.outputFolder)
+        else:
+            if (options.inputFile != None):
+                options.outputFolder = options.inputFolder
+                options.outputFileName = options.inputFileName
+            else:
+                options.outputFolder = options.curDir
+                options.outputFileName = "report"
+        options.outputExt = ".ftrace"
+        options.outputFilenameExt = options.outputFileName + options.outputExt
+        options.outputFile = \
+        os.path.join(options.outputFolder, options.outputFilenameExt)
+
+        print "output file will be saved at %s" % (options.outputFile)
+
+        translateTinyaraLogs(options)
+        writeFtraceLogs(options)
+        makeHtml(options)
+
+
+if __name__ == '__main__':
+        main()