initial commit

This commit is contained in:
Ajin Abraham
2015-02-10 19:20:35 +05:30
parent 928fcab929
commit 89af6dedee
1624 changed files with 853268 additions and 0 deletions
View File
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.
Binary file not shown.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
from django.db import models
# Create your models here.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.
Binary file not shown.
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -0,0 +1,12 @@
# Names should be added to this file with this pattern:
#
# For individuals:
# Name <email address>
#
# For organizations:
# Organization <fnmatch pattern>
#
# See python fnmatch module documentation for more information.
The Chromium Authors <*@chromium.org>
Google Inc. <*@google.com>
@@ -0,0 +1,27 @@
// Copyright (c) 2010 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.
+205
View File
@@ -0,0 +1,205 @@
// Copyright (c) 2012 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.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
@@ -0,0 +1 @@
775
@@ -0,0 +1,38 @@
<!DOCTYPE HTML>
<html>
<head i18n-values="dir:textdirection;">
<meta charset="utf-8"/>
<title>Android 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 = "\
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
\n";
</script>
<!-- END TRACE -->
</body>
</html>
@@ -0,0 +1,251 @@
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""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 errno, optparse, os, select, subprocess, sys, time, zlib
# This list is based on the tags in frameworks/native/include/utils/Trace.h.
trace_tag_bits = {
'gfx': 1<<1,
'input': 1<<2,
'view': 1<<3,
'webview': 1<<4,
'wm': 1<<5,
'am': 1<<6,
'sync': 1<<7,
'audio': 1<<8,
'video': 1<<9,
'camera': 1<<10,
}
flattened_css_file = 'style.css'
flattened_js_file = 'script.js'
def add_adb_serial(command, serial):
if serial != None:
command.insert(1, serial)
command.insert(1, '-s')
def main():
parser = optparse.OptionParser()
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('-d', '--disk', dest='trace_disk', default=False,
action='store_true', help='trace disk I/O (requires root)')
parser.add_option('-f', '--cpu-freq', dest='trace_cpu_freq', default=False,
action='store_true', help='trace CPU frequency changes')
parser.add_option('-i', '--cpu-idle', dest='trace_cpu_idle', default=False,
action='store_true', help='trace CPU idle events')
parser.add_option('-l', '--cpu-load', dest='trace_cpu_load', default=False,
action='store_true', help='trace CPU load')
parser.add_option('-s', '--no-cpu-sched', dest='trace_cpu_sched', default=True,
action='store_false', help='inhibit tracing CPU ' +
'scheduler (allows longer trace times by reducing data ' +
'rate into buffer)')
parser.add_option('-u', '--bus-utilization', dest='trace_bus_utilization',
default=False, action='store_true',
help='trace bus utilization (requires root)')
parser.add_option('-w', '--workqueue', dest='trace_workqueue', default=False,
action='store_true', help='trace the kernel workqueues ' +
'(requires root)')
parser.add_option('--set-tags', dest='set_tags', action='store',
help='set the enabled trace tags and exit; set to a ' +
'comma separated list of: ' +
', '.join(trace_tag_bits.iterkeys()))
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 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='adb device serial number')
options, args = parser.parse_args()
if options.set_tags:
flags = 0
tags = options.set_tags.split(',')
for tag in tags:
try:
flags |= trace_tag_bits[tag]
except KeyError:
parser.error('unrecognized tag: %s\nknown tags are: %s' %
(tag, ', '.join(trace_tag_bits.iterkeys())))
atrace_args = ['adb', 'shell', 'setprop', 'debug.atrace.tags.enableflags', hex(flags)]
add_adb_serial(atrace_args, options.device_serial)
try:
subprocess.check_call(atrace_args)
except subprocess.CalledProcessError, e:
print >> sys.stderr, 'unable to set tags: %s' % e
print '\nSet enabled tags to: %s\n' % ', '.join(tags)
print ('You will likely need to restart the Android framework for this to ' +
'take effect:\n\n adb shell stop\n adb shell ' +
'start\n')
return
atrace_args = ['adb', 'shell', 'atrace', '-z']
add_adb_serial(atrace_args, options.device_serial)
if options.trace_disk:
atrace_args.append('-d')
if options.trace_cpu_freq:
atrace_args.append('-f')
if options.trace_cpu_idle:
atrace_args.append('-i')
if options.trace_cpu_load:
atrace_args.append('-l')
if options.trace_cpu_sched:
atrace_args.append('-s')
if options.trace_bus_utilization:
atrace_args.append('-u')
if options.trace_workqueue:
atrace_args.append('-w')
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')
if options.from_file is not None:
atrace_args = ['cat', options.from_file]
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
trace_started = False
leftovers = ''
adb = subprocess.Popen(atrace_args, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
dec = zlib.decompressobj()
while True:
ready = select.select([adb.stdout, adb.stderr], [], [adb.stdout, adb.stderr])
if adb.stderr in ready[0]:
err = os.read(adb.stderr.fileno(), 4096)
sys.stderr.write(err)
sys.stderr.flush()
if adb.stdout in ready[0]:
out = leftovers + os.read(adb.stdout.fileno(), 4096)
if options.from_file is None:
out = out.replace('\r\n', '\n')
if out.endswith('\r'):
out = out[:-1]
leftovers = '\r'
else:
leftovers = ''
if not trace_started:
lines = out.splitlines(True)
out = ''
for i, line in enumerate(lines):
if line == 'TRACE:\n':
sys.stdout.write("downloading trace...")
sys.stdout.flush()
out = ''.join(lines[i+1:])
html_prefix = read_asset(script_dir, 'prefix.html')
html_file = open(html_filename, 'w')
html_file.write(html_prefix % (css, js, templates))
trace_started = True
break
elif 'TRACE:'.startswith(line) and i == len(lines) - 1:
leftovers = line + leftovers
else:
sys.stdout.write(line)
sys.stdout.flush()
if len(out) > 0:
out = dec.decompress(out)
html_out = out.replace('\n', '\\n\\\n')
if len(html_out) > 0:
html_file.write(html_out)
result = adb.poll()
if result is not None:
break
if result != 0:
print >> sys.stderr, 'adb returned error code %d' % result
elif trace_started:
html_out = dec.flush().replace('\n', '\\n\\\n').replace('\r', '')
if len(html_out) > 0:
html_file.write(html_out)
html_suffix = read_asset(script_dir, 'suffix.html')
html_file.write(html_suffix)
html_file.close()
print " done\n\n wrote file://%s\n" % (os.path.abspath(options.output_file))
else:
print >> sys.stderr, ('An error occured while capturing the trace. Output ' +
'file was not written.')
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()
@@ -0,0 +1,313 @@
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""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 errno, optparse, os, re, select, subprocess, sys, time, zlib
flattened_css_file = 'style.css'
flattened_js_file = 'script.js'
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 get_device_sdk_version():
getprop_args = ['adb', 'shell', 'getprop', 'ro.build.version.sdk']
parser = OptionParserIgnoreErrors()
parser.add_option('-e', '--serial', dest='device_serial', type='string')
options, args = parser.parse_args()
if options.device_serial is not None:
getprop_args[1:1] = ['-s', options.device_serial]
adb = subprocess.Popen(getprop_args, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = adb.communicate()
if adb.returncode != 0:
print >> sys.stderr, 'Error querying device SDK-version:'
print >> sys.stderr, err
sys.exit(1)
version = int(out)
return version
def add_adb_serial(command, serial):
if serial is not None:
command.insert(1, serial)
command.insert(1, '-s')
def main():
device_sdk_version = get_device_sdk_version()
if device_sdk_version < 18:
legacy_script = os.path.join(os.path.dirname(sys.argv[0]), 'systrace-legacy.py')
os.execv(legacy_script, sys.argv)
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('-k', '--ktrace', dest='kfuncs', action='store',
help='specify a comma-separated list of kernel functions to trace')
parser.add_option('-l', '--list-categories', dest='list_categories', default=False,
action='store_true', help='list the available categories and exit')
parser.add_option('-a', '--app', dest='app_name', default=None, type='string',
action='store', help='enable application-level tracing for comma-separated ' +
'list of app cmdlines')
parser.add_option('--no-fix-threads', dest='fix_threads', default=True,
action='store_false', help='don\'t fix missing or truncated thread names')
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('--asset-dir', dest='asset_dir', default='trace-viewer',
type='string', help='')
parser.add_option('-e', '--serial', dest='device_serial', type='string',
help='adb device serial number')
options, args = parser.parse_args()
if options.list_categories:
atrace_args = ['adb', 'shell', 'atrace', '--list_categories']
expect_trace = False
elif options.from_file is not None:
atrace_args = ['cat', options.from_file]
expect_trace = True
else:
atrace_args = ['adb', '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')
if options.app_name is not None:
atrace_args.extend(['-a', options.app_name])
if options.kfuncs is not None:
atrace_args.extend(['-k', options.kfuncs])
atrace_args.extend(args)
if options.fix_threads:
atrace_args.extend([';', 'ps', '-t'])
if atrace_args[0] == 'adb':
add_adb_serial(atrace_args, options.device_serial)
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
adb = subprocess.Popen(atrace_args, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
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([adb.stdout, adb.stderr], [], [adb.stdout, adb.stderr])
if adb.stderr in ready[0]:
err = os.read(adb.stderr.fileno(), 4096)
sys.stderr.write(err)
sys.stderr.flush()
if adb.stdout in ready[0]:
out = os.read(adb.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 = adb.poll()
# Read and buffer the data portion of the output.
while True:
ready = select.select([adb.stdout, adb.stderr], [], [adb.stdout, adb.stderr])
keepReading = False
if adb.stderr in ready[0]:
err = os.read(adb.stderr.fileno(), 4096)
if len(err) > 0:
keepReading = True
sys.stderr.write(err)
sys.stderr.flush()
if adb.stdout in ready[0]:
out = os.read(adb.stdout.fileno(), 4096)
if len(out) > 0:
keepReading = True
data.append(out)
if result is not None and not keepReading:
break
result = adb.poll()
if result == 0:
if expect_trace:
data = ''.join(data)
# Collapse CRLFs that are added by adb shell.
if data.startswith('\r\n'):
data = data.replace('\r\n', '\n')
# Skip the initial newline.
data = data[1:]
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"
# Extract the thread list dumped by ps.
threads = {}
if options.fix_threads:
parts = data.split('USER PID PPID VSIZE RSS WCHAN PC NAME', 1)
if len(parts) == 2:
data = parts[0]
for line in parts[1].splitlines():
cols = line.split(None, 8)
if len(cols) == 9:
tid = int(cols[1])
name = cols[8]
threads[tid] = name
# Decompress and preprocess the data.
out = zlib.decompress(data)
if options.fix_threads:
def repl(m):
tid = int(m.group(2))
if tid > 0:
name = threads.get(tid)
if name is None:
name = m.group(1)
if name == '<...>':
name = '<' + str(tid) + '>'
threads[tid] = name
return name + '-' + m.group(2)
else:
return m.group(0)
out = re.sub(r'^\s*(\S+)-(\d+)', repl, out, flags=re.MULTILINE)
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))
html_out = out.replace('\n', '\\n\\\n')
html_file.write(html_out)
html_file.write(html_suffix)
html_file.close()
print "\n wrote file://%s\n" % os.path.abspath(options.output_file)
else: # i.e. result != 0
print >> sys.stderr, 'adb 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()
Binary file not shown.
Binary file not shown.
+18
View File
@@ -0,0 +1,18 @@
Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 11, Received = 11, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Binary file not shown.
@@ -0,0 +1,7 @@
ping -n 11 127.0.0.1 > NULL
adb.exe shell screencap -p /system/screen.png
adb.exe shell am startservice com.appxpose.app/.AppXposeService
adb.exe pull /system/screen.png "C:\\Xenotix ASDA\\APK Analyzer\\App_Data\\tools\\monkeyrunner\\Results\\screenshot51299266ECBC1B26D8CED685BB1FEA2E0D1478.png"
adb.exe logcat -d dalvikvm:W ActivityManager:I > Results\logcat51299266ECBC1B26D8CED685BB1FEA2E0D1478.txt
adb.exe shell dumpsys > Results\dump51299266ECBC1B26D8CED685BB1FEA2E0D1478.txt
adb shell am force-stop com.earn.rewards.rewardometer
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,9 @@
cd C:\\Xenotix ASDA\\APK Analyzer\\App_Data\\tools\\monkeyrunner
adb.exe kill-server
adb.exe start-server
ping -n 3 127.0.0.1 > NULL
adb.exe connect 10.118.7.26
adb.exe wait-for-device
adb.exe shell mount -o rw,remount -t rfs /dev/block/sda6 /system
adb.exe install "C:\\Xenotix ASDA\\APK Analyzer\\App_Data\\uploads\\51299266ECBC1B26D8CED685BB1FEA2E0D1478.apk"
adb.exe shell am start -n com.earn.rewards.rewardometer/com.earn.rewards.rewardometer.SplashScreen
Binary file not shown.
@@ -0,0 +1,131 @@
;;;; Copyright 2007 The Android Open Source Project
;;; Set up GUD+JDB to attach to a Java process running on the phone or
;;; under the emulator.
(defvar android-jdb-port-history '("8700")
"history of ports supplied to `android-jdb'")
(defvar android-jdb-project-root-history '()
"history of project roots supplied to `android-jdb'")
(defvar android-jdb-history nil
"history of commands supplied to `android-jdb'")
(defvar android-jdb-activity-class-history ()
"history of activity classes supplied to `start-android-activity'")
(defcustom android-jdb-command-name "jdb"
"Name of Java debugger."
:type 'string
:group 'android)
(defgroup android nil
"Android Applications."
:group 'applications)
(defcustom android-project-root nil
"This is where your Android project root is stored."
:type 'directory
:group 'android )
(defcustom android-apk nil
"This is where your Android Application Package is stored."
:type 'string
:group 'android)
(defcustom android-activity-class nil
"This is where your Android Activity class is stored."
:type 'string
:group 'android)
(defun android-read-project-root ()
(if (or (string-match "XEmacs" emacs-version)
(>= emacs-major-version 22))
(read-file-name "Android project root: "
android-project-root
nil
t
nil
'file-directory-p)
(labels ((read-directory ()
(read-file-name "Android project root: "
android-project-root
nil
t
nil)))
(do ((entered-root (read-directory) (read-directory)))
((and entered-root
(file-directory-p entered-root))
(expand-file-name entered-root))))))
(defun android-jdb (port root)
"Set GUD+JDB up to run against Android on PORT in directory ROOT."
(interactive
(list
(read-from-minibuffer "Activity's JDWP DDMS port: "
(car android-jdb-port-history)
nil
t
'android-jdb-port-history)
(android-read-project-root)))
(setq android-project-root root)
(let ((jdb-command
(format "%s -attach localhost:%s -sourcepath%s"
android-jdb-command-name
port
(format "%s/src" root))))
(if (not (string= jdb-command (car android-jdb-history)))
(push jdb-command android-jdb-history))
(jdb jdb-command)))
(defun android-emulate ()
"Run the Android emulator. This expects the SDK tools directory to be in the current path."
(interactive)
(compile "emulator"))
(defun android-install-app (apk)
"Install an Android application package APK in the Android emulator. This expects the SDK tools directory to be in the current path."
(interactive (list (expand-file-name
(read-file-name "Android Application Package (.apk): "
nil
android-apk
t
nil
nil))))
(setq android-apk apk)
(compile (format "adb install -r %s" apk)))
(defun android-uninstall-app (package-name)
"Uninstall an Android application package APK in the Android emulator. This expects the SDK tools directory to be in the current path.
Specify the package name --- and not the name of the application e.g., com.android.foo."
(interactive
(list
(read-from-minibuffer "Package: ")))
(compile (format "adb uninstall %s" package-name)))
(defun android-start-activity (package class)
"Start the activity PACKAGE/CLASS in the Android emulator. This expects the SDK tools directory to be in the current path."
(interactive
(list
(read-from-minibuffer "Package: ")
(read-from-minibuffer "Activity Java class: "
(car android-jdb-activity-class-history)
nil
t
'android-jdb-activity-class-history)))
(compile (format "adb shell am start -n %s/%s" package class)))
(defun android-debug-activity (package class)
"Start the activity PACKAGE/CLASS within the debugger in the Android emulator. This expects the SDK tools directory to be in the current path."
(interactive
(list
(read-from-minibuffer "Package: ")
(read-from-minibuffer "Activity Java class: "
(car android-jdb-activity-class-history)
nil
t
'android-jdb-activity-class-history)))
(compile (format "adb shell am start -D -n %s/%s" package class)))
(provide 'android)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,595 @@
<?xml version="1.0" encoding="UTF-8"?>
<d:devices xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:d="http://schemas.android.com/sdk/devices/1">
<d:device>
<d:name>Nexus One</d:name>
<d:manufacturer>Google</d:manufacturer>
<d:hardware>
<d:screen>
<d:screen-size>normal</d:screen-size>
<d:diagonal-length>3.7</d:diagonal-length>
<d:pixel-density>hdpi</d:pixel-density>
<d:screen-ratio>long</d:screen-ratio>
<d:dimensions>
<d:x-dimension>480</d:x-dimension>
<d:y-dimension>800</d:y-dimension>
</d:dimensions>
<d:xdpi>254</d:xdpi>
<d:ydpi>254</d:ydpi>
<d:touch>
<d:multitouch>basic</d:multitouch>
<d:mechanism>finger</d:mechanism>
<d:screen-type>capacitive</d:screen-type>
</d:touch>
</d:screen>
<d:networking>
Wifi
Bluetooth
</d:networking>
<d:sensors>
Accelerometer
Compass
GPS
LightSensor
ProximitySensor
</d:sensors>
<d:mic>true</d:mic>
<d:camera>
<d:location>back</d:location>
<d:autofocus>true</d:autofocus>
<d:flash>true</d:flash>
</d:camera>
<d:keyboard>nokeys</d:keyboard>
<d:nav>trackball</d:nav>
<d:ram unit="MiB">512</d:ram>
<d:buttons>hard</d:buttons>
<d:internal-storage unit="MiB">503</d:internal-storage>
<d:removable-storage unit="MiB">0</d:removable-storage>
<d:cpu>Qualcomm Scorpion</d:cpu>
<d:gpu>Qualcomm Adreno 200</d:gpu>
<d:abi>
armeabi-v7a
armeabi
</d:abi>
<d:dock> </d:dock>
<d:power-type>plugged-in</d:power-type>
</d:hardware>
<d:software>
<d:api-level>7-10</d:api-level>
<d:live-wallpaper-support>true</d:live-wallpaper-support>
<d:bluetooth-profiles> </d:bluetooth-profiles>
<d:gl-version>2.0</d:gl-version>
<d:gl-extensions>
</d:gl-extensions>
<d:status-bar>true</d:status-bar>
</d:software>
<d:state name="Portrait" default="true">
<d:description>The phone in portrait view</d:description>
<d:screen-orientation>port</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
<d:state name="Landscape">
<d:description>The phone in landscape view</d:description>
<d:screen-orientation>land</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
</d:device>
<d:device>
<d:name>Nexus S</d:name>
<d:manufacturer>Google</d:manufacturer>
<d:hardware>
<d:screen>
<d:screen-size>normal</d:screen-size>
<d:diagonal-length>4</d:diagonal-length>
<d:pixel-density>hdpi</d:pixel-density>
<d:screen-ratio>long</d:screen-ratio>
<d:dimensions>
<d:x-dimension>480</d:x-dimension>
<d:y-dimension>800</d:y-dimension>
</d:dimensions>
<d:xdpi>235</d:xdpi>
<d:ydpi>235</d:ydpi>
<d:touch>
<d:multitouch>jazz-hands</d:multitouch>
<d:mechanism>finger</d:mechanism>
<d:screen-type>capacitive</d:screen-type>
</d:touch>
</d:screen>
<d:networking>
Wifi
Bluetooth
NFC
</d:networking>
<d:sensors>
Accelerometer
Compass
GPS
Gyroscope
LightSensor
ProximitySensor
</d:sensors>
<d:mic>true</d:mic>
<d:camera>
<d:location>back</d:location>
<d:autofocus>true</d:autofocus>
<d:flash>true</d:flash>
</d:camera>
<d:camera>
<d:location>front</d:location>
<d:autofocus>false</d:autofocus>
<d:flash>false</d:flash>
</d:camera>
<d:keyboard>nokeys</d:keyboard>
<d:nav>nonav</d:nav>
<d:ram unit="KiB">351428</d:ram>
<d:buttons>hard</d:buttons>
<d:internal-storage unit="MiB">503</d:internal-storage>
<d:removable-storage unit="MiB">0</d:removable-storage>
<d:cpu>Samsung Exynos 3110</d:cpu>
<d:gpu>PowerVR SGX 540</d:gpu>
<d:abi>
armeabi-v7a
armeabi
</d:abi>
<d:dock> </d:dock>
<d:power-type>plugged-in</d:power-type>
</d:hardware>
<d:software>
<d:api-level>9-16</d:api-level>
<d:live-wallpaper-support>true</d:live-wallpaper-support>
<d:bluetooth-profiles> </d:bluetooth-profiles>
<d:gl-version>2.0</d:gl-version>
<d:gl-extensions>
GL_EXT_debug_marker
GL_OES_rgb8_rgba8
GL_OES_depth24
GL_OES_vertex_half_float
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_element_index_uint
GL_OES_mapbuffer
GL_OES_fragment_precision_high
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_required_internalformat
GL_OES_depth_texture
GL_OES_get_program_binary
GL_OES_packed_depth_stencil
GL_OES_standard_derivatives
GL_OES_vertex_array_object
GL_OES_egl_sync
GL_EXT_multi_draw_arrays
GL_EXT_texture_format_BGRA8888
GL_EXT_discard_framebuffer
GL_EXT_shader_texture_lod
GL_IMG_shader_binary
GL_IMG_texture_compression_pvrtc
GL_IMG_texture_npot
GL_IMG_texture_format_BGRA8888
GL_IMG_read_format
GL_IMG_program_binary
GL_IMG_multisampled_render_to_texture
</d:gl-extensions>
<d:status-bar>true</d:status-bar>
</d:software>
<d:state name="Portrait" default="true">
<d:description>The phone in portrait view</d:description>
<d:screen-orientation>port</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
<d:state name="Landscape">
<d:description>The phone in landscape view</d:description>
<d:screen-orientation>land</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
</d:device>
<d:device>
<d:name>Galaxy Nexus</d:name>
<d:manufacturer>Google</d:manufacturer>
<d:hardware>
<d:screen>
<d:screen-size>normal</d:screen-size>
<d:diagonal-length>4.65</d:diagonal-length> <!-- In inches -->
<d:pixel-density>xhdpi</d:pixel-density>
<d:screen-ratio>long</d:screen-ratio>
<d:dimensions>
<d:x-dimension>720</d:x-dimension>
<d:y-dimension>1280</d:y-dimension>
</d:dimensions>
<d:xdpi>316</d:xdpi>
<d:ydpi>316</d:ydpi>
<d:touch>
<d:multitouch>jazz-hands</d:multitouch>
<d:mechanism>finger</d:mechanism>
<d:screen-type>capacitive</d:screen-type>
</d:touch>
</d:screen>
<d:networking>
Bluetooth
Wifi
NFC
</d:networking>
<d:sensors>
Accelerometer
Barometer
Gyroscope
Compass
GPS
ProximitySensor
</d:sensors>
<d:mic>true</d:mic>
<d:camera>
<d:location>front</d:location>
<d:autofocus>true</d:autofocus>
<d:flash>false</d:flash>
</d:camera>
<d:camera>
<d:location>back</d:location>
<d:autofocus>true</d:autofocus>
<d:flash>true</d:flash>
</d:camera>
<d:keyboard>nokeys</d:keyboard>
<d:nav>nonav</d:nav>
<d:ram unit="GiB">1</d:ram>
<d:buttons>soft</d:buttons>
<d:internal-storage unit="GiB">16</d:internal-storage>
<d:removable-storage unit="KiB"></d:removable-storage>
<d:cpu>OMAP 4460</d:cpu> <!-- cpu type (Tegra3) freeform -->
<d:gpu>PowerVR SGX540</d:gpu>
<d:abi>
armeabi
armeabi-v7a
</d:abi>
<!--dock (car, desk, tv, none)-->
<d:dock>
</d:dock>
<!-- plugged in (never, charge, always) -->
<d:power-type>battery</d:power-type>
</d:hardware>
<d:software>
<d:api-level>14-</d:api-level>
<d:live-wallpaper-support>true</d:live-wallpaper-support>
<d:bluetooth-profiles>
HSP
HFP
SPP
A2DP
AVRCP
OPP
PBAP
GAVDP
AVDTP
HID
HDP
PAN
</d:bluetooth-profiles>
<d:gl-version>2.0</d:gl-version>
<!--
These can be gotten via
javax.microedition.khronos.opengles.GL10.glGetString(GL10.GL_EXTENSIONS);
-->
<d:gl-extensions>
GL_EXT_discard_framebuffer
GL_EXT_multi_draw_arrays
GL_EXT_shader_texture_lod
GL_EXT_texture_format_BGRA8888
GL_IMG_multisampled_render_to_texture
GL_IMG_program_binary
GL_IMG_read_format
GL_IMG_shader_binary
GL_IMG_texture_compression_pvrtc
GL_IMG_texture_format_BGRA8888
GL_IMG_texture_npot
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_depth_texture
GL_OES_depth24
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_egl_sync
GL_OES_element_index_uint
GL_OES_fragment_precision_high
GL_OES_get_program_binary
GL_OES_mapbuffer
GL_OES_packed_depth_stencil
GL_OES_required_internalformat
GL_OES_rgb8_rgba8
GL_OES_standard_derivatives
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_vertex_array_object
GL_OES_vertex_half_float
</d:gl-extensions>
<d:status-bar>true</d:status-bar>
</d:software>
<d:state name="Portrait" default="true">
<d:description>The phone in portrait view</d:description>
<d:screen-orientation>port</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
<d:state name="Landscape">
<d:description>The phone in landscape view</d:description>
<d:screen-orientation>land</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
</d:device>
<d:device>
<d:name>Nexus 7</d:name>
<d:manufacturer>Google</d:manufacturer>
<d:hardware>
<d:screen>
<d:screen-size>large</d:screen-size>
<d:diagonal-length>7.27</d:diagonal-length>
<d:pixel-density>tvdpi</d:pixel-density>
<d:screen-ratio>notlong</d:screen-ratio>
<d:dimensions>
<d:x-dimension>800</d:x-dimension>
<d:y-dimension>1280</d:y-dimension>
</d:dimensions>
<d:xdpi>195</d:xdpi>
<d:ydpi>200</d:ydpi>
<d:touch>
<d:multitouch>jazz-hands</d:multitouch>
<d:mechanism>finger</d:mechanism>
<d:screen-type>capacitive</d:screen-type>
</d:touch>
</d:screen>
<d:networking>
Wifi
Bluetooth
NFC
</d:networking>
<d:sensors>
Accelerometer
Compass
GPS
Gyroscope
LightSensor
</d:sensors>
<d:mic>true</d:mic>
<d:camera>
<d:location>front</d:location>
<d:autofocus>false</d:autofocus>
<d:flash>false</d:flash>
</d:camera>
<d:keyboard>nokeys</d:keyboard>
<d:nav>nonav</d:nav>
<d:ram unit="GiB">1</d:ram>
<d:buttons>soft</d:buttons>
<d:internal-storage unit="GiB">8</d:internal-storage>
<d:removable-storage unit="MiB"> </d:removable-storage>
<d:cpu> Tegra3 </d:cpu>
<d:gpu> Tegra3 </d:gpu>
<d:abi>
armeabi-v7a
armeabi
</d:abi>
<d:dock> </d:dock>
<d:power-type>battery</d:power-type>
</d:hardware>
<d:software>
<d:api-level>16</d:api-level>
<d:live-wallpaper-support>true</d:live-wallpaper-support>
<d:bluetooth-profiles> </d:bluetooth-profiles>
<d:gl-version>2.0</d:gl-version>
<d:gl-extensions> </d:gl-extensions>
<d:status-bar>true</d:status-bar>
</d:software>
<d:state name="Portrait" default="true">
<d:description>The phone in portrait view</d:description>
<d:screen-orientation>port</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
<d:state name="Landscape">
<d:description>The phone in landscape view</d:description>
<d:screen-orientation>land</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
</d:device>
<d:device>
<d:name>Nexus 4</d:name>
<d:manufacturer>Google</d:manufacturer>
<d:hardware>
<d:screen>
<d:screen-size>normal</d:screen-size>
<d:diagonal-length>4.7</d:diagonal-length>
<d:pixel-density>xhdpi</d:pixel-density>
<d:screen-ratio>notlong</d:screen-ratio>
<d:dimensions>
<d:x-dimension>768</d:x-dimension>
<d:y-dimension>1280</d:y-dimension>
</d:dimensions>
<d:xdpi>320</d:xdpi>
<d:ydpi>320</d:ydpi>
<d:touch>
<d:multitouch>jazz-hands</d:multitouch>
<d:mechanism>finger</d:mechanism>
<d:screen-type>capacitive</d:screen-type>
</d:touch>
</d:screen>
<d:networking>
Wifi
Bluetooth
NFC
</d:networking>
<d:sensors>
Accelerometer
Barometer
Compass
GPS
Gyroscope
LightSensor
ProximitySensor
</d:sensors>
<d:mic>true</d:mic>
<d:camera>
<d:location>back</d:location>
<d:autofocus>true</d:autofocus>
<d:flash>true</d:flash>
</d:camera>
<d:camera>
<d:location>front</d:location>
<d:autofocus>false</d:autofocus>
<d:flash>false</d:flash>
</d:camera>
<d:keyboard>nokeys</d:keyboard>
<d:nav>nonav</d:nav>
<d:ram unit="KiB">1953125</d:ram>
<d:buttons>soft</d:buttons>
<d:internal-storage unit="KiB">7811891</d:internal-storage>
<d:removable-storage unit="MiB"></d:removable-storage>
<d:cpu>Qualcomm Snapdragon S4 Pro</d:cpu>
<d:gpu>Adreno 320</d:gpu>
<d:abi>
armeabi-v7a
armeabi
</d:abi>
<d:dock></d:dock>
<d:power-type>battery</d:power-type>
</d:hardware>
<d:software>
<d:api-level>16</d:api-level>
<d:live-wallpaper-support>true</d:live-wallpaper-support>
<d:bluetooth-profiles></d:bluetooth-profiles>
<d:gl-version>2.0</d:gl-version>
<d:gl-extensions>GL_EXT_debug_marker GL_AMD_compressed_ATC_texture
GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_robustness
GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence
GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24
GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_element_index_uint
GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary
GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives
GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float
GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float
GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test
GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode
GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering
GL_QCOM_writeonly_rendering GL_EXT_sRGB
</d:gl-extensions>
<d:status-bar>true</d:status-bar>
</d:software>
<d:state name="Portrait" default="true">
<d:description>The phone in portrait view</d:description>
<d:screen-orientation>port</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
<d:state name="Landscape">
<d:description>The phone in landscape view</d:description>
<d:screen-orientation>land</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
</d:device>
<d:device>
<d:name>Nexus 10</d:name>
<d:manufacturer>Google</d:manufacturer>
<d:hardware>
<d:screen>
<d:screen-size>xlarge</d:screen-size>
<d:diagonal-length>10.055</d:diagonal-length>
<d:pixel-density>xhdpi</d:pixel-density>
<d:screen-ratio>notlong</d:screen-ratio>
<d:dimensions>
<d:x-dimension>2560</d:x-dimension>
<d:y-dimension>1600</d:y-dimension>
</d:dimensions>
<d:xdpi>300</d:xdpi>
<d:ydpi>300</d:ydpi>
<d:touch>
<d:multitouch>jazz-hands</d:multitouch>
<d:mechanism>finger</d:mechanism>
<d:screen-type>capacitive</d:screen-type>
</d:touch>
</d:screen>
<d:networking>
Wifi
Bluetooth
NFC
</d:networking>
<d:sensors>
Accelerometer
Barometer
Compass
GPS
Gyroscope
LightSensor
</d:sensors>
<d:mic>true</d:mic>
<d:camera>
<d:location>back</d:location>
<d:autofocus>true</d:autofocus>
<d:flash>true</d:flash>
</d:camera>
<d:camera>
<d:location>front</d:location>
<d:autofocus>false</d:autofocus>
<d:flash>false</d:flash>
</d:camera>
<d:keyboard>nokeys</d:keyboard>
<d:nav>nonav</d:nav>
<d:ram unit="KiB">1953125</d:ram>
<d:buttons>soft</d:buttons>
<d:internal-storage unit="KiB">15623782</d:internal-storage>
<d:removable-storage unit="MiB"></d:removable-storage>
<d:cpu>Dual-core A15</d:cpu>
<d:gpu>Quad-core Mali T604</d:gpu>
<d:abi>
armeabi-v7a
armeabi
</d:abi>
<d:dock></d:dock>
<d:power-type>battery</d:power-type>
</d:hardware>
<d:software>
<d:api-level>16</d:api-level>
<d:live-wallpaper-support>true</d:live-wallpaper-support>
<d:bluetooth-profiles></d:bluetooth-profiles>
<d:gl-version>2.0</d:gl-version>
<d:gl-extensions>GL_EXT_debug_marker GL_ARM_rgba8 GL_ARM_mali_shader_binary
GL_OES_depth24 GL_OES_depth_texture GL_OES_depth_texture_cube_map
GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_EXT_read_format_bgra
GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture
GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_image_external
GL_OES_EGL_sync GL_OES_texture_npot GL_OES_vertex_half_float
GL_OES_required_internalformat GL_OES_vertex_array_object GL_OES_mapbuffer
GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_type_2_10_10_10_REV
GL_OES_fbo_render_mipmap GL_OES_element_index_uint GL_EXT_shadow_samplers
GL_EXT_occlusion_query_boolean GL_EXT_blend_minmax GL_EXT_discard_framebuffer
GL_OES_get_program_binary GL_OES_texture_3D GL_EXT_texture_storage
GL_EXT_multisampled_render_to_texture GL_OES_surfaceless_context
GL_ARM_mali_program_binary
</d:gl-extensions>
<d:status-bar>true</d:status-bar>
</d:software>
<d:state name="Portrait">
<d:description>The phone in portrait view</d:description>
<d:screen-orientation>port</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
<d:state name="Landscape" default="true">
<d:description>The phone in landscape view</d:description>
<d:screen-orientation>land</d:screen-orientation>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:nav-state>nonav</d:nav-state>
</d:state>
</d:device>
</d:devices>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,51 @@
@echo off
rem Copyright (C) 2007 The Android Open Source Project
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem This script is called by the other batch files to find a suitable Java.exe
rem to use. The script changes the "java_exe" env variable. The variable
rem is left unset if Java.exe was not found.
rem Useful links:
rem Command-line reference:
rem http://technet.microsoft.com/en-us/library/bb490890.aspx
rem Check we have a valid Java.exe in the path. The return code will
rem be 0 if the command worked or 1 if the exec failed (program not found).
for /f %%a in ('%~dps0\find_java.exe -s') do set java_exe=%%a
if not defined java_exe goto :CheckFailed
:SearchJavaW
rem Check if we can find a javaw.exe at the same location than java.exe.
rem If that doesn't work, just fall back on the java.exe we just found.
for /f %%a in ('%~dps0\find_java.exe -s -w') do set javaw_exe=%%a
if not exist %javaw_exe% set javaw_exe=%java_exe%
goto :EOF
:CheckFailed
echo.
echo ERROR: No suitable Java found. In order to properly use the Android Developer
echo Tools, you need a suitable version of Java JDK installed on your system.
echo We recommend that you install the JDK version of JavaSE, available here:
echo http://www.oracle.com/technetwork/java/javase/downloads
echo.
echo If you already have Java installed, you can define the JAVA_HOME environment
echo variable in Control Panel / System / Avanced System Settings to point to the
echo JDK folder.
echo.
echo You can find the complete Android SDK requirements here:
echo http://developer.android.com/sdk/requirements.html
echo.
goto :EOF
Binary file not shown.
@@ -0,0 +1,365 @@
# This file describes the properties of a given virtual device configuration file.
#
# Note: Most top-level properties are boolean that control whether a feature is
# present or not. Sub-features that depend on it are ignored if their
# parent is set to 'false' or 'no'
#
# This file is parsed by 'android/tools/gen-hw-config.py' to generate
# 'android/avd/hw-config-defs.h'. The latter is a special header containing
# macro statements that is used several times:
#
# - once to define the fields of the AndroidHwConfig structure
# (see android/avd/hw-config.h)
#
# - once to implement the hardware configuration loader
# (see android/avd/hw-config.h)
#
# It is also packaged by the SDK and parsed by tools to let the developers
# create AVDs.
#
# NOTE: if you remove items from this file, be sure that you do not break
# the emulator build.
#
# CPU Architecture
name = hw.cpu.arch
type = string
default = arm
abstract = CPU Architecture
description = The CPU Architecture to emulator
# CPU Model
# Leave it empty, and the default value will be computed from
# hw.cpu.arch. This is only useful for experimentation for now.
name = hw.cpu.model
type = string
default =
abstract = CPU model
description = The CPU model (QEMU-specific string)
# Ram size
# Default value will be computed based on screen pixels
# or skin version
name = hw.ramSize
type = integer
default = 0
abstract = Device ram size
description = The amount of physical RAM on the device, in megabytes.
# Touch screen type
name = hw.screen
type = string
enum = touch, multi-touch, no-touch
default = touch
abstract = Touch screen type
description = Defines type of the screen.
# Hardware main keys (back/home)
name = hw.mainKeys
type = boolean
default = yes
abstract = Hardware Back/Home keys
description = Whether there are hardware back/home keys on the device.
# Trackball support
name = hw.trackBall
type = boolean
default = yes
abstract = Track-ball support
description = Whether there is a trackball on the device.
# Keyboard support (qwerty/azerty)
name = hw.keyboard
type = boolean
default = no
abstract = Keyboard support
description = Whether the device has a QWERTY keyboard.
# Keyboard lid support
# (I.e. can the qwerty keyboard be closed/hidden or opened/visible)
# this will be ignored if hw.keyboard is false
#
# NOTE: As a special case, the default value will be 'false' if the
# AVD targets API level 12 or higher. See hwConfig_init()
# in external/qemu/android/avd/hw-config.c for more details.
#
name = hw.keyboard.lid
type = boolean
default = yes
abstract = Keyboard lid support
description = Whether the QWERTY keyboard can be opened/closed.
# The name of the hardware charmap for this device.
#
# NOTE: This should always be the default 'qwerty2' unless you have
# modified the system image accordingly. This name is sent to
# the kernel at boot time. Using an incorrect name will result
# in an unusable machine.
name = hw.keyboard.charmap
type = string
default = qwerty2
abstract = Keyboard charmap name
description = Name of the system keyboard charmap file.
# DPad keys
name = hw.dPad
type = boolean
default = yes
abstract = DPad support
description = Whether the device has DPad keys
# GSM Modem support
name = hw.gsmModem
type = boolean
default = yes
abstract = GSM modem support
description = Whether there is a GSM modem in the device.
# GPS support
name = hw.gps
type = boolean
default = yes
abstract = GPS support
description = Whether there is a GPS in the device.
# Battery
name = hw.battery
type = boolean
default = yes
abstract = Battery support
description = Whether the device can run on a battery.
# Accelerometer (used for auto-rotation)
name = hw.accelerometer
type = boolean
default = yes
abstract = Accelerometer
description = Whether there is an accelerometer in the device.
# Audio input
name = hw.audioInput
type = boolean
default = yes
abstract = Audio recording support
description = Whether the device can record audio
# Audio output
name = hw.audioOutput
type = boolean
default = yes
abstract = Audio playback support
description = Whether the device can play audio
# SDCard support
name = hw.sdCard
type = boolean
default = yes
abstract = SD Card support
description = Whether the device supports insertion/removal of virtual SD Cards.
name = hw.sdCard.path
type = string
default =
abstract = SD Card image path
# Cache partition
name = disk.cachePartition
type = boolean
default = yes
abstract = Cache partition support
description = Whether we use a /cache partition on the device.
name = disk.cachePartition.path
type = string
default =
abstract = Cache partition
description = Cache partition to use on the device. Ignored if disk.cachePartition is not 'yes'.
name = disk.cachePartition.size
type = diskSize
abstract = Cache partition size
default = 66MB
# LCD width
name = hw.lcd.width
type = integer
default = 320
abstract = LCD pixel width
name = hw.lcd.height
type = integer
default = 640
abstract = LCD pixel height
name = hw.lcd.depth
type = integer
enum = 16, 32
default = 16
abstract = LCD color depth
description = Color bit depth of emulated framebuffer.
# LCD density
name = hw.lcd.density
type = integer
enum = 120, 160, 240, 213, 320
default = 160
abstract = Abstracted LCD density
description = A value used to roughly describe the density of the LCD screen for automatic resource/asset selection.
# LCD backlight - Enable/Disable LCD backlight simulation
# default = no : Disabled
# default = yes : Enabled
name = hw.lcd.backlight
type = boolean
default = yes
abstract = LCD backlight
description = Enable/Disable LCD backlight simulation,yes-enabled,no-disabled.
# Hardware OpenGLES emulation support
#
name = hw.gpu.enabled
type = boolean
default = no
abstract = GPU emulation
description = Enable/Disable emulated OpenGLES GPU
# Configures camera facing back
#
name = hw.camera.back
type = string
enum = emulated, none, webcam0, ...
default = emulated
abstract = Configures camera facing back
description = Must be 'emulated' for a fake camera, 'webcam<N>' for a web camera, or 'none' if back camera is disabled.
# Configures camera facing front
#
name = hw.camera.front
type = string
enum = emulated, none, webcam0, ...
default = none
abstract = Configures camera facing front
description = Must be 'emulated' for a fake camera, 'webcam<N>' for a web camera, or 'none' if front camera is disabled.
# Maximum VM heap size
# Higher values are required for high-dpi devices
# Default will depend on RAM size.
name = vm.heapSize
type = integer
default = 0
abstract = Max VM application heap size
description = The maximum heap size a Dalvik application might allocate before being killed by the system. Value is in megabytes.
# Proximity sensor
name = hw.sensors.proximity
type = boolean
default = yes
abstract = Proximity support
description = Whether there is an proximity in the device.
# Magnetic field sensor
name = hw.sensors.magnetic_field
type = boolean
default = yes
abstract = Magnetic field support
description = Provides magnetic field sensor values.
# Orientation sensor
name = hw.sensors.orientation
type = boolean
default = yes
abstract = Orientation support
description = Provides orientation sensor values.
# Temperature sensor
name = hw.sensors.temperature
type = boolean
default = yes
abstract = Temperature support
description = Provides temperature sensor values.
# Kernel image.
#
# kernel.path specified the path to the kernel image
# kernel.parameters specifies the string of kernel boot parameters.
#
name = kernel.path
type = string
default =
abstract = Path to the kernel image
description = Path to the kernel image.
name = kernel.parameters
type = string
default =
abstract = kernel boot parameters string.
# Path to the ramdisk image.
name = disk.ramdisk.path
type = string
default =
abstract = Path to the ramdisk image
description = Path to the ramdisk image.
# System partition image(s).
#
# disk.systemPartition.path points to the read/write system partition image.
# if empty, a temporary file will be created, initialized with the content
# of .initPath
#
# disk.systemPartition.initPath is only used when .path is empty. It must
# then point to a read-only initialization system image file.
#
# disk.systemPartition.size is the ideal size of the system partition. The
# size is ignored if the actual system partition image is larger. Otherwise,
# it indicates the maximum size the disk image file can grow to.
#
name = disk.systemPartition.path
type = string
default =
abstract = Path to runtime system partition image
name = disk.systemPartition.initPath
type = string
default =
abstract = Initial system partition image
name = disk.systemPartition.size
type = diskSize
default = 0
abstract = Ideal size of system partition
# Path to the data partition.
name = disk.dataPartition.path
type = string
default = <temp>
abstract = Path to data partition file
description = Path to data partition file. Cannot be empty. Special value <temp> means using a temporary file. If disk.dataPartition.initPath is not empty, its content will be copied to the disk.dataPartition.path file at boot-time.
# Initial path to the data partition.
name = disk.dataPartition.initPath
type = string
default =
abstract = Initial data partition
description = If not empty, its content will be copied to the disk.dataPartition.path file at boot-time.
# Data partition size.
name = disk.dataPartition.size
type = diskSize
default = 0
abstract = Ideal size of data partition
# Path to the snapshots storage file.
name = disk.snapStorage.path
type = string
default =
abstract = Path to snapshot storage
description = Path to a 'snapshot storage' file, where all snapshots are stored.
# Android AVD name
# This is set automatically before launching a core.
#
name = avd.name
type = string
default = <build>
abstract = Name of the AVD being run
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,125 @@
import subprocess
import thread, threading
import re
from subprocess import call, PIPE, Popen
adb = subprocess.Popen(["adb", "logcat","DroidBox:W", "dalvikvm:W", "ActivityManager:I"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
while 1:
try:
logcatInput = adb.stdout.readline()
if not logcatInput:
raise Exception("We have lost the connection with ADB.")
except:
break
duration=30
print("Application started")
print("Analyzing the application during %s seconds..." % (duration if (duration !=0) else "infinite time"))
count = CountingThread()
count.start()
timeStamp = time.time()
if duration:
signal.signal(signal.SIGALRM, interruptHandler)
signal.alarm(duration)
#Collect DroidBox logs
while 1:
try:
logcatInput = adb.stdout.readline()
if not logcatInput:
raise Exception("We have lost the connection with ADB.")
boxlog = logcatInput.split('DroidBox:')
if len(boxlog) > 1:
try:
load = json.loads(decode(boxlog[1]))
if load.has_key('DexClassLoader'):
load['DexClassLoader']['type'] = 'dexload'
dexclass[time.time() - timeStamp] = load['DexClassLoader']
print load['DexClassLoader']
count.increaseCount()
# service started
if load.has_key('ServiceStart'):
load['ServiceStart']['type'] = 'service'
servicestart[time.time() - timeStamp] = load['ServiceStart']
print load['ServiceStart']
count.increaseCount()
# received data from net
if load.has_key('RecvNet'):
host = load['RecvNet']['srchost']
port = load['RecvNet']['srcport']
print load['RecvNet']['srchost']
recvnet[time.time() - timeStamp] = recvdata = {'type': 'net read', 'host': host, 'port': port, 'data': load['RecvNet']['data']}
count.increaseCount()
# fdaccess
if load.has_key('FdAccess'):
accessedfiles[load['FdAccess']['id']] = hexToStr(load['FdAccess']['path'])
print hexToStr(load['FdAccess']['path'])
# file read or write
if load.has_key('FileRW'):
load['FileRW']['path'] = accessedfiles[load['FileRW']['id']]
print accessedfiles[load['FileRW']['id']]
if load['FileRW']['operation'] == 'write':
load['FileRW']['type'] = 'file write'
else:
load['FileRW']['type'] = 'file read'
fdaccess[time.time()-timeStamp] = load['FileRW']
count.increaseCount()
# opened network connection log
if load.has_key('OpenNet'):
opennet[time.time()-timeStamp] = load['OpenNet']
print load['OpenNet']
count.increaseCount()
# closed socket
if load.has_key('CloseNet'):
closenet[time.time()-timeStamp] = load['CloseNet']
count.increaseCount()
# outgoing network activity log
if load.has_key('SendNet'):
load['SendNet']['type'] = 'net write'
sendnet[time.time()-timeStamp] = load['SendNet']
count.increaseCount()
# data leak log
if load.has_key('DataLeak'):
my_time = time.time()-timeStamp
load['DataLeak']['type'] = 'leak'
load['DataLeak']['tag'] = getTags(int(load['DataLeak']['tag'], 16))
dataleaks[my_time] = load['DataLeak']
count.increaseCount()
if load['DataLeak']['sink'] == 'Network':
load['DataLeak']['type'] = 'net write'
sendnet[my_time] = load['DataLeak']
count.increaseCount()
elif load['DataLeak']['sink'] == 'File':
load['DataLeak']['path'] = accessedfiles[load['DataLeak']['id']]
if load['DataLeak']['operation'] == 'write':
load['DataLeak']['type'] = 'file write'
else:
load['DataLeak']['type'] = 'file read'
fdaccess[my_time] = load['DataLeak']
count.increaseCount()
elif load['DataLeak']['sink'] == 'SMS':
load['DataLeak']['type'] = 'sms'
sendsms[my_time] = load['DataLeak']
count.increaseCount()
# sent sms log
if load.has_key('SendSMS'):
load['SendSMS']['type'] = 'sms'
sendsms[time.time()-timeStamp] = load['SendSMS']
print load['SendSMS']
count.increaseCount()
# phone call log
if load.has_key('PhoneCall'):
load['PhoneCall']['type'] = 'call'
phonecalls[time.time()-timeStamp] = load['SendSMS']
print load['SendSMS']
count.increaseCount()
# crypto api usage log
if load.has_key('CryptoUsage'):
load['CryptoUsage']['type'] = 'crypto'
cryptousage[time.time()-timeStamp] = load['CryptoUsage']
count.increaseCount()
except ValueError:
pass
except:
try:
count.stopCounting()
count.join()
finally:
break;
@@ -0,0 +1,197 @@
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
import subprocess
import logging
import sys
apkpath=sys.argv[1]
pkgname=sys.argv[2]
mainactivity=sys.argv[3]
filename=sys.argv[4]
# Connects to the current device, returning a MonkeyDevice object
device=None
while device==None:
try:
device = MonkeyRunner.waitForConnection()
print "Connected to Device"
except:
pass
# Installs the Android package. Returns Boolean.
if (device.installPackage(apkpath)):
print "Installing : "+ str(apkpath)
else:
print "Installation Failed"
# sets the name of the component to start
runComponent = pkgname + '/' + mainactivity
# Runs the component
device.startActivity(component=runComponent)
process = subprocess.Popen(["adb", "shell", "am", "start", "-n", runComponent], stdout=subprocess.PIPE)
out, err = process.communicate()
# Presses the Menu button
#device.press('KEYCODE_MENU', MonkeyDevice.DOWN_AND_UP)
# Takes a screenshot
MonkeyRunner.sleep(2)
result = device.takeSnapshot()
print "Screenshot Saved"
# Writes the screenshot to a file
result.writeToFile(filename+'.png','png')
'''
#Open the adb logcat
adb = Popen(["adb", "logcat", "DroidBox:W", "dalvikvm:W", "ActivityManager:I"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
#Wait for the application to start
while 1:
try:
logcatInput = adb.stdout.readline()
if not logcatInput:
raise Exception("We have lost the connection with ADB.")
#Application started?
if (stringApplicationStarted in logcatInput):
applicationStarted = 1
break;
except:
break;
if (applicationStarted == 0):
print("Analysis has not been done.")
#Kill ADB, otherwise it will never terminate
os.kill(adb.pid, signal.SIGTERM)
sys.exit(1)
print("Application started")
print("Analyzing the application during %s seconds..." % (duration if (duration !=0) else "infinite time"))
count = CountingThread()
count.start()
timeStamp = time.time()
if duration:
signal.signal(signal.SIGALRM, interruptHandler)
signal.alarm(duration)
#Collect DroidBox logs
while 1:
try:
logcatInput = adb.stdout.readline()
if not logcatInput:
raise Exception("We have lost the connection with ADB.")
boxlog = logcatInput.split('DroidBox:')
if len(boxlog) > 1:
try:
load = json.loads(decode(boxlog[1]))
# DexClassLoader
if load.has_key('DexClassLoader'):
load['DexClassLoader']['type'] = 'dexload'
dexclass[time.time() - timeStamp] = load['DexClassLoader']
count.increaseCount()
# service started
if load.has_key('ServiceStart'):
load['ServiceStart']['type'] = 'service'
servicestart[time.time() - timeStamp] = load['ServiceStart']
count.increaseCount()
except ValueError:
pass
except:
try:
count.stopCounting()
count.join()
finally:
break;
# received data from net
if load.has_key('RecvNet'):
host = load['RecvNet']['srchost']
port = load['RecvNet']['srcport']
recvnet[time.time() - timeStamp] = recvdata = {'type': 'net read', 'host': host, 'port': port, 'data': load['RecvNet']['data']}
count.increaseCount()
# fdaccess
if load.has_key('FdAccess'):
accessedfiles[load['FdAccess']['id']] = hexToStr(load['FdAccess']['path'])
# file read or write
if load.has_key('FileRW'):
load['FileRW']['path'] = accessedfiles[load['FileRW']['id']]
if load['FileRW']['operation'] == 'write':
load['FileRW']['type'] = 'file write'
else:
load['FileRW']['type'] = 'file read'
fdaccess[time.time()-timeStamp] = load['FileRW']
count.increaseCount()
# opened network connection log
if load.has_key('OpenNet'):
opennet[time.time()-timeStamp] = load['OpenNet']
count.increaseCount()
# closed socket
if load.has_key('CloseNet'):
closenet[time.time()-timeStamp] = load['CloseNet']
count.increaseCount()
# outgoing network activity log
if load.has_key('SendNet'):
load['SendNet']['type'] = 'net write'
sendnet[time.time()-timeStamp] = load['SendNet']
count.increaseCount()
# data leak log
if load.has_key('DataLeak'):
my_time = time.time()-timeStamp
load['DataLeak']['type'] = 'leak'
load['DataLeak']['tag'] = getTags(int(load['DataLeak']['tag'], 16))
dataleaks[my_time] = load['DataLeak']
count.increaseCount()
if load['DataLeak']['sink'] == 'Network':
load['DataLeak']['type'] = 'net write'
sendnet[my_time] = load['DataLeak']
count.increaseCount()
elif load['DataLeak']['sink'] == 'File':
load['DataLeak']['path'] = accessedfiles[load['DataLeak']['id']]
if load['DataLeak']['operation'] == 'write':
load['DataLeak']['type'] = 'file write'
else:
load['DataLeak']['type'] = 'file read'
fdaccess[my_time] = load['DataLeak']
count.increaseCount()
elif load['DataLeak']['sink'] == 'SMS':
load['DataLeak']['type'] = 'sms'
sendsms[my_time] = load['DataLeak']
count.increaseCount()
# sent sms log
if load.has_key('SendSMS'):
load['SendSMS']['type'] = 'sms'
sendsms[time.time()-timeStamp] = load['SendSMS']
count.increaseCount()
# phone call log
if load.has_key('PhoneCall'):
load['PhoneCall']['type'] = 'call'
phonecalls[time.time()-timeStamp] = load['PhoneCall']
count.increaseCount()
# crypto api usage log
if load.has_key('CryptoUsage'):
load['CryptoUsage']['type'] = 'crypto'
cryptousage[time.time()-timeStamp] = load['CryptoUsage']
count.increaseCount()
except ValueError:
pass
except:
try:
count.stopCounting()
count.join()
finally:
break;
#Kill ADB, otherwise it will never terminate
os.kill(adb.pid, signal.SIGTERM)
'''
@@ -0,0 +1,63 @@
@echo off
rem Copyright (C) 2010 The Android Open Source Project
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem don't modify the caller's environment
setlocal
rem Set up prog to be the path of this script, including following symlinks,
rem and set up progdir to be the fully-qualified pathname of its directory.
set prog=%~f0
rem Change current directory and drive to where the script is, to avoid
rem issues with directories containing whitespaces.
cd /d %~dp0
rem Check we have a valid Java.exe in the path.
set java_exe=
call lib\find_java.bat
if not defined java_exe goto :EOF
set jarfile=monkeyrunner.jar
set frameworkdir=
set libdir=
if exist %frameworkdir%%jarfile% goto JarFileOk
set frameworkdir=lib\
if exist %frameworkdir%%jarfile% goto JarFileOk
set frameworkdir=..\framework\
:JarFileOk
set jarpath=%frameworkdir%%jarfile%
if not defined ANDROID_SWT goto QueryArch
set swt_path=%ANDROID_SWT%
goto SwtDone
:QueryArch
for /f %%a in ('%java_exe% -jar %frameworkdir%archquery.jar') do set swt_path=%frameworkdir%%%a
:SwtDone
if exist %swt_path% goto SetPath
echo SWT folder '%swt_path%' does not exist.
echo Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
exit /B
:SetPath
call %java_exe% -Xmx512m -Djava.ext.dirs=%frameworkdir%;%swt_path% -Dcom.android.monkeyrunner.bindir=..\framework -jar %jarpath% %*
@@ -0,0 +1,45 @@
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
import subprocess
import logging
import sys,os
apkpath=sys.argv[1]
pkgname=sys.argv[2]
mainactivity=sys.argv[3]
filename=sys.argv[4]
# Connects to the current device, returning a MonkeyDevice object
device=None
while device==None:
try:
device = MonkeyRunner.waitForConnection()
print "Connected to Device"
except:
pass
# Installs the Android package. Returns Boolean.
if (device.installPackage(apkpath)):
print "Installing : "+ str(apkpath)
else:
print "Installation Failed"
# sets the name of the component to start
runComponent = pkgname + '/' + mainactivity
# Runs the component
device.startActivity(component=runComponent)
process = subprocess.Popen(["adb", "shell", "am", "start", "-n","-w", runComponent], stdout=subprocess.PIPE)
out, err = process.communicate()
# Presses the Menu button
device.press('KEYCODE_MENU', MonkeyDevice.DOWN_AND_UP)
# Takes a screenshot
MonkeyRunner.sleep(6)
result = device.takeSnapshot()
print "Screenshot Saved"
# Writes the screenshot to a file
result.writeToFile("Results\\"+filename+'.png','png')
MonkeyRunner.sleep(5)
print "Taking Logcat Dumps"
os.system("adb.exe logcat -d dalvikvm:W ActivityManager:I >Results\logcat.txt")
print "Taking Memory Dumps"
os.system("adb.exe shell dumpsys >Results\dump.txt")
@@ -0,0 +1,3 @@
Pkg.UserSrc=false
Pkg.Revision=18.0.1
@@ -0,0 +1 @@
adb shell procrank ^| grep com.earn.rewards.rewardometer ^| awk '{ print $1 }' ^| xargs strace -c -q -p >Results\\syscalls51299266ECBC1B26D8CED685BB1FEA2E0D1478.txt
@@ -0,0 +1,12 @@
# Names should be added to this file with this pattern:
#
# For individuals:
# Name <email address>
#
# For organizations:
# Organization <fnmatch pattern>
#
# See python fnmatch module documentation for more information.
The Chromium Authors <*@chromium.org>
Google Inc. <*@google.com>
@@ -0,0 +1,27 @@
// Copyright (c) 2010 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.
@@ -0,0 +1,205 @@
// Copyright (c) 2012 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.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
@@ -0,0 +1 @@
256
@@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<head i18n-values="dir:textdirection;">
<meta charset="utf-8"/>
<title>Android System Trace</title>
%s
%s
<script language="javascript">
document.addEventListener('DOMContentLoaded', function() {
if (!linuxPerfData)
return;
var m = new tracing.Model(linuxPerfData);
var timelineViewEl = document.querySelector('.view');
tracing.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 class="view">
</div>
<!-- BEGIN TRACE -->
<script>
var linuxPerfData = "\
@@ -0,0 +1,352 @@
window.FLATTENED={};window.FLATTENED.base=!0;window.FLATTENED.event_target=!0;window.FLATTENED.measuring_stick=!0;window.FLATTENED.filter=!0;window.FLATTENED.range=!0;window.FLATTENED.selection=!0;window.FLATTENED.timeline_viewport=!0;window.FLATTENED.ui=!0;window.FLATTENED["tracks.track"]=!0;window.FLATTENED["tracks.container_track"]=!0;window.FLATTENED.fast_rect_renderer=!0;window.FLATTENED.color_scheme=!0;window.FLATTENED["tracks.canvas_based_track"]=!0;window.FLATTENED.sorted_array_utils=!0;
window.FLATTENED["tracks.slice_track"]=!0;window.FLATTENED.guid=!0;window.FLATTENED["model.slice"]=!0;window.FLATTENED["model.slice_group"]=!0;window.FLATTENED["model.async_slice_group"]=!0;window.FLATTENED["model.sample"]=!0;window.FLATTENED["model.thread"]=!0;window.FLATTENED["model.counter"]=!0;window.FLATTENED["model.process_base"]=!0;window.FLATTENED["model.process"]=!0;window.FLATTENED["model.kernel"]=!0;window.FLATTENED["model.cpu"]=!0;window.FLATTENED.model=!0;
window.FLATTENED["tracks.cpu_track"]=!0;window.FLATTENED["tracks.counter_track"]=!0;window.FLATTENED["tracks.slice_group_track"]=!0;window.FLATTENED["tracks.async_slice_group_track"]=!0;window.FLATTENED["tracks.thread_track"]=!0;window.FLATTENED["tracks.process_track"]=!0;window.FLATTENED["tracks.model_track"]=!0;window.FLATTENED["tracks.ruler_track"]=!0;window.FLATTENED.timeline_track_view=!0;window.FLATTENED["analysis.util"]=!0;window.FLATTENED.timeline_analysis_view=!0;
window.FLATTENED.overlay=!0;window.FLATTENED.category_filter_dialog=!0;window.FLATTENED.find_control=!0;window.FLATTENED["importer.trace_event_importer"]=!0;window.FLATTENED["importer.linux_perf.parser"]=!0;window.FLATTENED["importer.linux_perf.bus_parser"]=!0;window.FLATTENED["importer.linux_perf.clock_parser"]=!0;window.FLATTENED["importer.linux_perf.cpufreq_parser"]=!0;window.FLATTENED["importer.linux_perf.disk_parser"]=!0;window.FLATTENED["importer.linux_perf.drm_parser"]=!0;
window.FLATTENED["importer.linux_perf.exynos_parser"]=!0;window.FLATTENED["importer.linux_perf.gesture_parser"]=!0;window.FLATTENED["importer.linux_perf.i915_parser"]=!0;window.FLATTENED["importer.linux_perf.mali_parser"]=!0;window.FLATTENED["importer.linux_perf.power_parser"]=!0;window.FLATTENED["importer.linux_perf.sched_parser"]=!0;window.FLATTENED["importer.linux_perf.workqueue_parser"]=!0;window.FLATTENED["importer.linux_perf.android_parser"]=!0;
window.FLATTENED["importer.linux_perf.kfunc_parser"]=!0;window.FLATTENED["importer.linux_perf_importer"]=!0;window.FLATTENED["importer.v8.log_reader"]=!0;window.FLATTENED["importer.v8.splaytree"]=!0;window.FLATTENED["importer.v8.codemap"]=!0;window.FLATTENED["importer.v8_log_importer"]=!0;window.FLATTENED.settings=!0;window.FLATTENED.timeline_view=!0;"use strict";var global=this;
this.base=function(){function d(b){"/"==b[b.length-1]&&(b=b.substring(0,b.length-1));q=b}function c(b,a){r[b]||(r[b]=[]);for(var f=r[b],e=!1,g=0;g<f.length;g++)f[g]==a&&(e=!0);e||f.push(a)}function a(b,a){s[b]||(s[b]=[]);for(var f=s[b],e=!1,g=0;g<s.length;g++)f[g]==a&&(e=!0);e||f.push(a)}function b(b,a){u[b]||(u[b]=[]);for(var f=u[b],e=!1,g=0;g<f.length;g++)f[g]==a&&(e=!0);e||f.push(a)}function f(){if(!p){p=!0;var f=new XMLHttpRequest,e=q+"/deps.js";f.open("GET",e,!1);f.send(null);if(200!=f.status)throw Error("Could not find "+
e+". Run calcdeps.py and try again.");base.addModuleDependency=c;base.addModuleRawScriptDependency=a;base.addModuleStylesheet=b;try{eval(f.responseText)}catch(g){throw Error("When loading deps, got "+g.stack?g.stack:g);}delete base.addModuleStylesheet;delete base.addModuleRawScriptDependency;delete base.addModuleDependency}}function e(b,a){var c=a||0;if(window.FLATTENED){if(!window.FLATTENED[b])throw Error("Somehow, module "+b+" didn't get stored in the flattened js file! You may need to rerun build/calcdeps.py");
}else if(f(),"APPENDED"!=w[b]){if("RESOLVING"==w[b])throw Error("Circular dependency betwen modules. Cannot continue!");w[b]="RESOLVING";for(var j=u[b]||[],d=0;d<j.length;d++)g(j[d]);j=s[b]||[];for(d=0;d<j.length;d++){var k=j[d];if(!v[k]){var h=q+"/"+k,h='<script type="text/javascript" src="'+h+'">\x3c/script>';base.doc.write(h);v[k]="APPENDED"}}j=r[b]||[];for(d=0;d<j.length;d++)e(j[d],c+1);c=b.replace(/\./g,"/")+".js";h=q+"/"+c;base.doc.write('<script type="text/javascript" src="'+h+'">\x3c/script>');
w[b]="APPENDED"}}function g(b){if(!window.FLATTENED&&!x[b]){x[b]=!0;b=b.replace(/\./g,"/")+".css";b=q+"/"+b;var a=document.createElement("link");a.setAttribute("rel","stylesheet");a.setAttribute("href",b);base.doc.head.appendChild(a)}}function j(b,a,f,e){var g=new base.Event(a+"Change");g.propertyName=a;g.newValue=f;g.oldValue=e;b.dispatchEvent(g)}function h(b){return b.replace(/([A-Z])/g,"-$1").toLowerCase()}function k(b,a){switch(a){case y.JS:var f=b+"_";return function(){return this[f]};case y.ATTR:var e=
h(b);return function(){return this.getAttribute(e)};case y.BOOL_ATTR:return e=h(b),function(){return this.hasAttribute(e)}}}function l(b,a,f){switch(a){case y.JS:var e=b+"_";return function(a){var g=this[e];a!==g&&(this[e]=a,f&&f.call(this,a,g),j(this,b,a,g))};case y.ATTR:var g=h(b);return function(a){var e=this[g];a!==e&&(void 0==a?this.removeAttribute(g):this.setAttribute(g,a),f&&f.call(this,a,e),j(this,b,a,e))};case y.BOOL_ATTR:return g=h(b),function(a){var e=this[g];a!==e&&(a?this.setAttribute(g,
b):this.removeAttribute(g),f&&f.call(this,a,e),j(this,b,a,e))}}}function t(b,a,f){var e=base.doc.createEvent("Event");e.initEvent(b,!!a,!!f);e.__proto__=global.Event.prototype;return e}function m(){this.types=[];this.values=[]}var q=".",p=!1,r={},u={},s={},w={},v={},x={},y={JS:"js",ATTR:"attr",BOOL_ATTR:"boolAttr"},z=1;m.prototype={__proto__:Object.prototype,add:function(b,a){this.types.push(b);this.values.push(a)},get:function(b){for(var a=0;a<this.types.length;a++)if(b instanceof this.types[a])return this.values[a]}};
return{set moduleBasePath(b){d(b)},get moduleBasePath(){return q},require:e,requireStylesheet:g,requireRawScript:function(b){if(window.FLATTENED_RAW_SCRIPTS){if(!window.FLATTENED_RAW_SCRIPTS[b])throw Error("Somehow, "+b+" didn't get stored in the flattened js file! You may need to rerun build/calcdeps.py");}else if(!v[b])throw Error(b+" should already have been loaded. Did you forget to run calcdeps.py?");},exportTo:function(b,a){var f;f=b.split(".");for(var e=global,g;f.length&&(g=f.shift());)e=
g in e?e[g]:e[g]={};f=e;try{var c=a()}catch(j){console.log("While running exports for ",name,":");console.log(j.stack||j);return}for(var d in c)(e=Object.getOwnPropertyDescriptor(c,d))&&Object.defineProperty(f,d,e)},addSingletonGetter:function(b){b.getInstance=function(){return b.instance_||(b.instance_=new b)}},createUid:function(){return z++},defineProperty:function(b,a,f,e){"function"==typeof b&&(b=b.prototype);f=f||y.JS;b.__lookupGetter__(a)||b.__defineGetter__(a,k(a,f));b.__lookupSetter__(a)||
b.__defineSetter__(a,l(a,f,e))},dispatchPropertyChange:j,dispatchSimpleEvent:function(b,a,f,e){a=new base.Event(a,f,e);return b.dispatchEvent(a)},Event:t,getUid:function(b){return b.hasOwnProperty("uid")?b.uid:b.uid=z++},initialize:function(){if(global.document)t.prototype={__proto__:global.Event.prototype},base.doc=document,base.isMac=/Mac/.test(navigator.platform),base.isWindows=/Win/.test(navigator.platform),base.isChromeOS=/CrOS/.test(navigator.userAgent),base.isLinux=/Linux/.test(navigator.userAgent),
base.isGTK=/GTK/.test(chrome.toolkit),base.isViews=/views/.test(chrome.toolkit),d("/src");else{var b=cr;Object.defineProperty(global,"cr",{get:function(){Object.defineProperty(global,"cr",{value:b});originalBase.initialize();return b},configurable:!0})}},PropertyKind:y,asArray:function(b){for(var a=[],f=0;f<b.length;f++)a.push(b[f]);return a},concatenateArrays:function(){for(var b=[],a=0;a<arguments.length;a++){if(!(arguments[a]instanceof Array))throw Error("Arguments "+a+"is not an array");b.push.apply(b,
arguments[a])}return b},dictionaryKeys:function(b){var a=[],f;for(f in b)a.push(f);return a},dictionaryValues:function(b){var a=[],f;for(f in b)a.push(b[f]);return a},TypeMap:m}}();base.initialize();
base.exportTo("base",function(){function d(){}d.prototype={addEventListener:function(c,a){this.listeners_||(this.listeners_=Object.create(null));if(c in this.listeners_){var b=this.listeners_[c];0>b.indexOf(a)&&b.push(a)}else this.listeners_[c]=[a]},removeEventListener:function(c,a){if(this.listeners_&&c in this.listeners_){var b=this.listeners_[c],f=b.indexOf(a);0<=f&&(1==b.length?delete this.listeners_[c]:b.splice(f,1))}},dispatchEvent:function(c){if(!this.listeners_)return!0;var a=this;c.__defineGetter__("target",
function(){return a});c.preventDefault=function(){this.returnValue=!1};var b=c.type,f=0;if(b in this.listeners_)for(var b=this.listeners_[b].concat(),e=0,g;g=b[e];e++)f=g.handleEvent?f|!1===g.handleEvent.call(g,c):f|!1===g.call(this,c);return!f&&c.returnValue}};return{EventTarget:d}});
base.exportTo("tracing",function(){function d(){this.iframe_=void 0}d.prototype={__proto__:Object.prototype,measure:function(c){this.iframe_.contentDocument.body.appendChild(c);var a=this.iframe_.contentWindow.getComputedStyle(c),b=parseInt(a.width,10),a=parseInt(a.height,10);this.iframe_.contentDocument.body.removeChild(c);return{width:b,height:a}},attach:function(){var c=document.createElement("iframe");c.style.cssText="width:100%;height:0;border:0;visibility:hidden";document.body.appendChild(c);
this.iframe_=c;this.iframe_.contentDocument.body.style.cssText="padding:0;margin:0;overflow:hidden";for(var c=document.querySelectorAll("link[rel=stylesheet]"),a=0;a<c.length;a++){var b=c[a],f=this.iframe_.contentDocument.createElement("link");f.rel="stylesheet";f.href=b.href;this.iframe_.contentDocument.head.appendChild(f)}},detach:function(){document.body.removeChild(this.iframe_);this.iframe_=void 0}};return{MeasuringStick:d}});"use strict";
base.exportTo("tracing",function(){function d(){}function c(b){this.text_=b}function a(b){this.categories_={};b=b||[];for(var a=0;a<b.length;a++)this.addCategory(b[a])}d.prototype={__proto__:Object.prototype,matchCounter:function(){return!0},matchCpu:function(){return!0},matchProcess:function(){return!0},matchSlice:function(){return!0},matchThread:function(){return!0}};c.prototype={__proto__:d.prototype,matchCounter:function(b){return 0==this.text_.length||void 0===b.name?!1:-1!=b.name.indexOf(this.text_)},
matchSlice:function(b){return 0==this.text_.length||void 0===b.title?!1:-1!=b.title.indexOf(this.text_)}};a.prototype={__proto__:d.prototype,addCategory:function(b){this.categories_[b]=!0},matchCounter:function(b){return!b.category?!0:!this.categories_[b.category]},matchSlice:function(b){return!b.category?!0:!this.categories_[b.category]}};return{filterCounterArray:function(b,a){if(void 0===b)return a;for(var e=[],g=0;g<a.length;++g)b.matchCounter(a[g])&&e.push(a[g]);return e},filterSliceArray:function(b,
a){if(void 0===b)return a;for(var e=[],g=0;g<a.length;++g)b.matchSlice(a[g])&&e.push(a[g]);return e},Filter:d,TitleFilter:c,CategoryFilter:a}});"use strict";"use strict";
base.exportTo("base",function(){function d(){this.isEmpty_=!0;this.max_=this.min_=void 0}d.prototype={__proto__:Object.prototype,reset:function(){this.isEmpty_=!0;this.max_=this.min_=void 0},get isEmpty(){return this.isEmpty_},addRange:function(c){c.isEmpty||(this.addValue(c.min),this.addValue(c.max))},addValue:function(c){this.isEmpty_?(this.min_=this.max_=c,this.isEmpty_=!1):(this.max_=Math.max(this.max_,c),this.min_=Math.min(this.min_,c))},get min(){return this.isEmpty_?void 0:this.min_},get max(){return this.isEmpty_?
void 0:this.max_}};return{Range:d}});"use strict";base.require("range");base.require("event_target");
base.exportTo("tracing",function(){function d(b,a){this.track=b;this.slice=a}function c(b,a,e){this.track=b;this.counter=a;this.sampleIndex=e}function a(){this.bounds_dirty_=!0;this.bounds_=new base.Range;this.length_=0}d.prototype={get selected(){return this.slice.selected},set selected(b){this.slice.selected=b}};c.prototype={get selected(){return!0==this.track.selectedSamples[this.sampleIndex]},set selected(b){this.track.selectedSamples[this.sampleIndex]=b?!0:!1;this.track.invalidate()}};a.prototype=
{__proto__:Object.prototype,get bounds(){if(this.bounds_dirty_){this.bounds_.reset();for(var b=0;b<this.length_;b++){var a=this[b];a.slice&&(this.bounds_.addValue(a.slice.start),this.bounds_.addValue(a.slice.end))}this.bounds_dirty_=!1}return this.bounds_},get duration(){return this.bounds_.isEmpty?0:this.bounds_.max-this.bounds_.min},get length(){return this.length_},clear:function(){for(var b=0;b<this.length_;++b)delete this[b];this.length_=0;this.bounds_dirty_=!0},pushHit:function(b){this.push_(b)},
push_:function(b){this[this.length_++]=b;this.bounds_dirty_=!0;return b},addSlice:function(b,a){return this.push_(new d(b,a))},addCounterSample:function(b,a,e){return this.push_(new c(b,a,e))},subSelection:function(b,f){f=f||1;var e=new a;e.bounds_dirty_=!0;if(0>b||b+f>this.length_)throw Error("Index out of bounds");for(var g=b;g<b+f;g++)e.push_(this[g]);return e},getCounterSampleHitsAsSelection:function(){for(var b=new a,f=0;f<this.length_;f++)this[f]instanceof c&&b.push_(this[f]);return b},getSliceHitsAsSelection:function(){for(var b=
new a,f=0;f<this.length_;f++)this[f]instanceof d&&b.push_(this[f]);return b},getNumSliceHits:function(){for(var b=0,a=0;a<this.length_;a++)this[a]instanceof d&&b++;return b},getNumCounterHits:function(){for(var b=0,a=0;a<this.length_;a++)this[a]instanceof c&&b++;return b},map:function(b){for(var a=0;a<this.length_;a++)b(this[a])},getShiftedSelection:function(b){for(var f=new a,e=0;e<this.length_;e++){var g=this[e];g.track.addItemNearToProvidedHitToSelection(g,b,f)}return 0==f.length?void 0:f}};return{SelectionSliceHit:d,
SelectionCounterSampleHit:c,Selection:a}});"use strict";base.require("event_target");
base.exportTo("tracing",function(){function d(a){this.parentEl_=a;this.scaleX_=1;this.gridTimebase_=this.panX_=0;this.gridStep_=1E3/60;this.hasCalledSetupFunction_=this.gridEnabled_=!1;this.onResizeBoundToThis_=this.onResize_.bind(this);this.checkForAttachInterval_=setInterval(this.checkForAttach_.bind(this),250);this.markers=[]}function c(a,b){this.viewport_=a;this.positionWorld_=b;this.selected_=!1}d.prototype={__proto__:base.EventTarget.prototype,drawUnderContent:function(){},drawOverContent:function(a,
b,f,e){if(this.gridEnabled){var g=this.gridTimebase;for(a.beginPath();g<f;){if(g>=b){var c=this.xWorldToView(g);a.moveTo(c,0);a.lineTo(c,e)}g+=this.gridStep}a.strokeStyle="rgba(255,0,0,0.25)";a.stroke()}for(g=0;g<this.markers.length;++g)this.markers[g].drawLine(a,b,f,e,this)},setWhenPossible:function(a){this.pendingSetFunction_=a},get isAttachedToDocument_(){for(var a=this.parentEl_;a.parentNode;)a=a.parentNode;return a==this.parentEl_.ownerDocument},onResize_:function(){this.dispatchChangeEvent()},
checkForAttach_:function(){if(this.isAttachedToDocument_&&0!=this.clientWidth){this.iframe_||(this.iframe_=document.createElement("iframe"),this.iframe_.style.cssText="position:absolute;width:100%;height:0;border:0;visibility:hidden;",this.parentEl_.appendChild(this.iframe_),this.iframe_.contentWindow.addEventListener("resize",this.onResizeBoundToThis_));var a=this.clientWidth+"x"+this.clientHeight;if(this.pendingSetFunction_){this.lastSize_=a;try{this.pendingSetFunction_()}catch(b){console.log("While running setWhenPossible:",
b)}this.pendingSetFunction_=void 0}window.clearInterval(this.checkForAttachInterval_);this.checkForAttachInterval_=void 0}},dispatchChangeEvent:function(){base.dispatchSimpleEvent(this,"change")},dispatchMarkersChangeEvent_:function(){base.dispatchSimpleEvent(this,"markersChange")},detach:function(){this.checkForAttachInterval_&&(window.clearInterval(this.checkForAttachInterval_),this.checkForAttachInterval_=void 0);this.iframe_&&(this.iframe_.removeEventListener("resize",this.onResizeBoundToThis_),
this.parentEl_.removeChild(this.iframe_))},get scaleX(){return this.scaleX_},set scaleX(a){this.scaleX_!=a&&(this.scaleX_=a,this.dispatchChangeEvent())},get panX(){return this.panX_},set panX(a){this.panX_!=a&&(this.panX_=a,this.dispatchChangeEvent())},setPanAndScale:function(a,b){if(this.scaleX_!=b||this.panX_!=a)this.scaleX_=b,this.panX_=a,this.dispatchChangeEvent()},xWorldToView:function(a){return(a+this.panX_)*this.scaleX_},xWorldVectorToView:function(a){return a*this.scaleX_},xViewToWorld:function(a){return a/
this.scaleX_-this.panX_},xViewVectorToWorld:function(a){return a/this.scaleX_},xPanWorldPosToViewPos:function(a,b,f){if("string"==typeof b)if("left"==b)b=0;else if("center"==b)b=f/2;else if("right"==b)b=f-1;else throw Error("unrecognized string for viewPos. left|center|right");this.panX=b/this.scaleX_-a},xPanWorldBoundsIntoView:function(a,b,f){0>this.xWorldToView(a)?this.xPanWorldPosToViewPos(a,"left",f):this.xWorldToView(b)>f&&this.xPanWorldPosToViewPos(b,"right",f)},xSetWorldBounds:function(a,b,
f){this.setPanAndScale(-a,f/(b-a))},get gridEnabled(){return this.gridEnabled_},set gridEnabled(a){this.gridEnabled_!=a&&(this.gridEnabled_=a&&!0,this.dispatchChangeEvent())},get gridTimebase(){return this.gridTimebase_},set gridTimebase(a){this.gridTimebase_!=a&&(this.gridTimebase_=a,base.dispatchSimpleEvent(this,"change"))},get gridStep(){return this.gridStep_},applyTransformToCanvas:function(a){a.transform(this.scaleX_,0,0,1,this.panX_*this.scaleX_,0)},addMarker:function(a){a=new c(this,a);this.markers.push(a);
this.dispatchChangeEvent();this.dispatchMarkersChangeEvent_();return a},removeMarker:function(a){for(var b=0;b<this.markers.length;++b)if(this.markers[b]===a)return this.markers.splice(b,1),this.dispatchChangeEvent(),this.dispatchMarkersChangeEvent_(),!0},findMarkerNear:function(a,b){for(var f=this.xViewVectorToWorld(b),e=0;e<this.markers.length;++e)if(Math.abs(this.markers[e].positionWorld-a)<=f)return this.markers[e]}};c.prototype={get positionWorld(){return this.positionWorld_},set positionWorld(a){this.positionWorld_=
a;this.viewport_.dispatchChangeEvent()},set selected(a){this.selected_=a;this.viewport_.dispatchChangeEvent()},get selected(){return this.selected_},get color(){return this.selected?"rgb(255,0,0)":"rgb(0,0,0)"},drawTriangle_:function(a,b,f,e,g,c){a.beginPath();var d=this.positionWorld_;d>=b&&d<f&&(b=c.xWorldToView(d),a.moveTo(b,g),a.lineTo(b-3,g/2),a.lineTo(b+3,g/2),a.lineTo(b,g),a.closePath(),a.fillStyle=this.color,a.fill(),g!=e&&(a.beginPath(),a.moveTo(b,g),a.lineTo(b,e),a.closePath(),a.strokeStyle=
this.color,a.stroke()))},drawLine:function(a,b,f,e,g){a.beginPath();var c=this.positionWorld_;c>=b&&c<f&&(b=g.xWorldToView(c),a.moveTo(b,0),a.lineTo(b,e));a.strokeStyle=this.color;a.stroke()}};return{TimelineViewport:d,ViewportMarker:c}});
base.exportTo("tracing.ui",function(){function d(c,a){return(a&&a.ownerDocument?a.ownerDocument:base.doc).createElement(c)}return{decorate:function(c,a){var b;b="string"==typeof c?base.doc.querySelectorAll(c):[c];for(var f=0,e;e=b[f];f++)e instanceof a||a.decorate(e)},define:function(c){function a(e){var g=b(f,e);a.decorate(g);for(var c in e)g[c]=e[c];return g}var b,f;"function"==typeof c?(b=c,f=""):(b=d,f=c);a.decorate=function(b){b.__proto__=a.prototype;b.decorate()};return a},limitInputWidth:function(c,
a,b){function f(){if(c.scrollWidth>l)c.style.width=l+"px";else{c.style.width=0;var a=c.scrollWidth;c.style.width=a<b?b+"px":a+"px"}}c.style.width="10px";var e=c.ownerDocument.defaultView,g=e.getComputedStyle(c),e=e.getComputedStyle(a),j="rtl"==g.direction,d=c.getBoundingClientRect(),k=a.getBoundingClientRect(),d=j?k.right-d.right:d.left-k.left,g=parseInt(g.borderLeftWidth,10)+parseInt(g.paddingLeft,10)+parseInt(g.paddingRight,10)+parseInt(g.borderRightWidth,10),e=j?parseInt(e.paddingLeft,10):parseInt(e.paddingRight,
10),l=a.clientWidth-d-g-e;c.addEventListener("input",f);f()},toCssPx:function(c){window.isFinite(c)||console.error("Pixel value is not a number: "+c);return Math.round(c)+"px"}}});base.requireStylesheet("tracks.track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){},get visible(){return"none"!==this.style.display},set visible(c){this.style.display=c?"":"none"},get numVisibleTracks(){return this.visible?1:0},addControlButtonElements_:function(c){var a=document.createElement("div");a.classList.add("track-button");a.classList.add("track-close-button");a.textContent=String.fromCharCode(215);var b=this;a.addEventListener("click",
function(){b.style.display="None"});this.appendChild(a);var f=document.createElement("div");f.classList.add("track-button");f.classList.add("track-collapse-button");f.textContent="\u2212";var e=!1;f.addEventListener("click",function(){e=!e;this.collapsedDidChange(e);f.textContent=e?"+":"\u2212"});this.appendChild(f);c||(f.style.display="None")}};return{Track:d}});"use strict";base.require("tracks.track");base.require("filter");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.Track);d.prototype={__proto__:tracing.tracks.Track.prototype,decorate:function(){this.categoryFilter_=new tracing.Filter;this.headingWidth_=void 0;this.tracks_=[]},detach:function(){this.detachAllChildren()},detachAllChildren:function(){for(var c=0;c<this.tracks_.length;c++)this.tracks_[c].detach();this.tracks_=[];this.textContent=""},get viewport(){return this.viewport_},set viewport(c){this.viewport_=c;for(var a=0;a<
this.tracks_.length;a++)this.tracks_[a].viewport=c},get firstCanvas(){for(var c=0;c<this.tracks_.length;c++)if(this.tracks_[c].visible)return this.tracks_[c].firstCanvas},get numVisibleTracks(){return!this.visible?0:this.numVisibleChildTracks},get numVisibleChildTracks(){for(var c=0,a=0;a<this.tracks_.length;++a)c+=this.tracks_[a].numVisibleTracks;return c},get headingWidth(){return this.headingWidth_},set headingWidth(c){this.headingWidth_=c;for(var a=0;a<this.tracks_.length;++a)this.tracks_[a].headingWidth=
c},get categoryFilter(){return this.categoryFilter_},set categoryFilter(c){this.categoryFilter_=c;for(var a=0;a<this.tracks_.length;++a)this.tracks_[a].categoryFilter=c;this.applyCategoryFilter_();this.updateFirstVisibleChildCSS()},applyCategoryFilter_:function(){},addTrack_:function(c){c.headingWidth=this.headingWidth_;c.viewport=this.viewport_;c.categoryFilter=this.categoryFilter;this.tracks_.push(c);this.appendChild(c);return c},updateFirstVisibleChildCSS:function(){for(var c=!0,a=0;a<this.tracks_.length;++a){var b=
this.tracks_[a];c&&b.visible?(b.classList.add("first-visible-child"),c=!1):b.classList.remove("first-visible-child")}},addIntersectingItemsToSelection:function(c,a,b){for(var f=0;f<this.tracks_.length;f++){var e=this.tracks_[f].getBoundingClientRect();a>=e.top&&a<e.bottom&&this.tracks_[f].addIntersectingItemsToSelection(c,a,b)}return!1},addIntersectingItemsInRangeToSelection:function(c,a,b,f,e){for(var g=0;g<this.tracks_.length;g++){var j=this.tracks_[g].getBoundingClientRect(),d=Math.max(b,j.top),
j=Math.min(f,j.bottom);d<=j&&this.tracks_[g].addIntersectingItemsInRangeToSelection(c,a,b,f,e)}},addAllObjectsMatchingFilterToSelection:function(c,a){for(var b=0;b<this.tracks_.length;b++)this.tracks_[b].addAllObjectsMatchingFilterToSelection(c,a)}};return{ContainerTrack:d}});
base.exportTo("tracing",function(){function d(c,a,b,f){this.ctx_=c;this.minRectSize_=a;this.maxMergeDist_=b;this.pallette_=f}d.prototype={y_:0,h_:0,merging_:!1,mergeStartX_:0,mergeCurRight_:0,setYandH:function(c,a){this.flush();this.y_=c;this.h_=a},fillRect:function(c,a,b){var f=c+a;a<this.minRectSize_?(f-this.mergeStartX_>this.maxMergeDist_&&this.flush(),this.merging_?(this.mergeCurRight_=f,this.mergedColorId=Math.max(this.mergedColorId,b)):(this.merging_=!0,this.mergeStartX_=c,this.mergeCurRight_=
f,this.mergedColorId=b)):(this.merging_&&this.flush(),this.ctx_.fillStyle=this.pallette_[b],this.ctx_.fillRect(c,this.y_,a,this.h_))},flush:function(){this.merging_&&(this.ctx_.fillStyle=this.pallette_[this.mergedColorId],this.ctx_.fillRect(this.mergeStartX_,this.y_,this.mergeCurRight_-this.mergeStartX_,this.h_),this.merging_=!1)}};return{FastRectRenderer:d}});"use strict";
base.exportTo("tracing",function(){function d(b){for(var a=0,f=0;f<b.length;++f)a=(a+37*a+11*b.charCodeAt(f))%4294967295;return a}var c=[{r:138,g:113,b:152},{r:175,g:112,b:133},{r:127,g:135,b:225},{r:93,g:81,b:137},{r:116,g:143,b:119},{r:178,g:214,b:122},{r:87,g:109,b:147},{r:119,g:155,b:95},{r:114,g:180,b:160},{r:132,g:85,b:103},{r:157,g:210,b:150},{r:148,g:94,b:86},{r:164,g:108,b:138},{r:139,g:191,b:150},{r:110,g:99,b:145},{r:80,g:129,b:109},{r:125,g:140,b:149},{r:93,g:124,b:132},{r:140,g:85,b:140},
{r:104,g:163,b:162},{r:132,g:141,b:178},{r:131,g:105,b:147},{r:135,g:183,b:98},{r:152,g:134,b:177},{r:141,g:188,b:141},{r:133,g:160,b:210},{r:126,g:186,b:148},{r:112,g:198,b:205},{r:180,g:122,b:195},{r:203,g:144,b:152},{r:182,g:125,b:143},{r:126,g:200,b:148},{r:133,g:160,b:210},{r:240,g:240,b:240}],a=c.length-4,b=c.length,f=c.concat(c.map(function(b){var a;a=240<=b.r&&240<=b.g&&240<=b.b?-0.2:0.45;return{r:Math.min(255,b.r+Math.floor(b.r*a)),g:Math.min(255,b.g+Math.floor(b.g*a)),b:Math.min(255,b.b+
Math.floor(b.b*a))}})).map(function(b){return"rgb("+b.r+","+b.g+","+b.b+")"}),e={};return{getColorPalette:function(){return f},getColorPaletteHighlightIdBoost:function(){return b},getColorIdByName:function(b){if("iowait"==b)return a;if("running"==b)return a+1;if("runnable"==b)return a+2;if("sleeping"==b)return a+3;throw Error("Unrecognized color ")+b;},getStringHash:d,getStringColorId:function(b){if(void 0===e[b]){var f=d(b);e[b]=f%a}return e[b]}}});"use strict";base.requireStylesheet("tracks.canvas_based_track");
base.require("tracks.track");base.require("fast_rect_renderer");base.require("color_scheme");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.Track);d.prototype={__proto__:tracing.tracks.Track.prototype,decorate:function(){this.className="canvas-based-track";this.slices_=null;this.headingDiv_=document.createElement("div");this.headingDiv_.className="canvas-based-track-title";this.appendChild(this.headingDiv_);this.canvasContainer_=document.createElement("div");this.canvasContainer_.className="canvas-based-track-canvas-container";this.appendChild(this.canvasContainer_);
this.canvas_=document.createElement("canvas");this.canvas_.className="canvas-based-track-canvas";this.canvasContainer_.appendChild(this.canvas_);this.ctx_=this.canvas_.getContext("2d")},detach:function(){this.viewport_&&(this.viewport_.removeEventListener("change",this.viewportChangeBoundToThis_),this.viewport_.removeEventListener("markersChange",this.viewportMarkersChangeBoundToThis_))},set headingWidth(c){this.headingDiv_.style.width=c},get heading(){return this.headingDiv_.textContent},set heading(c){this.headingDiv_.textContent=
c},set tooltip(c){this.headingDiv_.title=c},get viewport(){return this.viewport_},set viewport(c){if(this.viewport_=c)this.viewport_.removeEventListener("change",this.viewportChangeBoundToThis_),this.viewport_.removeEventListener("markersChange",this.viewportMarkersChangeBoundToThis_);if(this.viewport_=c)this.viewportChangeBoundToThis_=this.viewportChange_.bind(this),this.viewport_.addEventListener("change",this.viewportChangeBoundToThis_),this.viewportMarkersChangeBoundToThis_=this.viewportMarkersChange_.bind(this),
this.viewport_.addEventListener("markersChange",this.viewportMarkersChangeBoundToThis_),this.isAttachedToDocument_&&this.updateCanvasSizeIfNeeded_();this.invalidate()},viewportChange_:function(){this.invalidate()},viewportMarkersChange_:function(){2>this.viewport_.markers.length?this.classList.remove("ruler-track-with-distance-measurements"):this.classList.add("ruler-track-with-distance-measurements")},invalidate:function(){this.rafPending_||(webkitRequestAnimationFrame(function(){this.rafPending_=
!1;this.viewport_&&(this.updateCanvasSizeIfNeeded_(),this.redraw())}.bind(this),this),this.rafPending_=!0)},get isAttachedToDocument_(){var c=this.parentNode;if(c){for(;c.parentNode;)c=c.parentNode;return c==this.ownerDocument}},updateCanvasSizeIfNeeded_:function(){var c=window.getComputedStyle(this.canvasContainer_),a=parseInt(c.width)-parseInt(c.paddingLeft)-parseInt(c.paddingRight)-parseInt(c.borderLeftWidth)-parseInt(c.borderRightWidth),c=parseInt(c.height)-parseInt(c.paddingTop)-parseInt(c.paddingBottom)-
parseInt(c.borderTopWidth)-parseInt(c.borderBottomWidth),b=window.devicePixelRatio||1;this.canvas_.width!=a&&(this.canvas_.width=a*b,this.canvas_.style.width=a+"px");this.canvas_.height!=c&&(this.canvas_.height=c*b,this.canvas_.style.height=c+"px")},get firstCanvas(){return this.canvas_}};return{CanvasBasedTrack:d}});
base.exportTo("tracing",function(){function d(a,b,f){if(0==a.length)return 1;for(var e=0,g=a.length-1,c,d,k=-1;e<=g;)c=Math.floor((e+g)/2),d=b(a[c])-f,0>d?e=c+1:(0<d||(k=c),g=c-1);return-1!=k?k:e}function c(a,b,f,e,g,c){if(0!=a.length&&!(e>g)){var h=d(a,b,e);if(-1!=h&&(0<h&&b(a[h-1])+f(a[h-1])>=e&&c(a[h-1]),h!=a.length))for(f=a.length;h<f&&!(b(a[h])>=g);h++)c(a[h])}}return{findLowIndexInSortedArray:d,findLowIndexInSortedIntervals:function(a,b,f,e){var g=d(a,b,e);return 0==g?e>=b(a[0])&&e<b(a[0]+f(a[0]))?
0:-1:g<=a.length&&e>=b(a[g-1])&&e<b(a[g-1])+f(a[g-1])?g-1:a.length},iterateOverIntersectingIntervals:c,getIntersectingIntervals:function(a,b,f,e,g){var j=[];c(a,b,f,e,g,function(b){j.push(b)});return j}}});"use strict";base.requireStylesheet("tracks.slice_track");base.require("tracks.canvas_based_track");base.require("sorted_array_utils");base.require("fast_rect_renderer");base.require("color_scheme");base.require("ui");
base.exportTo("tracing.tracks",function(){function d(){}function c(b,a){this.string=b;this.width=a}var a=tracing.getColorPalette(),b=tracing.ui.define(tracing.tracks.CanvasBasedTrack);b.prototype={__proto__:tracing.tracks.CanvasBasedTrack.prototype,SHOULD_ELIDE_TEXT:!0,decorate:function(){this.classList.add("slice-track");this.elidedTitleCache=new d;this.asyncStyle_=!1},decorateHit:function(){},get asyncStyle(){return this.asyncStyle_},set asyncStyle(b){this.asyncStyle_=!!b;this.invalidate()},get slices(){return this.slices_},
set slices(b){this.slices_=b||[];b||(this.visible=!1);this.invalidate()},get height(){return window.getComputedStyle(this).height},set height(b){this.style.height=b;this.invalidate()},labelWidth:function(b){var a=e[b];a||(a=this.ctx_.measureText(b).width,e[b]=a);return a+2},labelWidthWorld:function(b,a){return this.labelWidth(b)*a},redraw:function(){var b=this.ctx_,e=this.canvas_.width,g=this.canvas_.height;b.clearRect(0,0,e,g);var c=this.viewport_,d=c.xViewVectorToWorld(1),m=c.xViewToWorld(0),e=
c.xViewToWorld(e);c.drawUnderContent(b,m,e,g);b.save();c.applyTransformToCanvas(b);this.asyncStyle_&&(b.globalAlpha=0.25);var q=new tracing.FastRectRenderer(b,2*d,2*d,a);q.setYandH(0,g);for(var p=this.slices_,r=tracing.findLowIndexInSortedArray(p,function(b){return b.start+b.duration},m),u=r;u<p.length;++u){var s=p[u],w=s.start;if(w>e)break;var v=Math.max(s.duration,0.001),x=s.selected?s.colorId+f:s.colorId;v<d&&(v=d);0<s.duration?q.fillRect(w,v,x):0.001<d?q.fillRect(w,d,x):(b.fillStyle=a[x],b.beginPath(),
b.moveTo(w-4*d,g),b.lineTo(w,0),b.lineTo(w+4*d,g),b.closePath(),b.fill())}q.flush();b.restore();q=window.devicePixelRatio||1;if(8<g){b.textAlign="center";b.textBaseline="top";b.font=10*q+"px sans-serif";b.strokeStyle="rgb(0,0,0)";b.fillStyle="rgb(0,0,0)";w=20*d;v=this.SHOULD_ELIDE_TEXT;for(u=r;u<p.length;++u){s=p[u];if(s.start>e)break;s.duration>w&&(r=s.title,s.didNotFinish&&(r+=" (Did Not Finish)"),x=this.labelWidth(r),v&&this.labelWidthWorld(r,d)>s.duration&&(x=this.elidedTitleCache.get(this,d,
r,x,s.duration),r=x.string,x=x.width),x*d<s.duration&&(s=c.xWorldToView(s.start+0.5*s.duration),b.fillText(r,s,2.5*q,x)))}}c.drawOverContent(b,m,e,g)},addIntersectingItemsToSelection:function(b,a,f){var e=this.getBoundingClientRect();if(a<e.top||a>=e.bottom)return!1;b=this.viewport_.xViewVectorToWorld(b*devicePixelRatio);b=tracing.findLowIndexInSortedIntervals(this.slices_,function(b){return b.start},function(b){return b.duration},b);return 0<=b&&b<this.slices_.length?(f=f.addSlice(this,this.slices_[b]),
this.decorateHit(f),!0):!1},addIntersectingItemsInRangeToSelection:function(b,a,f,e,g){function c(b){b=g.addSlice(p,b);p.decorateHit(b)}var d=window.devicePixelRatio||1;b=this.viewport_.xViewToWorld(b*d);a=this.viewport_.xViewToWorld(a*d);d=this.getBoundingClientRect();f=Math.max(f,d.top);e=Math.min(e,d.bottom);if(!(f>e)){var p=this;tracing.iterateOverIntersectingIntervals(this.slices_,function(b){return b.start},function(b){return b.duration},b,a,c)}},indexOfSlice_:function(b){for(var a=tracing.findLowIndexInSortedArray(this.slices_,
function(b){return b.start},b.start);a<this.slices_.length&&b.start==this.slices_[a].start&&b.colorId!=this.slices_[a].colorId;)a++;return a<this.slices_.length?a:void 0},addItemNearToProvidedHitToSelection:function(b,a,f){if(!b.slice)return!1;b=this.indexOfSlice_(b.slice);if(void 0===b)return!1;a=b+a;if(0>a||a>=this.slices_.length)return!1;b=f.addSlice(this,this.slices_[a]);this.decorateHit(b);return!0},addAllObjectsMatchingFilterToSelection:function(b,a){for(var f=0;f<this.slices_.length;++f)if(b.matchSlice(this.slices_[f])){var e=
a.addSlice(this,this.slices_[f]);this.decorateHit(e)}}};var f=tracing.getColorPaletteHighlightIdBoost(),e={},g={};d.prototype={get:function(b,a,f,e,d){var m=g[f];m||(m={},g[f]=m);e=m[a];e||(m[a]={},e=m[a]);m=e[d];if(void 0===m){for(m=!1;b.labelWidthWorld(f,a)>d;)f=f.substring(0,0.75*f.length),m=!0;m&&3<f.length&&(f=f.substring(0,f.length-3)+"...");m=new c(f,b.labelWidth(f));e[d]=m}return m}};return{SliceTrack:b}});"use strict";"use strict";base.exportTo("tracing",function(){var d=1;return{GUID:{allocate:function(){return d++}}}});
"use strict";base.exportTo("tracing.model",function(){function d(c,a,b,f,e,g){this.category=c||"";this.title=a;this.start=f;this.colorId=b;this.args=e;this.didNotFinish=!1;void 0!==g&&(this.duration=g)}d.prototype={selected:!1,duration:void 0,get end(){return this.start+this.duration}};return{Slice:d}});"use strict";base.require("range");base.require("model.slice");base.require("color_scheme");base.require("filter");
base.exportTo("tracing.model",function(){function d(a){this.sliceConstructor=a||c;this.openPartialSlices_=[];this.slices=[];this.bounds=new base.Range}var c=tracing.model.Slice;d.prototype={__proto__:Object.prototype,get length(){return this.slices.length},pushSlice:function(a){this.slices.push(a);return a},pushSlices:function(a){this.slices.push.apply(this.slices,a)},beginSlice:function(a,b,f,e){if(this.openPartialSlices_.length&&f<this.openPartialSlices_[this.openPartialSlices_.length-1].start)throw Error("Slices must be added in increasing timestamp order");
var g=tracing.getStringColorId(b);a=new this.sliceConstructor(a,b,g,f,e?e:{});this.openPartialSlices_.push(a);return a},isTimestampValidForBeginOrEnd:function(a){return!this.openPartialSlices_.length?!0:a>=this.openPartialSlices_[this.openPartialSlices_.length-1].start},get openSliceCount(){return this.openPartialSlices_.length},endSlice:function(a){if(!this.openSliceCount)throw Error("endSlice called without an open slice");var b=this.openPartialSlices_[this.openSliceCount-1];this.openPartialSlices_.splice(this.openSliceCount-
1,1);if(a<b.start)throw Error("Slice "+b.title+" end time is before its start.");b.duration=a-b.start;this.pushSlice(b);return b},autoCloseOpenSlices:function(a){a||(this.updateBounds(),a=this.bounds.max);for(;0<this.openSliceCount;)this.endSlice(a).didNotFinish=!0},shiftTimestampsForward:function(a){for(var b=0;b<this.slices.length;b++){var f=this.slices[b];f.start+=a}for(b=0;b<this.openPartialSlices_.length;b++)f=this.openPartialSlices_[i],f.start+=a},updateBounds:function(){this.bounds.reset();
for(var a=0;a<this.slices.length;a++)this.bounds.addValue(this.slices[a].start),this.bounds.addValue(this.slices[a].end);this.openPartialSlices_.length&&(this.bounds.addValue(this.openPartialSlices_[0].start),this.bounds.addValue(this.openPartialSlices_[this.openPartialSlices_.length-1].start))},copySlice:function(a){var b=new this.sliceConstructor(a.category,a.title,a.colorId,a.start,a.args,a.duration);b.didNotFinish=a.didNotFinish;return b}};d.merge=function(a,b){if(0<a.openPartialSlices_.length)throw Error("groupA has open partial slices");
if(0<b.openPartialSlices_.length)throw Error("groupB has open partial slices");for(var f=new d,e=a.slices,g=b.slices,c=e.length-1,h=g.length-1,k=[],l=[],t=function(b){for(var a=0;a<l.length;a++){var e=l[a],g=e.end;if(b<e.start||g<b)throw Error("slice should not be split");var c=f.copySlice(e);e.start=b;e.duration=g-b;e.title+=" (cont.)";c.duration=b-c.start;l[a]=c;f.pushSlice(c)}},m=function(b){for(;0<k.length||0<l.length;){var a=k[k.length-1],f=l[l.length-1],a=a&&a.start,f=f&&f.start;if((void 0===
a||a<b)&&(void 0===f||f<b))break;void 0===f||a>f?(t(a),k.pop()):l.pop()}};0<=c||0<=h;){var q=e[c],p=g[h];void 0===q||void 0!==p&&q.end<p.end?(q=f.copySlice(p),p=!0,h--):(q=f.copySlice(q),p=!1,c--);m(q.end);f.pushSlice(q);p?l.push(q):(t(q.end),k.push(q))}m();f.slices.reverse();return f};return{SliceGroup:d}});"use strict";base.require("range");base.require("model.slice");
base.exportTo("tracing.model",function(){function d(b,f,e,g,c){a.call(this,b,f,e,g,c)}function c(){this.slices=[];this.bounds=new base.Range}var a=tracing.model.Slice;d.prototype={__proto__:a.prototype,toJSON:function(){for(var b={},a=Object.keys(this),e=0;e<a.length;e++){var g=a[e];"function"!=typeof this[g]&&(b[g]="startThread"==g||"endThread"==g?this[g].guid:this[g])}return b},id:void 0,startThread:void 0,endThread:void 0,subSlices:void 0};c.prototype={__proto__:Object.prototype,push:function(b){this.slices.push(b)},
get length(){return this.slices.length},shiftTimestampsForward:function(b){for(var a=0;a<this.slices.length;a++){var e=this.slices[a];e.start+=b;for(var g=0;g<e.subSlices.length;g++)e.subSlices[g].start+=b}},updateBounds:function(){this.bounds.reset();for(var b=0;b<this.slices.length;b++)this.bounds.addValue(this.slices[b].start),this.bounds.addValue(this.slices[b].end)},computeSubGroups:function(){for(var b={},a=0;a<this.slices.length;++a){var e=this.slices[a],g=e.startThread.guid;b[g]||(b[g]=new c);
b[g].slices.push(e)}var a=[],d;for(d in b)e=b[d],e.updateBounds(),a.push(e);return a}};return{AsyncSlice:d,AsyncSliceGroup:c}});"use strict";base.exportTo("tracing.model",function(){function d(c,a,b,f,e){this.category=c||"";this.title=a;this.colorId=b;this.start=f;this.args=e}d.prototype={selected:!1,duration:0,get end(){return this.start}};return{Sample:d}});"use strict";base.require("range");base.require("guid");base.require("model.slice");base.require("model.slice_group");base.require("model.async_slice_group");
base.require("model.sample");
base.exportTo("tracing.model",function(){function d(b,f,c,d,k,l){a.call(this,b,f,c,d,k,l);this.subSlices=[]}function c(a,g){b.call(this,d);this.guid_=tracing.GUID.allocate();if(!a)throw Error("Parent must be provided.");this.parent=a;this.tid=g;this.cpuSlices=void 0;this.samples_=[];this.kernelSlices=new b;this.asyncSlices=new f;this.bounds=new base.Range}var a=tracing.model.Slice,b=tracing.model.SliceGroup,f=tracing.model.AsyncSliceGroup;d.prototype={__proto__:a.prototype};c.prototype={__proto__:b.prototype,
get guid(){return this.guid_},compareTo:function(b){return c.compare(this,b)},toJSON:function(){for(var b={},a=Object.keys(this),f=0;f<a.length;f++){var c=a[f];"function"!=typeof this[c]&&(b[c]="parent"==c?this[c].guid:this[c])}return b},addSample:function(b,a,f,c){if(this.samples_.length&&f<this.samples_[this.samples_.length-1].start)throw Error("Samples must be added in increasing timestamp order.");var d=tracing.getStringColorId(a);b=new tracing.model.Sample(b,a,d,f,c?c:{});this.samples_.push(b);
return b},get samples(){return this.samples_},name:void 0,shiftTimestampsForward:function(a){b.prototype.shiftTimestampsForward.call(this,a);if(this.cpuSlices)for(var f=0;f<this.cpuSlices.length;f++)this.cpuSlices[f].start+=a;if(this.samples_.length)for(f=0;f<this.samples_.length;f++)this.samples_[f].start+=a;this.kernelSlices.shiftTimestampsForward(a);this.asyncSlices.shiftTimestampsForward(a)},get isEmpty(){return this.slices.length||this.openSliceCount||this.cpuSlices&&this.cpuSlices.length||this.kernelSlices.length||
this.asyncSlices.length||this.samples_.length?!1:!0},updateBounds:function(){b.prototype.updateBounds.call(this);this.kernelSlices.updateBounds();this.bounds.addRange(this.kernelSlices.bounds);this.asyncSlices.updateBounds();this.bounds.addRange(this.asyncSlices.bounds);this.cpuSlices&&this.cpuSlices.length&&(this.bounds.addValue(this.cpuSlices[0].start),this.bounds.addValue(this.cpuSlices[this.cpuSlices.length-1].end));this.samples_.length&&(this.bounds.addValue(this.samples_[0].start),this.bounds.addValue(this.samples_[this.samples_.length-
1].end))},addCategoriesToDict:function(b){for(var a=0;a<this.slices.length;a++)b[this.slices[a].category]=!0;for(a=0;a<this.kernelSlices.length;a++)b[this.kernelSlices.slices[a].category]=!0;for(a=0;a<this.asyncSlices.length;a++)b[this.asyncSlices.slices[a].category]=!0;for(a=0;a<this.samples_.length;a++)b[this.samples_[a].category]=!0},mergeKernelWithUserland:function(){0<this.kernelSlices.length&&(this.slices=b.merge(this,this.kernelSlices).slices,this.kernelSlices=new b,this.updateBounds())},get userFriendlyName(){return this.parent.userFriendlyName+
": "+(this.name||this.tid)},get userFriendlyDetails(){return this.parent.userFriendlyDetails+", tid: "+this.tid+(this.name?", name: "+this.name:"")}};c.compare=function(b,a){var f=b.parent.compareTo(a.parent);return 0!=f?f:b.name&&a.name?(f=b.name.localeCompare(a.name),0==f?b.tid-a.tid:f):b.name?-1:a.name?1:b.tid-a.tid};return{ThreadSlice:d,Thread:c}});"use strict";base.require("guid");base.require("range");
base.exportTo("tracing.model",function(){function d(c,a,b,f){this.guid_=tracing.GUID.allocate();this.parent=c;this.id=a;this.category=b||"";this.name=f;this.seriesNames=[];this.seriesColors=[];this.timestamps=[];this.samples=[];this.bounds=new base.Range}d.prototype={__proto__:Object.prototype,get guid(){return this.guid_},toJSON:function(){for(var c={},a=Object.keys(this),b=0;b<a.length;b++){var f=a[b];"function"!=typeof this[f]&&(c[f]="parent"==f?this[f].guid:this[f])}return c},get numSeries(){return this.seriesNames.length},
get numSamples(){return this.timestamps.length},getSampleValue:function(c,a){return this.samples[c*this.numSeries+a]},getSampleStatistics:function(c){c.sort();for(var a=this.numSeries,b=[],f=0;f<a;++f){for(var e=0,g=Number.MAX_VALUE,d=-Number.MAX_VALUE,h=0;h<c.length;h++)var k=c[h],e=e+this.getSampleValue(k,f),g=Math.min(this.getSampleValue(k,f),g),d=Math.max(this.getSampleValue(k,f),d);e/=c.length;h=this.getSampleValue(c[0],f);k=this.getSampleValue(c[c.length-1],f);b.push({min:g,max:d,avg:e,start:h,
end:k})}return b},shiftTimestampsForward:function(c){for(var a=0;a<this.timestamps.length;a++)this.timestamps[a]+=c},updateBounds:function(){if(this.seriesNames.length!=this.seriesColors.length)throw Error("seriesNames.length must match seriesColors.length");if(this.numSeries*this.numSamples!=this.samples.length)throw Error("samples.length must be a multiple of numSamples.");this.totals=[];this.maxTotal=0;this.bounds.reset();if(0!=this.samples.length){this.bounds.addValue(this.timestamps[0]);this.bounds.addValue(this.timestamps[this.timestamps.length-
1]);for(var c=this.numSeries,a=-Infinity,b=0;b<this.timestamps.length;b++){for(var f=0,e=0;e<c;e++)f+=this.samples[b*c+e],this.totals.push(f);f>a&&(a=f)}this.maxTotal=a}}};d.compare=function(c,a){var b=c.parent.compareTo(a);if(0!=b)return b;b=c.name.localeCompare(a.name);return 0==b?c.tid-a.tid:b};return{Counter:d}});"use strict";base.require("range");base.require("guid");base.require("model.thread");base.require("model.counter");
base.exportTo("tracing.model",function(){function d(){this.guid_=tracing.GUID.allocate();this.threads={};this.counters={};this.bounds=new base.Range}var c=tracing.model.Thread,a=tracing.model.Counter;d.prototype={get guid(){return this.guid_},get numThreads(){var b=0,a;for(a in this.threads)b++;return b},shiftTimestampsForward:function(b){for(var a in this.threads)this.threads[a].shiftTimestampsForward(b);for(var e in this.counters)this.counters[e].shiftTimestampsForward(b)},autoCloseOpenSlices:function(b){for(var a in this.threads)this.threads[a].autoCloseOpenSlices(b)},
mergeKernelWithUserland:function(){for(var b in this.threads)this.threads[b].mergeKernelWithUserland()},updateBounds:function(){this.bounds.reset();for(var b in this.threads)this.threads[b].updateBounds(),this.bounds.addRange(this.threads[b].bounds);for(var a in this.counters)this.counters[a].updateBounds(),this.bounds.addRange(this.counters[a].bounds)},addCategoriesToDict:function(b){for(var a in this.threads)this.threads[a].addCategoriesToDict(b);for(var e in this.counters)b[this.counters[e].category]=
!0},findAllThreadsNamed:function(b){var a=[],e;for(e in this.threads){var c=this.threads[e];c.name==b&&a.push(c)}return a},pruneEmptyContainers:function(){var b={},a;for(a in this.threads){var e=this.threads[a];e.isEmpty||(b[a]=e)}this.threads=b},getOrCreateThread:function(b){this.threads[b]||(this.threads[b]=new c(this,b));return this.threads[b]},getOrCreateCounter:function(b,f){var e=b+"."+f;this.counters[e]||(this.counters[e]=new a(this,e,b,f));return this.counters[e]}};return{ProcessBase:d}});
"use strict";base.require("model.process_base");base.exportTo("tracing.model",function(){function d(c){tracing.model.ProcessBase.call(this);this.pid=c}d.compare=function(c,a){return c.pid-a.pid};d.prototype={__proto__:tracing.model.ProcessBase.prototype,compareTo:function(c){return d.compare(this,c)},get userFriendlyName(){return this.pid},get userFriendlyDetails(){return"pid: "+this.pid}};return{Process:d}});"use strict";base.require("model.process_base");
base.exportTo("tracing.model",function(){function d(){tracing.model.ProcessBase.call(this)}d.compare=function(){return 0};d.prototype={__proto__:tracing.model.ProcessBase.prototype,compareTo:function(c){return d.compare(this,c)},get userFriendlyName(){return"kernel"},get userFriendlyDetails(){return"kernel"}};return{Kernel:d}});"use strict";base.require("range");base.require("model.slice");base.require("model.counter");
base.exportTo("tracing.model",function(){function d(a){this.cpuNumber=a;this.slices=[];this.counters={};this.bounds=new base.Range}var c=tracing.model.Counter;d.prototype={getOrCreateCounter:function(a,b){var f;f=a.length?a+"."+b:b;this.counters[f]||(this.counters[f]=new c(this,f,a,b));return this.counters[f]},shiftTimestampsForward:function(a){for(var b=0;b<this.slices.length;b++)this.slices[b].start+=a;for(var f in this.counters)this.counters[f].shiftTimestampsForward(a)},updateBounds:function(){this.bounds.reset();
this.slices.length&&(this.bounds.addValue(this.slices[0].start),this.bounds.addValue(this.slices[this.slices.length-1].end));for(var a in this.counters)this.counters[a].updateBounds(),this.bounds.addRange(this.counters[a].bounds)},addCategoriesToDict:function(a){for(var b=0;b<this.slices.length;b++)a[this.slices[b].category]=!0;for(var f in this.counters)a[this.counters[f].category]=!0}};d.compare=function(a,b){return a.cpuNumber-b.cpuNumber};return{Cpu:d}});"use strict";base.require("range");base.require("event_target");
base.require("model.process");base.require("model.kernel");base.require("model.cpu");base.require("filter");
base.exportTo("tracing",function(){function d(a,f){this.kernel=new b;this.cpus={};this.processes={};this.importErrors=[];this.metadata=[];this.categories=[];this.bounds=new base.Range;a&&this.importTraces([a],f)}function c(){this.importPriority=0}var a=tracing.model.Process,b=tracing.model.Kernel,f=tracing.model.Cpu,e=[];d.registerImporter=function(b){e.push(b)};d.prototype={__proto__:base.EventTarget.prototype,get numProcesses(){var b=0,a;for(a in this.processes)b++;return b},getOrCreateCpu:function(b){this.cpus[b]||
(this.cpus[b]=new f(b));return this.cpus[b]},getOrCreateProcess:function(b){this.processes[b]||(this.processes[b]=new a(b));return this.processes[b]},updateCategories_:function(){var b={};this.kernel.addCategoriesToDict(b);for(var a in this.processes)this.processes[a].addCategoriesToDict(b);for(var f in this.cpus)this.cpus[f].addCategoriesToDict(b);this.categories=[];for(var e in b)""!=e&&this.categories.push(e)},updateBounds:function(){this.bounds.reset();this.kernel.updateBounds();this.bounds.addRange(this.kernel.bounds);
for(var b in this.processes)this.processes[b].updateBounds(),this.bounds.addRange(this.processes[b].bounds);for(var a in this.cpus)this.cpus[a].updateBounds(),this.bounds.addRange(this.cpus[a].bounds)},shiftWorldToZero:function(){if(!this.bounds.isEmpty){var b=this.bounds.min;this.kernel.shiftTimestampsForward(-b);for(var a in this.processes)this.processes[a].shiftTimestampsForward(-b);for(var f in this.cpus)this.cpus[f].shiftTimestampsForward(-b);this.updateBounds()}},getAllThreads:function(){var b=
[],a;for(a in this.kernel.threads)b.push(e.threads[a]);for(var f in this.processes){var e=this.processes[f];for(a in e.threads)b.push(e.threads[a])}return b},getAllCpus:function(){var b=[],a;for(a in this.cpus)b.push(this.cpus[a]);return b},getAllProcesses:function(){var b=[],a;for(a in this.processes)b.push(this.processes[a]);return b},getAllCounters:function(){var b=[],a;for(a in this.processes){var f=this.processes[a],e;for(e in f.counters)b.push(f.counters[e])}for(var c in this.cpus){a=this.cpus[c];
for(var d in a.counters)b.push(a.counters[d])}return b},findAllThreadsNamed:function(b){var a=[];a.push.apply(a,this.kernel.findAllThreadsNamed(b));for(var f in this.processes)a.push.apply(a,this.processes[f].findAllThreadsNamed(b));return a},createImporter_:function(b){for(var a,f=0;f<e.length;++f)if(e[f].canImport(b)){a=e[f];break}if(!a)throw Error("Could not find an importer for the provided eventData.");return new a(this,b)},importTraces:function(b,a){void 0===a&&(a=!0);for(var f=[],e=0;e<b.length;++e)f.push(this.createImporter_(b[e]));
f.sort(function(b,a){return b.importPriority-a.importPriority});for(e=0;e<f.length;e++)f[e].importEvents(0<e);this.updateBounds();this.kernel.autoCloseOpenSlices(this.bounds.max);for(var c in this.processes)this.processes[c].autoCloseOpenSlices(this.bounds.max);for(e=0;e<f.length;e++)f[e].finalizeImport();this.kernel.pruneEmptyContainers();for(c in this.processes)this.processes[c].pruneEmptyContainers();for(c in this.processes)this.processes[c].mergeKernelWithUserland();this.updateBounds();this.updateCategories_();
a&&this.shiftWorldToZero()}};c.canImport=function(b){return b instanceof Array&&0==b.length?!0:"string"===typeof b||b instanceof String?0==b.length:!1};c.prototype={__proto__:Object.prototype,importEvents:function(){},finalizeImport:function(){}};d.registerImporter(c);return{Model:d}});"use strict";base.require("tracks.container_track");base.require("tracks.slice_track");base.require("filter");base.require("model");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(){this.classList.add("cpu-track")},get cpu(){return this.cpu_},set cpu(c){this.cpu_=c;this.updateChildTracks_()},get tooltip(){return this.tooltip_},set tooltip(c){this.tooltip_=c;this.updateChildTracks_()},get heading(){return this.heading_},set heading(c){this.heading_=c;this.updateChildTracks_()},applyCategoryFilter_:function(){this.categoryFilter.matchCpu(this.cpu_)?
this.updateChildTracks_():this.visible=!1},updateChildTracks_:function(){this.detach();if(this.cpu_){var c=tracing.filterSliceArray(this.categoryFilter_,this.cpu_.slices);if(c.length){var a=new tracing.tracks.SliceTrack;a.slices=c;a.heading=this.heading_;a.tooltip=this.tooltip_;this.addTrack_(a)}for(var b in this.cpu_.counters)c=this.cpu_.counters[b],a=new tracing.tracks.CounterTrack,a.heading="CPU "+this.cpu_.cpuNumber+" "+c.name+":",a.counter=c,this.addTrack_(a)}this.addControlButtonElements_(!1)}};
return{CpuTrack:d}});"use strict";base.requireStylesheet("tracks.counter_track");base.require("tracks.canvas_based_track");base.require("color_scheme");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.getColorPalette(),c=tracing.ui.define(tracing.tracks.CanvasBasedTrack);c.prototype={__proto__:tracing.tracks.CanvasBasedTrack.prototype,decorate:function(){this.classList.add("counter-track");this.addControlButtonElements_(!1);this.selectedSamples_={};this.categoryFilter_=new tracing.Filter},decorateHit:function(){},get counter(){return this.counter_},set counter(a){this.counter_=a;this.invalidate();this.updateVisibility_()},set categoryFilter(a){this.categoryFilter_=
a;this.updateVisibility_()},get selectedSamples(){return this.selectedSamples_},updateVisibility_:function(){this.visible=this.counter_&&this.categoryFilter_.matchCounter(this.counter_)},redraw:function(){var a=this.counter_,b=this.ctx_,f=this.canvas_.width,e=this.canvas_.height;b.clearRect(0,0,f,e);var c=this.viewport_,j=c.xViewVectorToWorld(1),h=c.xViewToWorld(0),f=c.xViewToWorld(f);c.drawUnderContent(b,h,f,e);var k=c.xViewVectorToWorld(1);b.save();c.applyTransformToCanvas(b);for(var l=a.numSeries,
t=a.numSamples,m=tracing.findLowIndexInSortedArray(a.timestamps,function(b){return b},h),m=0<m-1?m-1:0,q=e/a.maxTotal,p=a.numSeries-1;0<=p;p--){b.fillStyle=d[a.seriesColors[p]];b.beginPath();for(var r=m-1,u=0<=r?a.timestamps[r]-k:-1,s=e,w=!1;;){var v=r+1;if(v>=t){b.lineTo(u,s);b.lineTo(u+8*j,s);b.lineTo(u+8*j,e);break}var x=a.timestamps[v],y=a.totals[v*l+p],y=e-q*y;if(x>f){b.lineTo(x,s);b.lineTo(x,e);break}if(v+1<t&&(r=a.timestamps[v+1],r-u<=k&&r<f)){r=v;continue}w||(b.moveTo(h,e),w=!0);x-u<k&&(x=
u+k);b.lineTo(x,s);b.lineTo(x,y);r=v;u=x;s=y}b.closePath();b.fill()}b.fillStyle="rgba(255, 0, 0, 1)";for(v in this.selectedSamples_)if(this.selectedSamples_[v]){x=a.timestamps[v];for(p=a.numSeries-1;0<=p;p--)y=a.totals[v*l+p],y=e-q*y,b.fillRect(x-j,y-1,3*j,3)}b.restore();c.drawOverContent(b,h,f,e)},addIntersectingItemsToSelection:function(a,b,f){var e=this.getBoundingClientRect();if(b<e.top||b>=e.bottom)return!1;b=this.viewport_.xViewVectorToWorld(a*devicePixelRatio);e=this.counter_;if(a<this.counter_.timestamps[0])return!1;
a=tracing.findLowIndexInSortedArray(e.timestamps,function(b){return b},b);if(0>a||a>=e.timestamps.length)return!1;0<a&&b>this.counter_.timestamps[a-1]&&a--;this.getBoundingClientRect();f=f.addCounterSample(this,this.counter,a);this.decorateHit(f);return!0},addIntersectingItemsInRangeToSelection:function(a,b,f,e,c){var d=this.getBoundingClientRect();f=Math.max(f,d.top);e=Math.min(e,d.bottom);if(!(f>e)){e=this.counter_;d=window.devicePixelRatio||1;a=this.viewport_.xViewToWorld(a*d);d=this.viewport_.xViewToWorld(b*
d);f=tracing.findLowIndexInSortedArray(e.timestamps,function(b){return b},a);b=tracing.findLowIndexInSortedArray(e.timestamps,function(b){return b},d);0<f&&a>e.timestamps[f-1]&&f--;0<b&&d>e.timestamps[b-1]&&b--;for(a=f;a<=b;a++)a>=e.timestamps.length||(d=c.addCounterSample(this,this.counter,a),this.decorateHit(d))}},addAllObjectsMatchingFilterToSelection:function(){}};return{CounterTrack:c}});"use strict";base.require("tracks.container_track");base.require("sorted_array_utils");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(){this.classList.add("slice-group-track")},get group(){return this.group_},set group(c){this.group_=c;this.updateChildTracks_()},set heading(c){this.tracks_.length&&(this.tracks_[0].heading=c)},set tooltip(c){this.tracks_.length&&(this.tracks_[0].tooltip=c)},set decorateHit(c){this.decorateHit_=c;this.updateChildTracks_()},
applyCategoryFilter_:function(){this.updateChildTracks_()},addSliceTrack_:function(c){var a=new tracing.tracks.SliceTrack;a.slices=c;a.decorateHit=this.decorateHit_;this.addTrack_(a);return a},updateChildTracks_:function(){if(this.group_){var c=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);if(c.length){if(this.visible=!0,!this.areArrayContentsSame_(this.filteredSlices_,c)){this.filteredSlices_=c;this.detach();this.subRows_=this.buildSubRows_(c);for(c=0;c<this.subRows_.length;c++)this.subRows_[c].length&&
this.addSliceTrack_(this.subRows_[c])}}else this.visible=!1}else this.visible=!1},buildSubRows_:function(c){if(!c.length)return[];for(var a=[],b=0;b<c.length;b++)c[b].subSlices&&c[b].subSlices.splice(0,c[b].subSlices.length),a.push(b);a.sort(function(b,a){var f=c[b],e=c[a];return f.start!=e.start?f.start-e.start:a-b});var f=[[]];this.badSlices_=[];for(b=0;b<a.length;b++){for(var e=c[a[b]],g=!1,d=f.length-1;0<=d;d--)if(0!=f[d].length){var h=f[d][f[d].length-1];e.start<h.start&&(this.badSlices_.push(e),
g=!0);if(e.start>=h.start&&e.end<=h.end){for(;f.length<=d+1;)f.push([]);f[d+1].push(e);h.subSlices&&h.subSlices.push(e);g=!0;break}}g||f[0].push(e)}return f},areArrayContentsSame_:function(c,a){if(!c||!a||(!c.length||!a.length)||c.length!=a.length)return!1;for(var b=0;b<c.length;++b)if(c[b]!=a[b])return!1;return!0}};return{SliceGroupTrack:d}});"use strict";base.require("tracks.slice_group_track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.SliceGroupTrack);d.prototype={__proto__:tracing.tracks.SliceGroupTrack.prototype,decorate:function(){this.classList.add("async-slice-group-track")},addSliceTrack_:function(c){c=tracing.tracks.SliceGroupTrack.prototype.addSliceTrack_.call(this,c);c.asyncStyle=!0;return c},buildSubRows_:function(){var c=tracing.filterSliceArray(this.categoryFilter,this.group_.slices);c.sort(function(b,a){return b.start-a.start});for(var a=
[],b=0;b<c.length;b++){for(var f=c[b],e=!1,g=0;g<a.length;g++){var d=a[g];if(f.start>=d[d.length-1].end){e=!0;if(void 0===f.subSlices||1>f.subSlices.length)throw Error("AsyncEvent missing subSlices: ")+f.name;for(g=0;g<f.subSlices.length;g++)d.push(f.subSlices[g]);break}}if(!e&&(d=[],void 0!==f.subSlices)){for(g=0;g<f.subSlices.length;g++)d.push(f.subSlices[g]);a.push(d)}}return a}};return{AsyncSliceGroupTrack:d}});"use strict";base.requireStylesheet("tracks.thread_track");base.require("tracks.container_track");
base.require("tracks.slice_track");base.require("tracks.slice_group_track");base.require("tracks.async_slice_group_track");base.require("filter");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(){this.classList.add("thread-track");this.categoryFilter_=new tracing.Filter},get thread(){return this.thread_},set thread(c){this.thread_=c;this.updateChildTracks_()},get tooltip(){return this.tooltip_},set tooltip(c){this.tooltip_=c;this.updateChildTracks_()},get heading(){return this.heading_},set heading(c){this.heading_=
c;this.updateChildTracks_()},applyCategoryFilter_:function(){this.updateVisibility_()},updateChildTracks_:function(){this.detach();if(this.thread_){var c=new tracing.tracks.SliceTrack;c.heading="";c.slices=this.thread_.cpuSlices;c.height="4px";c.decorateHit=function(a){a.thread=this.thread_};this.addTrack_(c);c=new tracing.tracks.AsyncSliceGroupTrack;c.categoryFilter=this.categoryFilter;c.decorateHit=function(){};c.group=this.thread_.asyncSlices;this.addTrack_(c);c=new tracing.tracks.SliceGroupTrack;
c.decorateHit=function(a){a.thread=this.thread_};c.group=this.thread_;this.addTrack_(c);this.thread_.samples.length&&(c=new tracing.tracks.SliceTrack,c.group=this.thread_,c.slices=this.thread_.samples,c.decorateHit=function(a){a.thread=this.thread_},this.addTrack_(c));this.updateVisibility_()}this.addControlButtonElements_(4<=this.tracks_.length)},updateVisibility_:function(){if(this.categoryFilter.matchThread(this.thread)){for(var c=!1,a=0;a<this.tracks_.length;++a){var b=this.tracks_[a];if(b.visible&&
(c=!0,1<=a)){b.heading=this.heading_;b.tooltip=this.tooltip_;break}}this.visible=c}else this.visible=!1},collapsedDidChange:function(c){if(c){c=parseInt(this.tracks_[0].height);for(var a=0;a<this.tracks_.length;++a)2<c?this.tracks_[a].height=Math.floor(c)+"px":this.tracks_[a].style.display="none",c*=0.5}else for(a=0;a<this.tracks_.length;++a)this.tracks_[a].height=this.tracks_[0].height,this.tracks_[a].style.display=""}};return{ThreadTrack:d}});"use strict";base.require("tracks.container_track");
base.require("tracks.counter_track");base.require("tracks.thread_track");base.require("filter");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(){this.classList.add("process-track");this.categoryFilter_=new tracing.Filter},get process(){return this.process_},set process(c){this.process_=c;this.updateChildTracks_()},applyCategoryFilter_:function(){this.visible=this.categoryFilter.matchProcess(this.process)&&!!this.numVisibleChildTracks},updateChildTracks_:function(){this.detach();
if(this.process_){var c=[],a;for(a in this.process.counters)c.push(this.process.counters[a]);c.sort(tracing.model.Counter.compare);c.forEach(function(b){var a=new tracing.tracks.CounterTrack;a.heading=b.name+":";a.counter=b;this.addTrack_(a)}.bind(this));c=[];for(a in this.process.threads)c.push(this.process.threads[a]);c.sort(tracing.model.Thread.compare);c.forEach(function(b){var a=new tracing.tracks.ThreadTrack;a.heading=b.userFriendlyName+":";a.tooltip=b.userFriendlyDetails;a.thread=b;this.addTrack_(a)}.bind(this))}}};
return{ProcessTrack:d}});"use strict";base.requireStylesheet("tracks.model_track");base.require("tracks.container_track");base.require("tracks.cpu_track");base.require("tracks.process_track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.ContainerTrack);d.prototype={__proto__:tracing.tracks.ContainerTrack.prototype,decorate:function(){this.classList.add("model-track");this.measuringStick_=new tracing.MeasuringStick;this.measuringStick_.attach()},detach:function(){tracing.tracks.ContainerTrack.prototype.detach.call(this);this.measuringStick_.detach()},get model(){return this.model_},set model(c){this.model_=c;this.updateHeadingWidth_();this.updateChildTracks_()},
updateHeadingWidth_:function(){var c=[];this.model.getAllThreads().forEach(function(b){c.push(b.userFriendlyName)});this.model.getAllCounters().forEach(function(b){c.push(b.name)});this.model.getAllCpus().forEach(function(b){c.push("CPU "+b.cpuNumber)});var a=0,b=document.createElement("div");b.style.position="fixed";b.className="canvas-based-track-title";for(var f=0;f<c.length;f++){b.textContent=c[f]+":__";var e=this.measuringStick_.measure(b).width;300<e&&(e=300);e>a&&(a=e)}this.headingWidth=a+
"px"},updateChildTracks_:function(){this.detachAllChildren();if(this.model_){var c=this.model_.getAllCpus();c.sort(tracing.model.Cpu.compare);for(var a=0;a<c.length;++a){var b=c[a],f=new tracing.tracks.CpuTrack;f.heading="CPU "+b.cpuNumber+":";f.cpu=b;this.addTrack_(f)}c=this.model_.getAllProcesses();c.sort(tracing.model.Process.compare);for(a=0;a<c.length;++a)b=c[a],f=new tracing.tracks.ProcessTrack,f.process=b,this.addTrack_(f)}}};return{ModelTrack:d}});"use strict";base.requireStylesheet("tracks.ruler_track");
base.require("tracks.track");base.require("tracks.canvas_based_track");base.require("ui");
base.exportTo("tracing.tracks",function(){var d=tracing.ui.define(tracing.tracks.CanvasBasedTrack),c=Math.log(10);d.prototype={__proto__:tracing.tracks.CanvasBasedTrack.prototype,decorate:function(){this.classList.add("ruler-track");this.strings_secs_=[];this.strings_msecs_=[];this.addEventListener("mousedown",this.onMouseDown)},onMouseDown:function(a){0==a.button&&this.placeAndBeginDraggingMarker(a.clientX)},placeAndBeginDraggingMarker:function(a){var b=window.devicePixelRatio||1;a=this.viewport_.xViewToWorld((a-
this.canvasContainer_.offsetLeft)*b);var f=this.viewport_.findMarkerNear(a,6),e=!1,c=!1;f||(f=this.viewport_.addMarker(a),e=!0);f.selected=!0;var d=this,h=function(a){a=d.viewport_.xViewToWorld((a.clientX-d.canvasContainer_.offsetLeft)*b);f.positionWorld=a;c=!0},k=function(){f.selected=!1;!c&&!e&&d.viewport_.removeMarker(f);document.removeEventListener("mouseup",k);document.removeEventListener("mousemove",h)};document.addEventListener("mouseup",k);document.addEventListener("mousemove",h)},drawLine_:function(a,
b,f,e,c,d){a.beginPath();a.moveTo(b,f);a.lineTo(e,c);a.closePath();a.strokeStyle=d;a.stroke()},drawArrow_:function(a,b,f,e,c,d,h){this.drawLine_(a,b,f,e,c,h);var k=e-b,l=c-f,t=Math.sqrt(k*k+l*l),m=(t-10)/t;b+=m*k;f+=m*l;l=l/t*d;d*=-(k/t);a.beginPath();a.fillStyle=h;a.moveTo(b+l,f+d);a.lineTo(e,c);a.lineTo(b-l,f-d);a.lineTo(b+l,f+d);a.closePath();a.fill()},redraw:function(){var a=this.ctx_,b=this.canvas_.width,f=this.canvas_.height;a.clearRect(0,0,b,f);var e=this.viewport_;e.xViewVectorToWorld(1);
for(var g=e.xViewToWorld(0),d=e.xViewToWorld(b),h=this.classList.contains("ruler-track-with-distance-measurements"),k=h?f/2:f,l=0;l<e.markers.length;++l)e.markers[l].drawTriangle_(a,g,d,f,k,e);var t=window.devicePixelRatio||1,m=150*t,l=e.xViewVectorToWorld(m),q,p,r;p=Math.pow(10,Math.ceil(Math.log(l)/c));t=[10,5,2,1];for(l=0;l<t.length;++l)if(!(e.xWorldVectorToView(p/t[l])<m)){q=p/t[l-1];break}r=void 0;100>q?(m="ms",p=1,r=this.strings_msecs_):(m="s",p=1E3,r=this.strings_secs_);var u=e.xWorldVectorToView(q/
5),l=Math.floor(g/q)*q,f=Math.floor(0.25*f);a.fillStyle="rgb(0, 0, 0)";a.strokeStyle="rgb(0, 0, 0)";a.textAlign="left";a.textBaseline="top";t=window.devicePixelRatio||1;a.font=9*t+"px sans-serif";for(g=l;g<d;g+=q){var s=Math.floor(e.xWorldToView(g)),l=Math.floor(1E5*(g/p))/1E5;r[l]||(r[l]=l+" "+m);a.fillText(r[l],s+2*t,0);a.beginPath();a.moveTo(s,0);a.lineTo(s,k);for(l=1;5>l;++l){var w=Math.floor(s+u*l);a.moveTo(w,k-f);a.lineTo(w,k)}a.stroke()}if(h){a.moveTo(0,k);a.lineTo(b,k);a.stroke();b=e.markers.slice();
b.sort(function(b,a){return b.positionWorld_-a.positionWorld_});k+=2;d=k+4;for(l=0;l<b.length-1;l++)t=b[l+1],r=b[l],u=t.positionWorld-r.positionWorld,q=e.xWorldVectorToView(u),h=e.xWorldToView(r.positionWorld+u/2),100>u?(m="ms",p=1):(m="s",p=1E3),p=u/p,m=Math.abs(Math.floor(1E3*p)/1E3)+" "+m,p=a.measureText(m).width,f=e.xViewVectorToWorld(p),p=p+26+10,g=r.positionWorld+u/2-f/2,s=g+f,u=k,f=e.xWorldToView(g),g=e.xWorldToView(s),r=e.xWorldToView(r.positionWorld),t=e.xWorldToView(t.positionWorld),s=!1,
p<=q&&(a.fillStyle="rgb(0,0,0)",a.fillText(m,f,u),s=!0),26<=q&&(s?(m=f-10,p=g+10):p=m=h,this.drawArrow_(a,m,d,r,d,3,"rgb(128,121,121)"),this.drawArrow_(a,p,d,t,d,3,"rgb(128,121,121)"))}},addIntersectingItemsToSelection:function(){},addIntersectingItemsInRangeToSelection:function(){},addAllObjectsMatchingFilterToSelection:function(){}};return{RulerTrack:d}});"use strict";base.requireStylesheet("timeline_track_view");base.require("event_target");base.require("measuring_stick");base.require("filter");
base.require("selection");base.require("timeline_viewport");base.require("tracks.model_track");base.require("tracks.ruler_track");base.require("ui");
base.exportTo("tracing",function(){var d=tracing.Selection,c=tracing.TimelineViewport,a=tracing.ui.define("div");a.prototype={__proto__:HTMLDivElement.prototype,model_:null,decorate:function(){this.classList.add("timeline-track-view");this.categoryFilter_=new tracing.CategoryFilter;this.viewport_=new c(this);this.rulerTrack_=new tracing.tracks.RulerTrack;this.rulerTrack_.viewport=this.viewport_;this.appendChild(this.rulerTrack_);this.modelTrackContainer_=document.createElement("div");this.modelTrackContainer_.className=
"model-track-container";this.appendChild(this.modelTrackContainer_);this.modelTrack_=new tracing.tracks.ModelTrack;this.modelTrackContainer_.appendChild(this.modelTrack_);this.dragBox_=this.ownerDocument.createElement("div");this.dragBox_.className="drag-box";this.appendChild(this.dragBox_);this.hideDragBox_();this.bindEventListener_(document,"keypress",this.onKeypress_,this);this.bindEventListener_(document,"keydown",this.onKeydown_,this);this.bindEventListener_(document,"keyup",this.onKeyup_,this);
this.bindEventListener_(document,"mousemove",this.onMouseMove_,this);this.bindEventListener_(document,"mouseup",this.onMouseUp_,this);this.addEventListener("mousewheel",this.onMouseWheel_);this.addEventListener("mousedown",this.onMouseDown_);this.addEventListener("dblclick",this.onDblClick_);this.lastMouseViewPos_={x:0,y:0};this.maxHeadingWidth_=0;this.selection_=new d},bindEventListener_:function(b,a,e,c){this.boundListeners_||(this.boundListeners_=[]);e=e.bind(c);this.boundListeners_.push({object:b,
event:a,boundFunc:e});b.addEventListener(a,e)},detach:function(){this.modelTrack_.detach();for(var b=0;b<this.boundListeners_.length;b++){var a=this.boundListeners_[b];a.object.removeEventListener(a.event,a.boundFunc)}this.boundListeners_=void 0;this.viewport_.detach()},get viewport(){return this.viewport_},get categoryFilter(){return this.categoryFilter_},set categoryFilter(b){this.categoryFilter_=b;this.modelTrack_.categoryFilter=b},get model(){return this.model_},set model(b){if(!b)throw Error("Model cannot be null");
var a=this.model_!=b;this.model_=b;this.modelTrack_.model=b;this.modelTrack_.viewport=this.viewport_;this.modelTrack_.categoryFilter=this.categoryFilter;this.rulerTrack_.headingWidth=this.modelTrack_.headingWidth;a&&this.viewport_.setWhenPossible(this.setInitialViewport_.bind(this))},get numVisibleTracks(){return this.modelTrack_.numVisibleTracks},setInitialViewport_:function(){var b=0.15*(this.model_.bounds.max-this.model_.bounds.min);this.viewport_.xSetWorldBounds(this.model_.bounds.min-b,this.model_.bounds.max+
b,this.firstCanvas.width)},addAllObjectsMatchingFilterToSelection:function(b,a){this.modelTrack_.addAllObjectsMatchingFilterToSelection(b,a)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},set focusElement(b){this.focusElement_=b},get listenToKeys_(){return!this.viewport_.isAttachedToDocument_||this.activeElement instanceof tracing.FindControl?!1:!this.focusElement_?!0:0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0},onKeypress_:function(b){var a=
this.viewport_;if(this.firstCanvas&&this.listenToKeys_&&"INPUT"!=document.activeElement.nodeName){var e=this.firstCanvas.clientWidth;switch(b.keyCode){case 119:case 44:this.zoomBy_(1.5);break;case 115:case 111:this.zoomBy_(1/1.5);break;case 103:this.onGridToggle_(!0);break;case 71:this.onGridToggle_(!1);break;case 87:case 60:this.zoomBy_(10);break;case 83:case 79:this.zoomBy_(0.1);break;case 97:a.panX+=a.xViewVectorToWorld(0.1*e);break;case 100:case 101:a.panX-=a.xViewVectorToWorld(0.1*e);break;case 65:a.panX+=
a.xViewVectorToWorld(0.5*e);break;case 68:a.panX-=a.xViewVectorToWorld(0.5*e);break;case 48:case 122:this.setInitialViewport_();break;case 102:this.zoomToSelection_()}}},onMouseWheel_:function(b){if(b.altKey){var a=Math.pow(1.5,b.wheelDeltaY/120);this.zoomBy_(a);b.preventDefault()}},onKeydown_:function(b){if(this.listenToKeys_){var a,e=this.viewport_,c=this.firstCanvas.clientWidth;switch(b.keyCode){case 37:if(a=this.selection.getShiftedSelection(-1))this.setSelectionAndMakeVisible(a),b.preventDefault();
else{if(!this.firstCanvas)return;e.panX+=e.xViewVectorToWorld(0.1*c)}break;case 39:if(a=this.selection.getShiftedSelection(1))this.setSelectionAndMakeVisible(a),b.preventDefault();else{if(!this.firstCanvas)return;e.panX-=e.xViewVectorToWorld(0.1*c)}break;case 9:-1==this.focusElement.tabIndex&&(b.shiftKey?this.selectPrevious_(b):this.selectNext_(b),b.preventDefault())}b.shiftKey&&this.dragBeginEvent_&&(b=b.shiftKey,this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,
this.dragBoxXEnd_,this.dragBoxYEnd_,b))}},onKeyup_:function(b){this.listenToKeys_&&(b.shiftKey||this.dragBeginEvent_&&this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_,b.shiftKey))},zoomBy_:function(b){if(this.firstCanvas){var a=this.viewport_,e=this.firstCanvas.clientWidth,c=this.lastMouseViewPos_.x*(window.devicePixelRatio||1),d=a.xViewToWorld(c);a.scaleX*=b;a.xPanWorldPosToViewPos(d,c,e)}},zoomToSelection_:function(){if(this.selection){var b=this.selection.bounds,
a=b.min+0.5*(b.max-b.min),b=0.5*(b.max-b.min),e=0.15*b;this.viewport_.xSetWorldBounds(a-b-e,a+b+e,this.firstCanvas.width)}},get keyHelp(){var b="Qwerty Controls\n w/s : Zoom in/out (with shift: go faster)\n a/d : Pan left/right\n\nDvorak Controls\n ,/o : Zoom in/out (with shift: go faster)\n a/e : Pan left/right\n\nMouse Controls\n drag : Select slices (with "+(0==navigator.platform.indexOf("Mac")?"cmd":"ctrl")+": zoom to slices)\n drag + shift : Select all slices vertically\n\n",
b=this.focusElement.tabIndex?b+" <- : Select previous event on current timeline\n -> : Select next event on current timeline\n":b+"General Navigation\n g/General : Shows grid at the start/end of the selected task\n <-,^TAB : Select previous event on current timeline\n ->, TAB : Select next event on current timeline\n";return b+"\nAlt + Scroll to zoom in/out\nDbl-click to zoom in; Shift dbl-click to zoom out\nf to zoom into selection\nz to reset zoom and pan to initial view\n"},
get selection(){return this.selection_},set selection(b){if(!(b instanceof d))throw Error("Expected Selection");var a;for(a=0;a<this.selection_.length;a++)this.selection_[a].selected=!1;this.selection_=b;base.dispatchSimpleEvent(this,"selectionChange");for(a=0;a<this.selection_.length;a++)this.selection_[a].selected=!0;this.viewport_.dispatchChangeEvent()},setSelectionAndMakeVisible:function(b,a){if(!(b instanceof d))throw Error("Expected Selection");this.selection=b;var e=this.selection.bounds,c=
this.viewport_.xWorldVectorToView(e.max-e.min);a&&50>c?(c=e.min+0.5*(e.max-e.min),e=5*(e.max-e.min),this.viewport_.xSetWorldBounds(c-0.5*e,c+0.5*e,this.firstCanvas.width)):this.viewport_.xPanWorldBoundsIntoView(e.min,e.max,this.firstCanvas.width)},get firstCanvas(){if(this.rulerTrack_)return this.rulerTrack_.firstCanvas;if(this.modelTrack_)return this.modelTrack_.firstCanvas},hideDragBox_:function(){this.dragBox_.style.left="-1000px";this.dragBox_.style.top="-1000px";this.dragBox_.style.width=0;this.dragBox_.style.height=
0},setDragBoxPosition_:function(b,a,e,c,d){var h=Math.min(b,e);b=Math.max(b,e);e=this.modelTrack_.getBoundingClientRect();d?(d=e.top,e=e.bottom):(d=Math.min(a,c),e=Math.max(a,c));a=d;c=h+(b-h);d=a+(e-d);var k=this.modelTrackContainer_.getBoundingClientRect();e=k.left;var l=k.top,t=k.right,k=k.bottom,m=parseInt(this.modelTrack_.headingWidth);e+=m;m={};h>t||c<e||a>k||d<l?a=!1:(m.left=Math.max(e,h),m.top=Math.max(l,a),m.right=Math.min(t,c),m.bottom=Math.min(k,d),m.width=m.right-m.left,m.height=m.bottom-
m.top,a=m);this.dragBox_.style.left=a.left+"px";this.dragBox_.style.width=a.width+"px";this.dragBox_.style.top=a.top+"px";this.dragBox_.style.height=a.height+"px";a=window.devicePixelRatio||1;c=this.firstCanvas;h=this.viewport_.xViewToWorld((h-c.offsetLeft)*a);b=this.viewport_.xViewToWorld((b-c.offsetLeft)*a);a=Math.round(100*(b-h))/100;this.dragBox_.textContent=a+"ms";a=new base.Event("selectionChanging");a.loWX=h;a.hiWX=b;this.dispatchEvent(a)},onGridToggle_:function(b){b=b?this.selection_.bounds.min:
this.selection_.bounds.max;var a=Math.ceil((b-this.model_.bounds.min)/this.viewport_.gridStep_);this.viewport_.gridTimebase=b-(a+1)*this.viewport_.gridStep_;this.viewport_.gridEnabled=!0},isChildOfThis_:function(b){if(b!=this){for(;b.parentNode;){if(b==this)return!0;b=b.parentNode}return!1}},onMouseDown_:function(b){if(0===b.button)if(b.shiftKey)this.rulerTrack_.placeAndBeginDraggingMarker(b.clientX);else{var a=this.firstCanvas,e=this.modelTrack_.getBoundingClientRect(),c=this.firstCanvas.getBoundingClientRect();
e&&(b.clientX>=e.left&&b.clientX<e.right&&b.clientY>=e.top&&b.clientY<e.bottom&&b.clientX>=c.left&&b.clientX<c.right)&&(this.viewport_.xViewToWorld(b.clientX-a.offsetLeft),this.dragBeginEvent_=b,b.preventDefault(),document.activeElement&&document.activeElement.blur(),0<=this.focusElement.tabIndex&&this.focusElement.focus())}},onMouseMove_:function(b){if(this.firstCanvas){var a=this.firstCanvas;this.lastMouseViewPos_={x:b.clientX-a.offsetLeft,y:b.clientY-a.offsetTop};this.dragBeginEvent_&&(this.dragBoxXStart_=
this.dragBeginEvent_.clientX,this.dragBoxXEnd_=b.clientX,this.dragBoxYStart_=this.dragBeginEvent_.clientY,this.dragBoxYEnd_=b.clientY,this.setDragBoxPosition_(this.dragBoxXStart_,this.dragBoxYStart_,this.dragBoxXEnd_,this.dragBoxYEnd_,b.shiftKey))}},onMouseUp_:function(b){if(this.dragBeginEvent_){this.hideDragBox_();var a=this.dragBeginEvent_;this.dragBeginEvent_=null;var e,c=Math.min(a.clientX,b.clientX),j=Math.max(a.clientX,b.clientX);this.modelTrackContainer_.getBoundingClientRect();b.shiftKey?
(a=this.modelTrack_.getBoundingClientRect(),e=a.top,a=a.bottom):(e=Math.min(a.clientY,b.clientY),a=Math.max(a.clientY,b.clientY));var h=this.firstCanvas,c=c-h.offsetLeft,j=j-h.offsetLeft,h=new d;this.modelTrack_.addIntersectingItemsInRangeToSelection(c,j,e,a,h);this.selection=h;(base.isMac&&b.metaKey||!base.isMac&&b.ctrlKey)&&this.zoomToSelection_()}},onDblClick_:function(b){var a=this.modelTrackContainer_.getBoundingClientRect(),e=a.left,a=a.right,c=parseInt(this.modelTrack_.headingWidth);b.clientX<
e+c||b.clientX>a||(e=4,b.shiftKey&&(e=1/e),this.zoomBy_(e),b.preventDefault())}};base.defineProperty(a,"model",base.PropertyKind.JS);return{TimelineTrackView:a}});"use strict";base.exportTo("tracing.analysis",function(){return{tsRound:function(d){return Math.round(1E3*d)/1E3}}});"use strict";base.require("analysis.util");base.require("ui");base.requireStylesheet("timeline_analysis_view");
base.exportTo("tracing",function(){function d(b,a){var e=a.getSliceHitsAsSelection(),c=a.getCounterSampleHitsAsSelection();if(1==e.length){var d=e[0].slice,h=b.appendTable("analysis-slice-table",2);b.appendTableHeader(h,"Selected slice:");b.appendSummaryRow(h,"Title",d.title);d.category&&b.appendSummaryRow(h,"Category",d.category);b.appendSummaryRowTime(h,"Start",d.start);b.appendSummaryRowTime(h,"Duration",d.duration);d.durationInUserTime&&b.appendSummaryRowTime(h,"Duration (U)",d.durationInUserTime);
var e=0,k;for(k in d.args)e+=1;if(0<e)for(k in b.appendSummaryRow(h,"Args"),d.args)b.appendSummaryRow(h," "+k,d.args[k])}else if(1<e.length){var l=e.bounds.min,t=e.bounds.max;e.map(function(b){return b.slice.title});var h=0,m={};for(k=0;k<e.length;k++)d=e[k].slice,m[d.title]||(m[d.title]={slices:[]},h++),m[d.title].slices.push(d);h=b.appendTable("analysis-slices-table",3);b.appendTableHeader(h,"Slices:");var d=0,q;for(q in m){var p=m[q],r=0;k=0;var u=Number.MAX_VALUE,s=-Number.MAX_VALUE,w=Number.MAX_VALUE,
v=-Number.MAX_VALUE;for(k=0;k<p.slices.length;k++)r+=p.slices[k].duration,u=Math.min(p.slices[k].start,u),s=Math.max(p.slices[k].start,s),w=Math.min(p.slices[k].duration,w),v=Math.max(p.slices[k].duration,v);d+=r;0==p.slices.length&&(k=0);k=r/p.slices.length;w={min:w,max:v,avg:k,avg_stddev:void 0,frequency:void 0,frequency_stddev:void 0};for(k=v=0;k<p.slices.length;k++)var x=w.avg-p.slices[k].duration,v=v+x*x;w.avg_stddev=Math.sqrt(v/(p.slices.length-1));k=s-u;if(2<p.slices.length&&0<k){u=p.slices.length-
1;w.frequency=1E3*u/k;v=0;for(k=1;k<p.slices.length;k++)x=w.frequency-1E3/(p.slices[k].start-p.slices[k-1].start),v+=x*x;w.frequency_stddev=Math.sqrt(v/(u-1))}b.appendDataRow(h,q,r,p.slices.length,w)}b.appendDataRow(h,"*Totals",d,e.length);b.appendSpacingRow(h);b.appendSummaryRowTime(h,"Selection start",l);b.appendSummaryRowTime(h,"Selection extent",t-l)}if(1==c.length){var h=c[0],e=h.counter,y=h.sampleIndex,c=[];for(k=0;k<e.numSeries;++k)c.push(e.samples[e.numSeries*y+k]);h=b.appendTable("analysis-counter-table",
2);b.appendTableHeader(h,"Selected counter:");b.appendSummaryRow(h,"Title",e.name);b.appendSummaryRowTime(h,"Timestamp",e.timestamps[y]);for(k=0;k<e.numSeries;k++)b.appendSummaryRow(h,e.seriesNames[k],c[k])}else if(1<c.length){q={};for(k=0;k<c.length;k++)e=c[k].counter,q[e.guid]||(q[e.guid]=[]),q[e.guid].push(c[k]);h=b.appendTable("analysis-counter-table",7);b.appendTableHeader(h,"Counters:");for(y in q){c=q[y];e=c[0].counter;l=[];for(k=0;k<c.length;k++)l.push(c[k].sampleIndex);c=e.getSampleStatistics(l);
for(k=0;k<c.length;k++)b.appendDataRow(h,e.name+": "+e.seriesNames[k],void 0,void 0,c[k])}}}var c=tracing.ui.define("div");c.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){},appendElement_:function(b,a,e){a=b.ownerDocument.createElement(a);b.appendChild(a);void 0!=e&&(a.textContent=e);return a},appendText_:function(b,a){b.ownerDocument.createTextNode(a);b.appendChild(textNode);return textNode},appendTableCell_:function(b,a,e,c){a=this.appendElement_(a,"td",c);a.className=b.className+
"-col-"+e;return a},appendTableCellWithTooltip_:function(b,a,e,c,d){if(d)return a=this.appendElement_(a,"td"),a.className=b.className+"-col-"+e,b=this.appendElement_(a,"span",c),b.className="tooltip",b.title=d,a;this.appendTableCell_(b,a,e,c)},appendTable:function(b,a){var e=this.appendElement_(this,"table");e.className=b+" analysis-table";e.numColumns=a;return e},appendTableHeader:function(b,a){var e=this.appendElement_(b,"tr");this.appendElement_(e,"th",a).className="analysis-table-header"},appendSummaryRow:function(b,
a,e){var c=this.appendElement_(b,"tr");c.className="analysis-table-row";this.appendTableCell_(b,c,0,a);if(void 0!==e){if("{"==e[0]&&"}"==e[e.length-1]){var d;try{d=JSON.parse(e)}catch(h){d=void 0}void 0===!d?this.appendTableCell_(b,c,1,e):(a=JSON.stringify(d,null," "),this.appendTableCell_(b,c,1,a))}else this.appendTableCell_(b,c,1,e);for(a=2;a<b.numColumns;a++)this.appendTableCell_(b,c,a,"")}else for(a=1;a<b.numColumns;a++)this.appendTableCell_(b,c,1,"")},appendSpacingRow:function(b){var a=this.appendElement_(b,
"tr");a.className="analysis-table-row";for(var e=0;e<b.numColumns;e++)this.appendTableCell_(b,a,e," ")},appendSummaryRowTime:function(b,a,e){this.appendSummaryRow(b,a,tracing.analysis.tsRound(e)+" ms")},appendDataRow:function(b,a,e,c,d){var h=void 0;d&&(h="Min Duration:\t"+tracing.analysis.tsRound(d.min)+" ms \rMax Duration:\t"+tracing.analysis.tsRound(d.max)+" ms \rAvg Duration:\t"+tracing.analysis.tsRound(d.avg)+" ms (\u03c3 = "+tracing.analysis.tsRound(d.avg_stddev)+")",d.start&&(h+="\rStart Time:\t"+
tracing.analysis.tsRound(d.start)+" ms"),d.end&&(h+="\rEnd Time:\t"+tracing.analysis.tsRound(d.end)+" ms"),d.frequency&&d.frequency_stddev&&(h+="\rFrequency:\t"+tracing.analysis.tsRound(d.frequency)+" occurrences/s (\u03c3 = "+tracing.analysis.tsRound(d.frequency_stddev)+")"));d=this.appendElement_(b,"tr");d.className="analysis-table-row";this.appendTableCellWithTooltip_(b,d,0,a,h);void 0!==e?this.appendTableCellWithTooltip_(b,d,1,tracing.analysis.tsRound(e)+" ms",h):this.appendTableCell_(b,d,1,"");
void 0!==c?this.appendTableCellWithTooltip_(b,d,2,String(c)+" occurrences",h):this.appendTableCell_(b,d,2,"")}};var a=tracing.ui.define("div");a.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="analysis"},set selection(b){this.textContent="";var a=new c;d(a,b);this.appendChild(a)}};return{TimelineAnalysisView:a,analyzeSelection_:d}});base.requireStylesheet("overlay");base.require("ui");base.require("event_target");
base.exportTo("tracing.ui",function(){var d=tracing.ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("overlay-root");this.visible=!1;this.contentHost=this.ownerDocument.createElement("div");this.contentHost.classList.add("content-host");this.tabCatcher=this.ownerDocument.createElement("span");this.tabCatcher.tabIndex=0;this.appendChild(this.contentHost);this.onKeydownBoundToThis_=this.onKeydown_.bind(this);this.onFocusInBoundToThis_=this.onFocusIn_.bind(this);
this.addEventListener("mousedown",this.onMousedown_.bind(this))},showOverlay:function(a){a.oldParent_=a.parentNode;this.contentHost.appendChild(a);this.contentHost.appendChild(this.tabCatcher);this.ownerDocument.body.classList.add("disabled-by-overlay");this.visible=!0;a.tabIndex=0;var b=a.querySelector("button, input, list, select, a");b||(b=a);b.focus();this.ownerDocument.addEventListener("focusin",this.onFocusInBoundToThis_,!0);a.addEventListener("keydown",this.onKeydownBoundToThis_)},onMousedown_:function(a){a.target==
this&&a.preventDefault()},onFocusIn_:function(a){a.target==this.tabCatcher&&window.setTimeout(this.focusOverlay_.bind(this),0)},focusOverlay_:function(){this.contentHost.firstChild.focus()},onKeydown_:function(a){9==a.keyCode&&(a.shiftKey&&a.target==this.contentHost.firstChild)&&a.preventDefault()},hideOverlay:function(a){this.visible=!1;this.ownerDocument.body.classList.remove("disabled-by-overlay");this.lastFocusOut_=void 0;a.parentNode.removeChild(this.tabCatcher);a.oldParent_?(a.oldParent_.appendChild(a),
delete a.oldParent_):this.contentHost.removeChild(a);a.removeEventListener("keydown",this.onKeydownBoundToThis_);this.ownerDocument.removeEventListener("focusin",this.onFocusInBoundToThis_)}};base.defineProperty(d,"visible",base.PropertyKind.BOOL_ATTR);var c=tracing.ui.define("div");c.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){if(!this.ownerDocument.querySelector(".overlay-root")){var a=this.ownerDocument.createElement("div");tracing.ui.decorate(a,d);this.ownerDocument.body.appendChild(a)}this.classList.add("overlay");
this.visible=!1;this.defaultClickShouldClose=!0;this.autoClose=!1;this.additionalCloseKeyCodes=[];this.onKeyDown=this.onKeyDown.bind(this);this.onKeyPress=this.onKeyPress.bind(this);this.onDocumentClick=this.onDocumentClick.bind(this)},onVisibleChanged_:function(){var a=this.ownerDocument.querySelector(".overlay-root");base.dispatchSimpleEvent(this,"visibleChange");this.visible?(a.showOverlay(this),document.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("keypress",this.onKeyPress,
!0),document.addEventListener("click",this.onDocumentClick,!0)):(document.removeEventListener("keydown",this.onKeyDown,!0),document.removeEventListener("keypress",this.onKeyPress,!0),document.removeEventListener("click",this.onDocumentClick,!0),a.hideOverlay(this))},onKeyDown:function(a){this.autoClose&&27==a.keyCode&&(this.visible=!1,a.preventDefault())},onKeyPress:function(a){if(this.autoClose)for(var b=0;b<this.additionalCloseKeyCodes.length;b++)if(a.keyCode==this.additionalCloseKeyCodes[b]){this.visible=
!1;a.preventDefault();break}},onDocumentClick:function(a){if(this.defaultClickShouldClose){for(var b=a.target;null!==b;){if(b===this)return;b=b.parentNode}this.visible=!1;a.preventDefault()}}};base.defineProperty(c,"visible",base.PropertyKind.BOOL_ATTR,c.prototype.onVisibleChanged_);base.defineProperty(c,"defaultClickShouldClose",base.PropertyKind.BOOL_ATTR);return{Overlay:c}});"use strict";base.require("filter");base.require("overlay");
base.exportTo("tracing",function(){var d=tracing.ui.define("div");d.prototype={__proto__:tracing.ui.Overlay.prototype,decorate:function(){tracing.ui.Overlay.prototype.decorate.call(this);this.className="view-category-filter-overlay";this.autoClose=!0;var c=document.createElement("div");c.className="category-filter-dialog";c.textContent="Select active categories:";this.formEl_=document.createElement("form");this.formEl_.className="category-filter-dialog-form";c.appendChild(this.formEl_);this.appendChild(c);
this.categoriesEl_=document.createElement("div");this.categoriesEl_.className="categories";this.formEl_.appendChild(this.categoriesEl_);this.addEventListener("visibleChange",this.onVisibleChange_.bind(this));this.isCheckedCallback_=this.onChangeCallback_=void 0},set categories(c){this.categories_=c},set settings_key(c){this.settings_key_=c},set settings(c){this.settings_=c},set settingUpdatedCallback(c){this.settingUpdatedCallback_=c},selectedCategories:function(){for(var c=this.categoriesEl_.querySelectorAll("input"),
a=c.length,b=[],f=0;f<a;++f){var e=c[f];e.checked&&b.push(e.value)}return b},unselectedCategories:function(){for(var c=this.categoriesEl_.querySelectorAll("input"),a=c.length,b=[],f=0;f<a;++f){var e=c[f];e.checked||b.push(e.value)}return b},onVisibleChange_:function(){this.visible&&this.updateForm_()},updateForm_:function(){this.categoriesEl_.innerHTML="";for(var c={},a=this.categories_.concat(this.settings_.keys(this.settings_key_)),b=a.length,f=0;f<b;++f)c[a[f]]=!0;var a=[],e;for(e in c)a.push(e);
a=a.sort();for(f=0;f<a.length;f++)e=a[f],c=document.createElement("input"),c.type="checkbox",c.id=c.value=e,c.checked="true"===this.settings_.get(e,"true",this.settings_key_),c.onchange=this.updateSetting_.bind(this),b=document.createElement("label"),b.textContent=e,b.setAttribute("for",e),e=document.createElement("div"),e.appendChild(c),e.appendChild(b),this.categoriesEl_.appendChild(e)},updateSetting_:function(c){c=c.target;this.settings_.set(c.value,c.checked,this.settings_key_);void 0!==this.settingUpdatedCallback_&&
this.settingUpdatedCallback_()}};return{CategoryFilterDialog:d}});"use strict";base.require("timeline_track_view");base.require("filter");base.require("overlay");
base.exportTo("tracing",function(){function d(){this.model_=this.timeline_=void 0;this.filterText_="";this.filterHits_=new tracing.Selection;this.filterHitsDirty_=!0;this.currentHitIndex_=0}var c=tracing.ui.define("div");c.prototype={__proto__:tracing.ui.Overlay.prototype,decorate:function(){tracing.ui.Overlay.prototype.decorate.call(this);this.className="find-control";this.hitCountEl_=document.createElement("div");this.hitCountEl_.className="hit-count-label";this.hitCountEl_.textContent="1 of 7";
var a=document.createElement("div");a.className="button find-previous";a.textContent="\u2190";a.addEventListener("click",function(){this.controller.findPrevious();this.updateHitCountEl_()}.bind(this));var b=document.createElement("div");b.className="button find-next";b.textContent="\u2192";b.addEventListener("click",function(){this.controller.findNext();this.updateHitCountEl_()}.bind(this));this.filterEl_=document.createElement("input");this.filterEl_.type="input";this.filterEl_.addEventListener("input",
function(){this.controller.filterText=this.filterEl_.value;this.updateHitCountEl_()}.bind(this));this.filterEl_.addEventListener("keydown",function(a){13==a.keyCode?b.click():27==a.keyCode&&(this.filterEl_.blur(),this.updateHitCountEl_())}.bind(this));this.filterEl_.addEventListener("blur",function(){this.updateHitCountEl_()}.bind(this));this.filterEl_.addEventListener("focus",function(){this.updateHitCountEl_()}.bind(this));this.appendChild(this.filterEl_);this.appendChild(a);this.appendChild(b);
this.appendChild(this.hitCountEl_);this.updateHitCountEl_()},get controller(){return this.controller_},set controller(a){this.controller_=a;this.updateHitCountEl_()},focus:function(){this.filterEl_.selectionStart=0;this.filterEl_.selectionEnd=this.filterEl_.value.length;this.filterEl_.focus()},updateHitCountEl_:function(){if(!this.controller||document.activeElement!=this.filterEl_)this.hitCountEl_.textContent="";else{var a=this.controller.currentHitIndex,b=this.controller.filterHits.length;this.hitCountEl_.textContent=
0==b?"0 of 0":a+1+" of "+b}}};d.prototype={__proto__:Object.prototype,get timeline(){return this.timeline_},set timeline(a){this.timeline_=a;this.filterHitsDirty_=!0},get filterText(){return this.filterText_},set filterText(a){a!=this.filterText_&&(this.filterText_=a,this.filterHitsDirty_=!0,this.findNext())},get filterHits(){if(this.filterHitsDirty_)if(this.filterHitsDirty_=!1,this.timeline_){var a=new tracing.TitleFilter(this.filterText);this.filterHits_.clear();this.timeline.addAllObjectsMatchingFilterToSelection(a,
this.filterHits_);this.currentHitIndex_=this.filterHits_.length-1}else this.filterHits_.clear(),this.currentHitIndex_=0;return this.filterHits_},get currentHitIndex(){return this.currentHitIndex_},find_:function(a){if(this.timeline){var b=this.filterHits.length;this.currentHitIndex_+=a;0>this.currentHitIndex_&&(this.currentHitIndex_=b-1);this.currentHitIndex_>=b&&(this.currentHitIndex_=0);0>this.currentHitIndex_||this.currentHitIndex_>=b?this.timeline.selection=new tracing.Selection:(a=0==this.currentHitIndex_,
b=this.filterHits.subSelection(this.currentHitIndex_),this.timeline.setSelectionAndMakeVisible(b,a))}},findNext:function(){this.find_(1)},findPrevious:function(){this.find_(-1)}};return{FindControl:c,FindController:d}});base.require("model");base.require("color_scheme");
base.exportTo("tracing.importer",function(){function d(c,a){this.importPriority=1;this.model_=c;"string"===typeof a||a instanceof String?("["==a[0]&&(n=a.length,"\n"==a[n-1]&&(a=a.substring(0,n-1),n--,"\r"==a[n-1]&&(a=a.substring(0,n-1),n--)),","==a[n-1]&&(a=a.substring(0,n-1)),"]"!=a[n-1]&&(a+="]")),this.events_=JSON.parse(a)):this.events_=a;if(this.events_.traceEvents){var b=this.events_;this.events_=this.events_.traceEvents;for(fieldName in b)"traceEvents"!=fieldName&&this.model_.metadata.push({name:fieldName,
value:b[fieldName]})}this.allAsyncEvents_=[]}d.canImport=function(c){return"string"===typeof c||c instanceof String?"{"==c[0]||"["==c[0]:c instanceof Array&&c.length&&c[0].ph?!0:c.traceEvents?c.traceEvents instanceof Array&&c.traceEvents[0].ph:!1};d.prototype={__proto__:Object.prototype,processAsyncEvent:function(c,a){var b=this.model_.getOrCreateProcess(a.pid).getOrCreateThread(a.tid);this.allAsyncEvents_.push({event:a,thread:b})},processCounterEvent:function(c){var a;a=void 0!==c.id?c.name+"["+
c.id+"]":c.name;a=this.model_.getOrCreateProcess(c.pid).getOrCreateCounter(c.cat,a);if(0==a.numSeries){for(var b in c.args)a.seriesNames.push(b),a.seriesColors.push(tracing.getStringColorId(a.name+"."+b));if(0==a.numSeries){this.model_.importErrors.push("Expected counter "+c.name+" to have at least one argument to use as a value.");delete a.parent.counters[a.name];return}}a.timestamps.push(c.ts/1E3);for(var f=0;f<a.numSeries;f++)b=a.seriesNames[f],void 0===c.args[b]?a.samples.push(0):a.samples.push(c.args[b])},
importEvents:function(){for(var c=this.events_,a=0;a<c.length;a++){var b=c[a];if("B"==b.ph){var f=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid);f.isTimestampValidForBeginOrEnd(b.ts/1E3)?f.beginSlice(b.cat,b.name,b.ts/1E3,b.args):this.model_.importErrors.push("Timestamps are moving backward.")}else if("E"==b.ph)if(f=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),f.isTimestampValidForBeginOrEnd(b.ts/1E3))if(f.openSliceCount){var f=f.endSlice(b.ts/1E3),e;for(e in b.args)void 0!==
f.args[e]&&this.model_.importErrors.push("Both the B and E phases of "+f.name+"provided values for argument "+e+". The value of the E phase event will be used."),f.args[e]=b.args[e]}else this.model_.importErrors.push("E phase event without a matching B phase event.");else this.model_.importErrors.push("Timestamps are moving backward.");else"S"==b.ph?this.processAsyncEvent(a,b):"F"==b.ph?this.processAsyncEvent(a,b):"T"==b.ph?this.processAsyncEvent(a,b):"I"==b.ph||"i"==b.ph?(f=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),
f.beginSlice(b.cat,b.name,b.ts/1E3,b.args),f.endSlice(b.ts/1E3)):"P"==b.ph?(f=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),f.addSample(b.cat,b.name,b.ts/1E3,b.args)):"C"==b.ph?this.processCounterEvent(b):"M"==b.ph?"thread_name"==b.name?(f=this.model_.getOrCreateProcess(b.pid).getOrCreateThread(b.tid),f.name=b.args.name):this.model_.importErrors.push("Unrecognized metadata name: "+b.name):"s"!=b.ph&&"t"!=b.ph&&"f"!=b.ph&&this.model_.importErrors.push("Unrecognized event phase: "+
b.ph+"("+b.name+")")}},finalizeImport:function(){this.createAsyncSlices_()},createAsyncSlices_:function(){if(0!=this.allAsyncEvents_.length){this.allAsyncEvents_.sort(function(a,b){return a.event.ts-b.event.ts});for(var c={},a=this.allAsyncEvents_,b=0;b<a.length;b++){var f=a[b],e=f.event,d=e.name;if(void 0===d)this.model_.importErrors.push("Async events (ph: S, T or F) require an name parameter.");else{var j=e.id;if(void 0===j)this.model_.importErrors.push("Async events (ph: S, T or F) require an id parameter.");
else if("S"==e.ph)void 0===c[d]&&(c[d]={}),c[d][j]?this.model_.importErrors.push("At "+e.ts+", a slice of the same id "+j+" was alrady open."):(c[d][j]=[],c[d][j].push(f));else if(void 0===c[d])this.model_.importErrors.push("At "+e.ts+", no slice named "+d+" was open.");else if(void 0===c[d][j])this.model_.importErrors.push("At "+e.ts+", no slice named "+d+" with id="+j+" was open.");else{var h=c[d][j];h.push(f);if("F"==e.ph){var k=new tracing.model.AsyncSlice(h[0].event.cat,d,tracing.getStringColorId(d),
h[0].event.ts/1E3);k.duration=e.ts/1E3-h[0].event.ts/1E3;k.startThread=h[0].thread;k.endThread=f.thread;k.id=j;k.args=h[0].event.args;k.subSlices=[];for(f=1;f<h.length;++f){var l=d;"T"==h[f-1].event.ph&&(l=d+":"+h[f-1].event.args.step);l=new tracing.model.AsyncSlice(h[0].event.cat,l,tracing.getStringColorId(d+f),h[f-1].event.ts/1E3);l.duration=h[f].event.ts/1E3-h[f-1].event.ts/1E3;l.startThread=h[f-1].thread;l.endThread=h[f].thread;l.id=j;l.args=h[f-1].event.args;k.subSlices.push(l)}var h=k.subSlices[k.subSlices.length-
1],t;for(t in e.args)h.args[t]=e.args[t];k.startThread.asyncSlices.push(k);delete c[d][j]}}}}}}};tracing.Model.registerImporter(d);return{TraceEventImporter:d}});base.exportTo("tracing.importer.linux_perf",function(){function d(a){this.importer=a;this.model=a.model}var c=[];d.registerSubtype=function(a){c.push(a)};d.getSubtypeConstructors=function(){return c};d.prototype={__proto__:Object.prototype};return{Parser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("memory_bus_usage",d.prototype.traceMarkWriteBusEvent.bind(this));this.model_=a.model_;this.ppids_={}}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,traceMarkWriteBusEvent:function(a,b,f,e,c){c=/bus=(\S+) rw_bytes=(\d+) r_bytes=(\d+) w_bytes=(\d+) cycles=(\d+) ns=(\d+)/.exec(c.details);a=c[1];parseInt(c[2]);f=parseInt(c[3]);b=parseInt(c[4]);parseInt(c[5]);c=parseInt(c[6]);
f=1E9*f/c/1048576;b=1E9*b/c/1048576;c=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,"bus "+a+" read");0==c.numSeries&&(c.seriesNames.push("value"),c.seriesColors.push(tracing.getStringColorId(c.name+".value")));c.timestamps.push(e);c.samples.push(f);c=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,"bus "+a+" write");0==c.numSeries&&(c.seriesNames.push("value"),c.seriesColors.push(tracing.getStringColorId(c.name+".value")));c.timestamps.push(e);c.samples.push(b);return!0}};c.registerSubtype(d);
return{BusParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("clock_set_rate",d.prototype.traceMarkWriteClockEvent.bind(this));this.model_=a.model_;this.ppids_={}}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,traceMarkWriteClockEvent:function(a,b,f,e,c){b=/(\S+) state=(\d+) cpu_id=(\d+)/.exec(c.details);a=b[1];b=parseInt(b[2]);a=this.model_.getOrCreateProcess(0).getOrCreateCounter(null,a);0==a.numSeries&&(a.seriesNames.push("value"),
a.seriesColors.push(tracing.getStringColorId(a.name+".value")));a.timestamps.push(e);a.samples.push(b);return!0}};c.registerSubtype(d);return{ClockParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(b){a.call(this,b);b.registerEventHandler("cpufreq_interactive_up",d.prototype.cpufreqUpDownEvent.bind(this));b.registerEventHandler("cpufreq_interactive_down",d.prototype.cpufreqUpDownEvent.bind(this));b.registerEventHandler("cpufreq_interactive_already",d.prototype.cpufreqTargetEvent.bind(this));b.registerEventHandler("cpufreq_interactive_notyet",d.prototype.cpufreqTargetEvent.bind(this));b.registerEventHandler("cpufreq_interactive_setspeed",
d.prototype.cpufreqTargetEvent.bind(this));b.registerEventHandler("cpufreq_interactive_target",d.prototype.cpufreqTargetEvent.bind(this));b.registerEventHandler("cpufreq_interactive_boost",d.prototype.cpufreqBoostUnboostEvent.bind(this));b.registerEventHandler("cpufreq_interactive_unboost",d.prototype.cpufreqBoostUnboostEvent.bind(this))}function c(a){var f={};a=a.split(/\s+/);for(var e=a.length,c=0;c<e;c++){var d=a[c].split("=");f[d[0]]=parseInt(d[1])}return f}var a=tracing.importer.linux_perf.Parser;
d.prototype={__proto__:a.prototype,cpufreqSlice:function(a,f,c,d){c=this.importer.getOrCreatePseudoThread("cpufreq");c.openSlice=f;a=new tracing.model.Slice("",c.openSlice,tracing.getStringColorId(c.openSlice),a,d,0);c.thread.pushSlice(a)},cpufreqBoostSlice:function(a,f,c){var d=this.importer.getOrCreatePseudoThread("cpufreq_boost");d.openSlice=f;a=new tracing.model.Slice("",d.openSlice,tracing.getStringColorId(d.openSlice),a,c,0);d.thread.pushSlice(a)},cpufreqUpDownEvent:function(a,f,e,d,j){f=c(j.details);
this.cpufreqSlice(d,a,f.cpu,f);return!0},cpufreqTargetEvent:function(a,f,e,d,j){f=c(j.details);this.cpufreqSlice(d,a,f.cpu,f);return!0},cpufreqBoostUnboostEvent:function(a,f,c,d,j){this.cpufreqBoostSlice(d,a,{type:j.details});return!0}};a.registerSubtype(d);return{CpufreqParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("ext4_sync_file_enter",d.prototype.ext4SyncFileEnterEvent.bind(this));a.registerEventHandler("ext4_sync_file_exit",d.prototype.ext4SyncFileExitEvent.bind(this));a.registerEventHandler("block_rq_issue",d.prototype.blockRqIssueEvent.bind(this));a.registerEventHandler("block_rq_complete",d.prototype.blockRqCompleteEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,
openAsyncSlice:function(a,b,f,c,d,j){f=this.importer.getOrCreateKernelThread(b+":"+f,c);a=new tracing.model.AsyncSlice(b,j,tracing.getStringColorId(j),a);a.startThread=f.thread;f.openAsyncSlices||(f.openAsyncSlices={});f.openAsyncSlices[d]=a},closeAsyncSlice:function(a,b,f,c,d,j){f=this.importer.getOrCreateKernelThread(b+":"+f,c);if(f.openAsyncSlices&&(c=f.openAsyncSlices[d]))c.duration=a-c.start,c.args=j,c.endThread=f.thread,c.subSlices=[new tracing.model.Slice(b,c.title,c.colorId,c.start,c.args,
c.duration)],f.thread.asyncSlices.push(c),delete f.openAsyncSlices[d]},ext4SyncFileEnterEvent:function(a,b,f,c,d){a=/dev (\d+,\d+) ino (\d+) parent (\d+) datasync (\d+)/.exec(d.details);if(!a)return!1;b=a[1];f=parseInt(a[2]);this.openAsyncSlice(c,"ext4",d.threadName,d.pid,b+"-"+f,1==a[4]?"fdatasync":"fsync");return!0},ext4SyncFileExitEvent:function(a,b,f,c,d){f=/dev (\d+,\d+) ino (\d+) ret (\d+)/.exec(d.details);if(!f)return!1;a=f[1];b=parseInt(f[2]);f=parseInt(f[3]);this.closeAsyncSlice(c,"ext4",
d.threadName,d.pid,a+"-"+b,{device:a,inode:b,error:f});return!0},blockRqIssueEvent:function(a,b,f,c,d){var j=/(\d+,\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? \d+ \(.*\) (\d+) \+ (\d+) \[.*\]/.exec(d.details);if(!j)return!1;switch(j[3]){case "D":a="discard";break;case "W":a="write";break;case "R":a="read";break;case "N":a="none";break;default:a="unknown"}j[2]&&(a+=" flush");"F"==j[4]&&(a+=" fua");"A"==j[5]&&(a+=" ahead");"S"==j[6]&&(a+=" sync");"M"==j[7]&&(a+=" meta");b=j[1];f=parseInt(j[8]);j=parseInt(j[9]);
this.openAsyncSlice(c,"block",d.threadName,d.pid,b+"-"+f+"-"+j,a);return!0},blockRqCompleteEvent:function(a,b,c,e,d){var j=/(\d+,\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? \(.*\) (\d+) \+ (\d+) \[(.*)\]/.exec(d.details);if(!j)return!1;a=j[1];b=parseInt(j[8]);c=parseInt(j[9]);j=parseInt(j[10]);this.closeAsyncSlice(e,"block",d.threadName,d.pid,a+"-"+b+"-"+c,{device:a,sector:b,numSectors:c,error:j});return!0}};c.registerSubtype(d);return{DiskParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("drm_vblank_event",d.prototype.vblankEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,drmVblankSlice:function(a,b,c){var e=this.importer.getOrCreatePseudoThread("drm_vblank");e.openSlice=b;a=new tracing.model.Slice("",e.openSlice,tracing.getStringColorId(e.openSlice),a,c,0);e.thread.pushSlice(a)},vblankEvent:function(a,b,c,e,d){b=/crtc=(\d+), seq=(\d+)/.exec(d.details);
if(!b)return!1;a=parseInt(b[1]);b=parseInt(b[2]);this.drmVblankSlice(e,"vblank:"+a,{crtc:a,seq:b});return!0}};c.registerSubtype(d);return{DrmParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("exynos_flip_request",d.prototype.flipEvent.bind(this));a.registerEventHandler("exynos_flip_complete",d.prototype.flipEvent.bind(this));a.registerEventHandler("exynos_busfreq_target_int",d.prototype.busfreqTargetIntEvent.bind(this));a.registerEventHandler("exynos_busfreq_target_mif",d.prototype.busfreqTargetMifEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,
exynosFlipOpenSlice:function(a,b){var c=this.importer.getOrCreatePseudoThread("exynos_flip");c.openSliceTS=a;c.openSlice="flip:"+b},exynosFlipCloseSlice:function(a,b){var c=this.importer.getOrCreatePseudoThread("exynos_flip");if(c.openSlice){var e=new tracing.model.Slice("",c.openSlice,tracing.getStringColorId(c.openSlice),c.openSliceTS,b,a-c.openSliceTS);c.thread.pushSlice(e)}c.openSlice=void 0},flipEvent:function(a,b,c,e,d){b=/pipe=(\d+)/.exec(d.details);if(!b)return!1;b=parseInt(b[1]);"exynos_flip_request"==
a?this.exynosFlipOpenSlice(e,b):this.exynosFlipCloseSlice(e,{pipe:b});return!0},exynosBusfreqSample:function(a,b,c){a=this.importer.getOrCreateCpuState(0).cpu.getOrCreateCounter("",a);0==a.numSeries&&(a.seriesNames.push("frequency"),a.seriesColors.push(tracing.getStringColorId(a.name+".frequency")));a.timestamps.push(b);a.samples.push(c)},busfreqTargetIntEvent:function(a,b,c,e,d){a=/frequency=(\d+)/.exec(d.details);if(!a)return!1;this.exynosBusfreqSample("INT Frequency",e,parseInt(a[1]));return!0},
busfreqTargetMifEvent:function(a,b,c,e,d){a=/frequency=(\d+)/.exec(d.details);if(!a)return!1;this.exynosBusfreqSample("MIF Frequency",e,parseInt(a[1]));return!0}};c.registerSubtype(d);return{ExynosParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("tracing_mark_write:log",d.prototype.logEvent.bind(this));a.registerEventHandler("tracing_mark_write:SyncInterpret",d.prototype.syncEvent.bind(this));a.registerEventHandler("tracing_mark_write:HandleTimer",d.prototype.timerEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,gestureOpenSlice:function(a,b,c){this.importer.getOrCreatePseudoThread("gesture").thread.beginSlice("touchpad_gesture",
a,b,c)},gestureCloseSlice:function(a,b){var c=this.importer.getOrCreatePseudoThread("gesture").thread;if(c.openSliceCount){var e=c.openPartialSlices_[c.openSliceCount-1];e.title!=a?this.importer.importError("Titles do not match. Title is "+e.title+" in openSlice, and is "+a+" in endSlice"):c.endSlice(b)}},logEvent:function(a,b,c,e,d){a=/^\s*(\w+):\s*(\w+)$/.exec(d.details);switch(a[1]){case "start":this.gestureOpenSlice("GestureLog",e,{name:a[2]});break;case "end":this.gestureCloseSlice("GestureLog",
e)}return!0},syncEvent:function(a,b,c,e,d){a=/^\s*(\w+):\s*(\w+)$/.exec(d.details);switch(a[1]){case "start":this.gestureOpenSlice("SyncInterpret",e,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("SyncInterpret",e)}return!0},timerEvent:function(a,b,c,e,d){a=/^\s*(\w+):\s*(\w+)$/.exec(d.details);switch(a[1]){case "start":this.gestureOpenSlice("HandleTimer",e,{interpreter:a[2]});break;case "end":this.gestureCloseSlice("HandleTimer",e)}return!0}};c.registerSubtype(d);return{GestureParser:d}});
base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("i915_gem_object_create",d.prototype.gemObjectCreateEvent.bind(this));a.registerEventHandler("i915_gem_object_bind",d.prototype.gemObjectBindEvent.bind(this));a.registerEventHandler("i915_gem_object_unbind",d.prototype.gemObjectBindEvent.bind(this));a.registerEventHandler("i915_gem_object_change_domain",d.prototype.gemObjectChangeDomainEvent.bind(this));a.registerEventHandler("i915_gem_object_pread",
d.prototype.gemObjectPreadWriteEvent.bind(this));a.registerEventHandler("i915_gem_object_pwrite",d.prototype.gemObjectPreadWriteEvent.bind(this));a.registerEventHandler("i915_gem_object_fault",d.prototype.gemObjectFaultEvent.bind(this));a.registerEventHandler("i915_gem_object_clflush",d.prototype.gemObjectDestroyEvent.bind(this));a.registerEventHandler("i915_gem_object_destroy",d.prototype.gemObjectDestroyEvent.bind(this));a.registerEventHandler("i915_gem_ring_dispatch",d.prototype.gemRingDispatchEvent.bind(this));
a.registerEventHandler("i915_gem_ring_flush",d.prototype.gemRingFlushEvent.bind(this));a.registerEventHandler("i915_gem_request",d.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_add",d.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_complete",d.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_retire",d.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_request_wait_begin",d.prototype.gemRequestEvent.bind(this));
a.registerEventHandler("i915_gem_request_wait_end",d.prototype.gemRequestEvent.bind(this));a.registerEventHandler("i915_gem_ring_wait_begin",d.prototype.gemRingWaitEvent.bind(this));a.registerEventHandler("i915_gem_ring_wait_end",d.prototype.gemRingWaitEvent.bind(this));a.registerEventHandler("i915_reg_rw",d.prototype.regRWEvent.bind(this));a.registerEventHandler("i915_flip_request",d.prototype.flipEvent.bind(this));a.registerEventHandler("i915_flip_complete",d.prototype.flipEvent.bind(this))}var c=
tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,i915FlipOpenSlice:function(a,b,c){var e=this.importer.getOrCreatePseudoThread("i915_flip");e.openSliceTS=a;e.openSlice="flip:"+b+"/"+c},i915FlipCloseSlice:function(a,b){var c=this.importer.getOrCreatePseudoThread("i915_flip");if(c.openSlice){var e=new tracing.model.Slice("",c.openSlice,tracing.getStringColorId(c.openSlice),c.openSliceTS,b,a-c.openSliceTS);c.thread.pushSlice(e)}c.openSlice=void 0},i915GemObjectSlice:function(a,b,
c,e){var d=this.importer.getOrCreatePseudoThread("i915_gem");d.openSlice=b+":"+c;a=new tracing.model.Slice("",d.openSlice,tracing.getStringColorId(d.openSlice),a,e,0);d.thread.pushSlice(a)},i915GemRingSlice:function(a,b,c,e,d){var j=this.importer.getOrCreatePseudoThread("i915_gem_ring");j.openSlice=b+":"+c+"."+e;a=new tracing.model.Slice("",j.openSlice,tracing.getStringColorId(j.openSlice),a,d,0);j.thread.pushSlice(a)},i915RegSlice:function(a,b,c,e){var d=this.importer.getOrCreatePseudoThread("i915_reg");
d.openSlice=b+":"+c;a=new tracing.model.Slice("",d.openSlice,tracing.getStringColorId(d.openSlice),a,e,0);d.thread.pushSlice(a)},gemObjectCreateEvent:function(a,b,c,e,d){c=/obj=(\w+), size=(\d+)/.exec(d.details);if(!c)return!1;b=c[1];c=parseInt(c[2]);this.i915GemObjectSlice(e,a,b,{obj:b,size:c});return!0},gemObjectBindEvent:function(a,b,c,e,d){d=/obj=(\w+), offset=(\w+), size=(\d+)/.exec(d.details);if(!d)return!1;b=d[1];c=d[2];d=parseInt(d[3]);this.i915ObjectGemSlice(e,a+":"+b,{obj:b,offset:c,size:d});
return!0},gemObjectChangeDomainEvent:function(a,b,c,e,d){b=/obj=(\w+), read=(\w+=>\w+), write=(\w+=>\w+)/.exec(d.details);if(!b)return!1;c=b[1];this.i915GemObjectSlice(e,a,c,{obj:c,read:b[2],write:b[3]});return!0},gemObjectPreadWriteEvent:function(a,b,c,e,d){d=/obj=(\w+), offset=(\d+), len=(\d+)/.exec(d.details);if(!d)return!1;b=d[1];c=parseInt(d[2]);d=parseInt(d[3]);this.i915GemObjectSlice(e,a,b,{obj:b,offset:c,len:d});return!0},gemObjectFaultEvent:function(a,b,c,e,d){d=/obj=(\w+), (\w+) index=(\d+)/.exec(d.details);
if(!d)return!1;b=d[1];c=d[2];d=parseInt(d[3]);this.i915GemObjectSlice(e,a,b,{obj:b,type:c,index:d});return!0},gemObjectDestroyEvent:function(a,b,c,e,d){b=/obj=(\w+)/.exec(d.details);if(!b)return!1;b=b[1];this.i915GemObjectSlice(e,a,b,{obj:b});return!0},gemRingDispatchEvent:function(a,b,c,e,d){d=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(d.details);if(!d)return!1;b=parseInt(d[1]);c=parseInt(d[2]);d=parseInt(d[3]);this.i915GemRingSlice(e,a,b,c,{dev:b,ring:c,seqno:d});return!0},gemRingFlushEvent:function(a,
b,c,e,d){b=/dev=(\d+), ring=(\w+), invalidate=(\w+), flush=(\w+)/.exec(d.details);if(!b)return!1;c=parseInt(b[1]);d=parseInt(b[2]);this.i915GemRingSlice(e,a,c,d,{dev:c,ring:d,invalidate:b[3],flush:b[4]});return!0},gemRequestEvent:function(a,b,c,e,d){d=/dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(d.details);if(!d)return!1;b=parseInt(d[1]);c=parseInt(d[2]);d=parseInt(d[3]);this.i915GemRingSlice(e,a,b,c,{dev:b,ring:c,seqno:d});return!0},gemRingWaitEvent:function(a,b,c,e,d){c=/dev=(\d+), ring=(\d+)/.exec(d.details);
if(!c)return!1;b=parseInt(c[1]);c=parseInt(c[2]);this.i915GemRingSlice(e,a,b,c,{dev:b,ring:c});return!0},regRWEvent:function(a,b,c,e,d){a=/(\w+) reg=(\w+), len=(\d+), val=(\(\w+, \w+\))/.exec(d.details);if(!a)return!1;b=a[1];c=a[2];this.i915RegSlice(e,b,c,{rw:b,reg:c,len:a[3],data:a[3]});return!0},flipEvent:function(a,b,c,e,d){c=/plane=(\d+), obj=(\w+)/.exec(d.details);if(!c)return!1;b=parseInt(c[1]);c=c[2];"i915_flip_request"==a?this.i915FlipOpenSlice(e,c,b):this.i915FlipCloseSlice(e,{obj:c,plane:b});
return!0}};c.registerSubtype(d);return{I915Parser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("mali_dvfs_event",d.prototype.dvfsEventEvent.bind(this));a.registerEventHandler("mali_dvfs_set_clock",d.prototype.dvfsSetClockEvent.bind(this));a.registerEventHandler("mali_dvfs_set_voltage",d.prototype.dvfsSetVoltageEvent.bind(this));this.addJMCounter("mali_hwc_MESSAGES_SENT","Messages Sent");this.addJMCounter("mali_hwc_MESSAGES_RECEIVED","Messages Received");this.addJMCycles("mali_hwc_GPU_ACTIVE",
"GPU Active");this.addJMCycles("mali_hwc_IRQ_ACTIVE","IRQ Active");for(var b=0;7>b;b++){var f="JS"+b,e="mali_hwc_"+f;this.addJMCounter(e+"_JOBS",f+" Jobs");this.addJMCounter(e+"_TASKS",f+" Tasks");this.addJMCycles(e+"_ACTIVE",f+" Active");this.addJMCycles(e+"_WAIT_READ",f+" Wait Read");this.addJMCycles(e+"_WAIT_ISSUE",f+" Wait Issue");this.addJMCycles(e+"_WAIT_DEPEND",f+" Wait Depend");this.addJMCycles(e+"_WAIT_FINISH",f+" Wait Finish")}this.addTilerCounter("mali_hwc_TRIANGLES","Triangles");this.addTilerCounter("mali_hwc_QUADS",
"Quads");this.addTilerCounter("mali_hwc_POLYGONS","Polygons");this.addTilerCounter("mali_hwc_POINTS","Points");this.addTilerCounter("mali_hwc_LINES","Lines");this.addTilerCounter("mali_hwc_VCACHE_HIT","VCache Hit");this.addTilerCounter("mali_hwc_VCACHE_MISS","VCache Miss");this.addTilerCounter("mali_hwc_FRONT_FACING","Front Facing");this.addTilerCounter("mali_hwc_BACK_FACING","Back Facing");this.addTilerCounter("mali_hwc_PRIM_VISIBLE","Prim Visible");this.addTilerCounter("mali_hwc_PRIM_CULLED","Prim Culled");
this.addTilerCounter("mali_hwc_PRIM_CLIPPED","Prim Clipped");this.addTilerCounter("mali_hwc_WRBUF_HIT","Wrbuf Hit");this.addTilerCounter("mali_hwc_WRBUF_MISS","Wrbuf Miss");this.addTilerCounter("mali_hwc_WRBUF_LINE","Wrbuf Line");this.addTilerCounter("mali_hwc_WRBUF_PARTIAL","Wrbuf Partial");this.addTilerCounter("mali_hwc_WRBUF_STALL","Wrbuf Stall");this.addTilerCycles("mali_hwc_ACTIVE","Tiler Active");this.addTilerCycles("mali_hwc_INDEX_WAIT","Index Wait");this.addTilerCycles("mali_hwc_INDEX_RANGE_WAIT",
"Index Range Wait");this.addTilerCycles("mali_hwc_VERTEX_WAIT","Vertex Wait");this.addTilerCycles("mali_hwc_PCACHE_WAIT","Pcache Wait");this.addTilerCycles("mali_hwc_WRBUF_WAIT","Wrbuf Wait");this.addTilerCycles("mali_hwc_BUS_READ","Bus Read");this.addTilerCycles("mali_hwc_BUS_WRITE","Bus Write");this.addTilerCycles("mali_hwc_TILER_UTLB_STALL","Tiler UTLB Stall");this.addTilerCycles("mali_hwc_TILER_UTLB_HIT","Tiler UTLB Hit");this.addFragCycles("mali_hwc_FRAG_ACTIVE","Active");this.addFragCounter("mali_hwc_FRAG_PRIMATIVES",
"Primitives");this.addFragCounter("mali_hwc_FRAG_PRIMATIVES_DROPPED","Primitives Dropped");this.addFragCycles("mali_hwc_FRAG_CYCLE_DESC","Descriptor Processing");this.addFragCycles("mali_hwc_FRAG_CYCLES_PLR","PLR Processing??");this.addFragCycles("mali_hwc_FRAG_CYCLES_VERT","Vertex Processing");this.addFragCycles("mali_hwc_FRAG_CYCLES_TRISETUP","Triangle Setup");this.addFragCycles("mali_hwc_FRAG_CYCLES_RAST","Rasterization???");this.addFragCounter("mali_hwc_FRAG_THREADS","Threads");this.addFragCounter("mali_hwc_FRAG_DUMMY_THREADS",
"Dummy Threads");this.addFragCounter("mali_hwc_FRAG_QUADS_RAST","Quads Rast");this.addFragCounter("mali_hwc_FRAG_QUADS_EZS_TEST","Quads EZS Test");this.addFragCounter("mali_hwc_FRAG_QUADS_EZS_KILLED","Quads EZS Killed");this.addFragCounter("mali_hwc_FRAG_QUADS_LZS_TEST","Quads LZS Test");this.addFragCounter("mali_hwc_FRAG_QUADS_LZS_KILLED","Quads LZS Killed");this.addFragCycles("mali_hwc_FRAG_CYCLE_NO_TILE","No Tiles");this.addFragCounter("mali_hwc_FRAG_NUM_TILES","Tiles");this.addFragCounter("mali_hwc_FRAG_TRANS_ELIM",
"Transactions Eliminated");this.addComputeCycles("mali_hwc_COMPUTE_ACTIVE","Active");this.addComputeCounter("mali_hwc_COMPUTE_TASKS","Tasks");this.addComputeCounter("mali_hwc_COMPUTE_THREADS","Threads Started");this.addComputeCycles("mali_hwc_COMPUTE_CYCLES_DESC","Waiting for Descriptors");this.addTripipeCycles("mali_hwc_TRIPIPE_ACTIVE","Active");this.addArithCounter("mali_hwc_ARITH_WORDS","Instructions (/Pipes)");this.addArithCycles("mali_hwc_ARITH_CYCLES_REG","Reg scheduling stalls (/Pipes)");this.addArithCycles("mali_hwc_ARITH_CYCLES_L0",
"L0 cache miss stalls (/Pipes)");this.addArithCounter("mali_hwc_ARITH_FRAG_DEPEND","Frag dep check failures (/Pipes)");this.addLSCounter("mali_hwc_LS_WORDS","Instruction Words Completed");this.addLSCounter("mali_hwc_LS_ISSUES","Full Pipeline Issues");this.addLSCounter("mali_hwc_LS_RESTARTS","Restarts (unpairable insts)");this.addLSCounter("mali_hwc_LS_REISSUES_MISS","Pipeline reissue (cache miss/uTLB)");this.addLSCounter("mali_hwc_LS_REISSUES_VD","Pipeline reissue (varying data)");this.addLSCounter("mali_hwc_LS_REISSUE_ATTRIB_MISS",
"Pipeline reissue (attribute cache miss)");this.addLSCounter("mali_hwc_LS_REISSUE_NO_WB","Writeback not used");this.addTexCounter("mali_hwc_TEX_WORDS","Words");this.addTexCounter("mali_hwc_TEX_BUBBLES","Bubbles");this.addTexCounter("mali_hwc_TEX_WORDS_L0","Words L0");this.addTexCounter("mali_hwc_TEX_WORDS_DESC","Words Desc");this.addTexCounter("mali_hwc_TEX_THREADS","Threads");this.addTexCounter("mali_hwc_TEX_RECIRC_FMISS","Recirc due to Full Miss");this.addTexCounter("mali_hwc_TEX_RECIRC_DESC","Recirc due to Desc Miss");
this.addTexCounter("mali_hwc_TEX_RECIRC_MULTI","Recirc due to Multipass");this.addTexCounter("mali_hwc_TEX_RECIRC_PMISS","Recirc due to Partial Cache Miss");this.addTexCounter("mali_hwc_TEX_RECIRC_CONF","Recirc due to Cache Conflict");this.addLSCCounter("mali_hwc_LSC_READ_HITS","Read Hits");this.addLSCCounter("mali_hwc_LSC_READ_MISSES","Read Misses");this.addLSCCounter("mali_hwc_LSC_WRITE_HITS","Write Hits");this.addLSCCounter("mali_hwc_LSC_WRITE_MISSES","Write Misses");this.addLSCCounter("mali_hwc_LSC_ATOMIC_HITS",
"Atomic Hits");this.addLSCCounter("mali_hwc_LSC_ATOMIC_MISSES","Atomic Misses");this.addLSCCounter("mali_hwc_LSC_LINE_FETCHES","Line Fetches");this.addLSCCounter("mali_hwc_LSC_DIRTY_LINE","Dirty Lines");this.addLSCCounter("mali_hwc_LSC_SNOOPS","Snoops");this.addAXICounter("mali_hwc_AXI_TLB_STALL","Address channel stall");this.addAXICounter("mali_hwc_AXI_TLB_MISS","Cache Miss");this.addAXICounter("mali_hwc_AXI_TLB_TRANSACTION","Transactions");this.addAXICounter("mali_hwc_LS_TLB_MISS","LS Cache Miss");
this.addAXICounter("mali_hwc_LS_TLB_HIT","LS Cache Hit");this.addAXICounter("mali_hwc_AXI_BEATS_READ","Read Beats");this.addAXICounter("mali_hwc_AXI_BEATS_WRITE","Write Beats");this.addMMUCounter("mali_hwc_MMU_TABLE_WALK","Page Table Walks");this.addMMUCounter("mali_hwc_MMU_REPLAY_MISS","Cache Miss from Replay Buffer");this.addMMUCounter("mali_hwc_MMU_REPLAY_FULL","Replay Buffer Full");this.addMMUCounter("mali_hwc_MMU_NEW_MISS","Cache Miss on New Request");this.addMMUCounter("mali_hwc_MMU_HIT","Cache Hit");
this.addMMUCycles("mali_hwc_UTLB_STALL","UTLB Stalled");this.addMMUCycles("mali_hwc_UTLB_REPLAY_MISS","UTLB Replay Miss");this.addMMUCycles("mali_hwc_UTLB_REPLAY_FULL","UTLB Replay Full");this.addMMUCycles("mali_hwc_UTLB_NEW_MISS","UTLB New Miss");this.addMMUCycles("mali_hwc_UTLB_HIT","UTLB Hit");this.addL2Counter("mali_hwc_L2_READ_BEATS","Read Beats");this.addL2Counter("mali_hwc_L2_WRITE_BEATS","Write Beats");this.addL2Counter("mali_hwc_L2_ANY_LOOKUP","Any Lookup");this.addL2Counter("mali_hwc_L2_READ_LOOKUP",
"Read Lookup");this.addL2Counter("mali_hwc_L2_SREAD_LOOKUP","Shareable Read Lookup");this.addL2Counter("mali_hwc_L2_READ_REPLAY","Read Replayed");this.addL2Counter("mali_hwc_L2_READ_SNOOP","Read Snoop");this.addL2Counter("mali_hwc_L2_READ_HIT","Read Cache Hit");this.addL2Counter("mali_hwc_L2_CLEAN_MISS","CleanUnique Miss");this.addL2Counter("mali_hwc_L2_WRITE_LOOKUP","Write Lookup");this.addL2Counter("mali_hwc_L2_SWRITE_LOOKUP","Shareable Write Lookup");this.addL2Counter("mali_hwc_L2_WRITE_REPLAY",
"Write Replayed");this.addL2Counter("mali_hwc_L2_WRITE_SNOOP","Write Snoop");this.addL2Counter("mali_hwc_L2_WRITE_HIT","Write Cache Hit");this.addL2Counter("mali_hwc_L2_EXT_READ_FULL","ExtRD with BIU Full");this.addL2Counter("mali_hwc_L2_EXT_READ_HALF","ExtRD with BIU >1/2 Full");this.addL2Counter("mali_hwc_L2_EXT_WRITE_FULL","ExtWR with BIU Full");this.addL2Counter("mali_hwc_L2_EXT_WRITE_HALF","ExtWR with BIU >1/2 Full");this.addL2Counter("mali_hwc_L2_EXT_READ","External Read (ExtRD)");this.addL2Counter("mali_hwc_L2_EXT_READ_LINE",
"ExtRD (linefill)");this.addL2Counter("mali_hwc_L2_EXT_WRITE","External Write (ExtWR)");this.addL2Counter("mali_hwc_L2_EXT_WRITE_LINE","ExtWR (linefill)");this.addL2Counter("mali_hwc_L2_EXT_WRITE_SMALL","ExtWR (burst size <64B)");this.addL2Counter("mali_hwc_L2_EXT_BARRIER","External Barrier");this.addL2Counter("mali_hwc_L2_EXT_AR_STALL","Address Read stalls");this.addL2Counter("mali_hwc_L2_EXT_R_BUF_FULL","Response Buffer full stalls");this.addL2Counter("mali_hwc_L2_EXT_RD_BUF_FULL","Read Data Buffer full stalls");
this.addL2Counter("mali_hwc_L2_EXT_R_RAW","RAW hazard stalls");this.addL2Counter("mali_hwc_L2_EXT_W_STALL","Write Data stalls");this.addL2Counter("mali_hwc_L2_EXT_W_BUF_FULL","Write Data Buffer full");this.addL2Counter("mali_hwc_L2_EXT_R_W_HAZARD","WAW or WAR hazard stalls");this.addL2Counter("mali_hwc_L2_TAG_HAZARD","Tag hazard replays");this.addL2Cycles("mali_hwc_L2_SNOOP_FULL","Snoop buffer full");this.addL2Cycles("mali_hwc_L2_REPLAY_FULL","Replay buffer full");a.registerEventHandler("tracing_mark_write:mali_driver",
d.prototype.maliDDKEvent.bind(this));this.model_=a.model_}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,maliDDKOpenSlice:function(a,b,c,e,d){a=this.importer.model_.getOrCreateProcess(a).getOrCreateThread(b);e=/^([\w\d_]*)(?:\(\))?:?\s*(.*)$/.exec(e);a.beginSlice("gpu-driver",e[1],c,{args:e[2],blockinfo:d})},maliDDKCloseSlice:function(a,b,c){a=this.importer.model_.getOrCreateProcess(a).getOrCreateThread(b);a.openSliceCount&&a.endSlice(c)},autoDetectLineRE:function(a){var b=
/^\s*\(([\w\-]*)\)\s*(\w+):\s*([\w\\\/\.\-]*@\d*):?\s*(.*)$/;if(b.test(a))return b;b=/^s*()(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/;return b.test(a)?b:null},lineRE:null,maliDDKEvent:function(a,b,c,e,d){if(null==this.lineRE&&(this.lineRE=this.autoDetectLineRE(d.details),null==this.lineRE))return!1;a=this.lineRE.exec(d.details);b=""===a[1]?"mali":a[1];switch(a[2]){case "cros_trace_print_enter":this.maliDDKOpenSlice(c,b,e,a[4],a[3]);break;case "cros_trace_print_exit":this.maliDDKCloseSlice(c,b,e,[],a[3])}return!0},
dvfsSample:function(a,b,c,e){e=parseInt(e);a=this.model_.getOrCreateProcess(0).getOrCreateCounter("DVFS",a);0==a.numSeries&&(a.seriesNames.push(b),a.seriesColors.push(tracing.getStringColorId(a.name)));a.timestamps.push(c);a.samples.push(e)},dvfsEventEvent:function(a,b,c,e,d){a=/utilization=(\d+)/.exec(d.details);if(!a)return!1;this.dvfsSample("DVFS Utilization","utilization",e,a[1]);return!0},dvfsSetClockEvent:function(a,b,c,e,d){a=/frequency=(\d+)/.exec(d.details);if(!a)return!1;this.dvfsSample("DVFS Frequency",
"frequency",e,a[1]);return!0},dvfsSetVoltageEvent:function(a,b,c,e,d){a=/voltage=(\d+)/.exec(d.details);if(!a)return!1;this.dvfsSample("DVFS Voltage","voltage",e,a[1]);return!0},hwcSample:function(a,b,c,e,d){d=/val=(\d+)/.exec(d.details);if(!d)return!1;d=parseInt(d[1]);a=this.model_.getOrCreateProcess(0).getOrCreateCounter(a,b);0==a.numSeries&&(a.seriesNames.push(c),a.seriesColors.push(tracing.getStringColorId(a.name)));a.timestamps.push(e);a.samples.push(d);return!0},jmSample:function(a,b,c,e){return this.hwcSample("mali:jm",
"JM: "+a,b,c,e)},addJMCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.jmSample(b,"count",j,h)}.bind(this))},addJMCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.jmSample(b,"cycles",j,h)}.bind(this))},tilerSample:function(a,b,c,e){return this.hwcSample("mali:tiler","Tiler: "+a,b,c,e)},addTilerCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.tilerSample(b,"count",j,h)}.bind(this))},
addTilerCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.tilerSample(b,"cycles",j,h)}.bind(this))},fragSample:function(a,b,c,e){return this.hwcSample("mali:fragment","Fragment: "+a,b,c,e)},addFragCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.fragSample(b,"count",j,h)}.bind(this))},addFragCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.fragSample(b,"cycles",j,h)}.bind(this))},
computeSample:function(a,b,c,e){return this.hwcSample("mali:compute","Compute: "+a,b,c,e)},addComputeCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.computeSample(b,"count",j,h)}.bind(this))},addComputeCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.computeSample(b,"cycles",j,h)}.bind(this))},addTripipeCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.hwcSample("mali:shader",
"Tripipe: "+b,"cycles",j,h)}.bind(this))},arithSample:function(a,b,c,e){return this.hwcSample("mali:arith","Arith: "+a,b,c,e)},addArithCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.arithSample(b,"count",j,h)}.bind(this))},addArithCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.arithSample(b,"cycles",j,h)}.bind(this))},addLSCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.hwcSample("mali:ls",
"LS: "+b,"count",j,h)}.bind(this))},textureSample:function(a,b,c,e){return this.hwcSample("mali:texture","Texture: "+a,b,c,e)},addTexCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.textureSample(b,"count",j,h)}.bind(this))},addLSCCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.hwcSample("mali:lsc","LSC: "+b,"count",j,h)}.bind(this))},addAXICounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,
j,h){return this.hwcSample("mali:axi","AXI: "+b,"count",j,h)}.bind(this))},mmuSample:function(a,b,c,e){return this.hwcSample("mali:mmu","MMU: "+a,b,c,e)},addMMUCounter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.mmuSample(b,"count",j,h)}.bind(this))},addMMUCycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.mmuSample(b,"cycles",j,h)}.bind(this))},l2Sample:function(a,b,c,e){return this.hwcSample("mali:l2","L2: "+a,b,c,e)},
addL2Counter:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.l2Sample(b,"count",j,h)}.bind(this))},addL2Cycles:function(a,b){this.importer.registerEventHandler(a,function(a,c,d,j,h){return this.l2Sample(b,"cycles",j,h)}.bind(this))}};c.registerSubtype(d);return{MaliParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("power_start",d.prototype.powerStartEvent.bind(this));a.registerEventHandler("power_frequency",d.prototype.powerFrequencyEvent.bind(this));a.registerEventHandler("cpu_frequency",d.prototype.cpuFrequencyEvent.bind(this));a.registerEventHandler("cpu_idle",d.prototype.cpuIdleEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;d.prototype={__proto__:c.prototype,cpuStateSlice:function(a,b,
c,e){b=this.importer.getOrCreateCpuState(b);"1"!=c?this.importer.importError("Don't understand power_start events of type "+c):(c=b.cpu.getOrCreateCounter("","C-State"),0==c.numSeries&&(c.seriesNames.push("state"),c.seriesColors.push(tracing.getStringColorId(c.name+".state"))),c.timestamps.push(a),c.samples.push(e))},cpuIdleSlice:function(a,b,c){b=this.importer.getOrCreateCpuState(b).cpu.getOrCreateCounter("","C-State");0==b.numSeries&&(b.seriesNames.push("state"),b.seriesColors.push(tracing.getStringColorId(b.name)));
4294967295!=c?b.samples.push(c):b.samples.push(0);b.timestamps.push(a)},cpuFrequencySlice:function(a,b,c){b=this.importer.getOrCreateCpuState(b).cpu.getOrCreateCounter("","Clock Frequency");0==b.numSeries&&(b.seriesNames.push("state"),b.seriesColors.push(tracing.getStringColorId(b.name+".state")));b.timestamps.push(a);b.samples.push(c)},powerStartEvent:function(a,b,c,e,d){a=/type=(\d+) state=(\d) cpu_id=(\d)+/.exec(d.details);if(!a)return!1;b=parseInt(a[3]);c=parseInt(a[2]);this.cpuStateSlice(e,b,
a[1],c);return!0},powerFrequencyEvent:function(a,b,c,e,d){b=/type=(\d+) state=(\d+) cpu_id=(\d)+/.exec(d.details);if(!b)return!1;a=parseInt(b[3]);b=parseInt(b[2]);this.cpuFrequencySlice(e,a,b);return!0},cpuFrequencyEvent:function(a,b,c,e,d){b=/state=(\d+) cpu_id=(\d)+/.exec(d.details);if(!b)return!1;a=parseInt(b[2]);b=parseInt(b[1]);this.cpuFrequencySlice(e,a,b);return!0},cpuIdleEvent:function(a,b,c,e,d){b=/state=(\d+) cpu_id=(\d)+/.exec(d.details);if(!b)return!1;a=parseInt(b[2]);b=parseInt(b[1]);
this.cpuIdleSlice(e,a,b);return!0}};c.registerSubtype(d);return{PowerParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("sched_switch",d.prototype.schedSwitchEvent.bind(this));a.registerEventHandler("sched_wakeup",d.prototype.schedWakeupEvent.bind(this))}var c=tracing.importer.linux_perf.Parser;TestExports={};var a=RegExp("prev_comm=(.+) prev_pid=(\\d+) prev_prio=(\\d+) prev_state=(\\S\\+?|\\S\\|\\S) ==> next_comm=(.+) next_pid=(\\d+) next_prio=(\\d+)");TestExports.schedSwitchRE=a;var b=/comm=(.+) pid=(\d+) prio=(\d+) success=(\d+) target_cpu=(\d+)/;
TestExports.schedWakeupRE=b;d.prototype={__proto__:c.prototype,schedSwitchEvent:function(b,c,d,j,h){var k=a.exec(h.details);if(!k)return!1;b=k[4];d=k[5];h=parseInt(k[6]);k=parseInt(k[7]);this.importer.getOrCreateCpuState(c).switchRunningLinuxPid(this.importer,b,j,h,d,k);return!0},schedWakeupEvent:function(a,c,d,j,h){h=b.exec(h.details);if(!h)return!1;a=d;c=h[1];d=parseInt(h[2]);h=parseInt(h[3]);this.importer.markPidRunnable(j,d,c,h,a);return!0}};c.registerSubtype(d);return{SchedParser:d,_SchedParserTestExports:TestExports}});
base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("workqueue_execute_start",d.prototype.executeStartEvent.bind(this));a.registerEventHandler("workqueue_execute_end",d.prototype.executeEndEvent.bind(this));a.registerEventHandler("workqueue_queue_work",d.prototype.executeQueueWork.bind(this));a.registerEventHandler("workqueue_activate_work",d.prototype.executeActivateWork.bind(this))}var c=tracing.importer.linux_perf.Parser,a=/work struct (.+): function (\S+)/,
b=/work struct (.+)/;d.prototype={__proto__:c.prototype,executeStartEvent:function(b,c,d,j,h){b=a.exec(h.details);if(!b)return!1;d=this.importer.getOrCreateKernelThread(h.threadName,d,d);d.openSliceTS=j;d.openSlice=b[2];return!0},executeEndEvent:function(a,c,d,j,h){if(!b.exec(h.details))return!1;a=this.importer.getOrCreateKernelThread(h.threadName,d,d);a.openSlice&&(j=new tracing.model.Slice("",a.openSlice,tracing.getStringColorId(a.openSlice),a.openSliceTS,{},j-a.openSliceTS),a.thread.pushSlice(j));
a.openSlice=void 0;return!0},executeQueueWork:function(){return!0},executeActivateWork:function(){return!0}};c.registerSubtype(d);return{WorkqueueParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(b){a.call(this,b);b.registerEventHandler("tracing_mark_write:android",d.prototype.traceMarkWriteAndroidEvent.bind(this));b.registerEventHandler("0:android",d.prototype.traceMarkWriteAndroidEvent.bind(this));this.model_=b.model_;this.ppids_={}}function c(a){var c={};if(a){a=a.split(";");for(var e=0;e<a.length;++e){var d=a[e].split("=");d[0]&&(c[d.shift()]=d.join("="))}}return c}var a=tracing.importer.linux_perf.Parser;d.prototype={__proto__:a.prototype,
traceMarkWriteAndroidEvent:function(a,d,e,g,j){a=j.details.split("|");switch(a[0]){case "B":d=parseInt(a[1]);var h=a[4],k=a[2],l=this.model_.getOrCreateProcess(d).getOrCreateThread(e);l.name=j.threadName;if(!l.isTimestampValidForBeginOrEnd(g))return this.model_.importErrors.push("Timestamps are moving backward."),!1;this.ppids_[e]=d;l.beginSlice(h,k,g,c(a[3]));break;case "E":d=this.ppids_[e];if(void 0===d)break;l=this.model_.getOrCreateProcess(d).getOrCreateThread(e);if(!l.openSliceCount)break;g=
l.endSlice(g);a=c(a[3]);for(h in a)void 0!==g.args[h]&&this.model_.importErrors.push("Both the B and E events of "+g.title+"provided values for argument "+h+". The value of the E event will be used."),g.args[h]=a[h];break;case "C":d=parseInt(a[1]);j=a[2];e=parseInt(a[3]);h=a[4];a=this.model_.getOrCreateProcess(d).getOrCreateCounter(h,j);0==a.numSeries&&(a.seriesNames.push("value"),a.seriesColors.push(tracing.getStringColorId(a.name+".value")));a.timestamps.push(g);a.samples.push(e);break;default:return!1}return!0}};
a.registerSubtype(d);return{AndroidParser:d}});base.require("importer.linux_perf.parser");
base.exportTo("tracing.importer.linux_perf",function(){function d(a){c.call(this,a);a.registerEventHandler("graph_ent",d.prototype.traceKernelFuncEnterEvent.bind(this));a.registerEventHandler("graph_ret",d.prototype.traceKernelFuncReturnEvent.bind(this));this.model_=a.model_;this.ppids_={}}var c=tracing.importer.linux_perf.Parser;TestExports={};var a=/func=(.+)/;TestExports.funcEnterRE=a;d.prototype={__proto__:c.prototype,traceKernelFuncEnterEvent:function(b,c,e,d,j){b=a.exec(j.details);if(!b||void 0===
j.tgid)return!1;c=parseInt(j.tgid);b=b[1];e=this.model_.getOrCreateProcess(c).getOrCreateThread(e);e.name=j.threadName;j=e.kernelSlices;if(!j.isTimestampValidForBeginOrEnd(d))return this.model_.importErrors.push("Timestamps are moving backward."),!1;slice=j.beginSlice(null,b,d,{});return!0},traceKernelFuncReturnEvent:function(a,c,e,d,j){if(void 0===j.tgid)return!1;a=parseInt(j.tgid);e=this.model_.getOrCreateProcess(a).getOrCreateThread(e);e.name=j.threadName;j=e.kernelSlices;if(!j.isTimestampValidForBeginOrEnd(d))return this.model_.importErrors.push("Timestamps are moving backward."),
!1;0<j.openSliceCount&&j.endSlice(d);return!0}};c.registerSubtype(d);return{KernelFuncParser:d}});"use strict";base.require("model");base.require("color_scheme");base.require("importer.linux_perf.bus_parser");base.require("importer.linux_perf.clock_parser");base.require("importer.linux_perf.cpufreq_parser");base.require("importer.linux_perf.disk_parser");base.require("importer.linux_perf.drm_parser");base.require("importer.linux_perf.exynos_parser");base.require("importer.linux_perf.gesture_parser");
base.require("importer.linux_perf.i915_parser");base.require("importer.linux_perf.mali_parser");base.require("importer.linux_perf.power_parser");base.require("importer.linux_perf.sched_parser");base.require("importer.linux_perf.workqueue_parser");base.require("importer.linux_perf.android_parser");base.require("importer.linux_perf.kfunc_parser");
base.exportTo("tracing.importer",function(){function d(a){this.cpu=a}function c(a,b){this.importPriority=2;this.model_=a;this.events_=b;this.clockSyncRecords_=[];this.cpuStates_={};this.wakeups_=[];this.kernelThreadStates_={};this.buildMapFromLinuxPidsToThreads();this.lineNumberBase=0;this.lineNumber=-1;this.pseudoThreadCounter=1;this.parsers_=[];this.eventHandlers_={}}function a(a){return b.test(a)?f:e.test(a)?g:j.test(a)?h:null}d.prototype={__proto__:Object.prototype,switchRunningLinuxPid:function(a,
b,c,e,d,f){if(void 0!==this.lastActivePid&&0!=this.lastActivePid){var g=c-this.lastActiveTs;a=(a=a.threadsByLinuxPid[this.lastActivePid])?a.userFriendlyName:this.lastActiveComm;b=new tracing.model.Slice("",a,tracing.getStringColorId(a),this.lastActiveTs,{comm:this.lastActiveComm,tid:this.lastActivePid,prio:this.lastActivePrio,stateWhenDescheduled:b},g);this.cpu.slices.push(b)}this.lastActiveTs=c;this.lastActivePid=e;this.lastActiveComm=d;this.lastActivePrio=f}};TestExports={};var b=RegExp("^\\s*(.+)-(\\d+)\\s+\\(\\s*(\\d+|-+)\\)\\s\\[(\\d+)\\]\\s+[dX.][N.][Hhs.][0-9a-f.]\\s+(\\d+\\.\\d+):\\s+(\\S+):\\s(.*)$"),
f=function(a){a=b.exec(a);if(!a)return a;var c=a[3];"-"===c[0]&&(c=void 0);return{threadName:a[1],pid:a[2],tgid:c,cpuNumber:a[4],timestamp:a[5],eventName:a[6],details:a[7]}};TestExports.lineParserWithTGID=f;var e=/^\s*(.+)-(\d+)\s+\[(\d+)\]\s+[dX.][N.][Hhs.][0-9a-f.]\s+(\d+\.\d+):\s+(\S+):\s(.*)$/,g=function(a){a=e.exec(a);return!a?a:{threadName:a[1],pid:a[2],cpuNumber:a[3],timestamp:a[4],eventName:a[5],details:a[6]}};TestExports.lineParserWithIRQInfo=g;var j=/^\s*(.+)-(\d+)\s+\[(\d+)\]\s*(\d+\.\d+):\s+(\S+):\s(.*)$/,
h=function(a){a=j.exec(a);return!a?a:{threadName:a[1],pid:a[2],cpuNumber:a[3],timestamp:a[4],eventName:a[5],details:a[6]}};TestExports.lineParserWithLegacyFmt=h;TestExports.traceEventClockSyncRE=/trace_event_clock_sync: parent_ts=(\d+\.?\d*)/;TestExports.autoDetectLineParser=a;c.canImport=function(b){if(!("string"===typeof b||b instanceof String))return!1;if(c._extractEventsFromSystraceHTML(b,!1).ok||/^# tracer:/.test(b))return!0;var e=/^(.+)\n/.exec(b);e&&(b=e[1]);return a(b)?!0:!1};c._extractEventsFromSystraceHTML=
function(a,b){function c(a){for(;g<f.length;g++)if(a.test(f[g]))return!0;return!1}function e(a,b){return-1===a.indexOf(b,a.length-b.length)?a:a.substring(a,a.length-b.length)}var d={ok:!1};void 0===b&&(b=!0);if(!1==/^<!DOCTYPE HTML>/.test(a))return d;var f=a.split("\n"),g=1;if(!c(/^ <script>$/)||!c(/^ var linuxPerfData = "\\$/))return d;var h=g+1;if(!c(/^ <\/script>$/))return d;var j=g;if(!c(/^<\/body>$/)||!c(/^<\/html>$/))return d;var w=f.slice(h,j),j=[];if(b)for(var v=0;v<w.length;v++){var x=
w[v],x=e(x,"\\n\\");j.push(x)}else j=[w[w.length-1]];w=j[j.length-1];v=e(w,'\\n";');if(v==w)return d;j[j.length-1]=v;return{ok:!0,lines:b?j:void 0,events_begin_at_line:h}};c.prototype={__proto__:Object.prototype,get model(){return this.model_},buildMapFromLinuxPidsToThreads:function(){this.threadsByLinuxPid={};this.model_.getAllThreads().forEach(function(a){this.threadsByLinuxPid[a.tid]=a}.bind(this))},getOrCreateCpuState:function(a){if(!this.cpuStates_[a]){var b=this.model_.getOrCreateCpu(a);this.cpuStates_[a]=
new d(b)}return this.cpuStates_[a]},getOrCreateKernelThread:function(a,b,c){this.kernelThreadStates_[a]||(c=this.model_.getOrCreateProcess(b).getOrCreateThread(c),c.name=a,this.kernelThreadStates_[a]={pid:b,thread:c,openSlice:void 0,openSliceTS:void 0},this.threadsByLinuxPid[b]=c);return this.kernelThreadStates_[a]},getOrCreatePseudoThread:function(a){var b=this.kernelThreadStates_[a];b||(b=this.getOrCreateKernelThread(a,0,this.pseudoThreadCounter),this.pseudoThreadCounter++);return b},importEvents:function(a){this.createParsers();
this.importCpuData();this.alignClocks(a)&&(this.buildMapFromLinuxPidsToThreads(),this.buildPerThreadCpuSlicesFromCpuState())},finalizeImport:function(){},buildPerThreadCpuSlicesFromCpuState:function(){for(var a in this.cpuStates_)for(var b=this.cpuStates_[a].cpu,c=0;c<b.slices.length;c++){var e=b.slices[c],d=this.threadsByLinuxPid[e.args.tid];d&&(d.tempCpuSlices||(d.tempCpuSlices=[]),d.tempCpuSlices.push(e))}for(c in this.wakeups_)if(a=this.wakeups_[c],d=this.threadsByLinuxPid[a.tid])d.tempWakeups=
d.tempWakeups||[],d.tempWakeups.push(a);var f=tracing.getColorIdByName("running"),g=tracing.getColorIdByName("runnable"),h=tracing.getColorIdByName("sleeping"),j=tracing.getColorIdByName("iowait");this.model_.getAllThreads().forEach(function(a){if(void 0!==a.tempCpuSlices){var b=a.tempCpuSlices;delete a.tempCpuSlices;b.sort(function(a,b){return a.start-b.start});var c=a.tempWakeups||[];delete a.tempWakeups;c.sort(function(a,b){return a.ts-b.ts});var d=[];if(b.length){var e=b[0];if(c.length&&c[0].ts<
e.start){var k=c.shift();d.push(new tracing.model.Slice("","Runnable",g,k.ts,{"wakeup from tid":k.fromTid},e.start-k.ts))}d.push(new tracing.model.Slice("","Running",f,e.start,{},e.duration))}k=void 0;for(e=1;e<b.length;e++){for(var l=b[e-1],m=b[e],q=m.start-l.end;c.length&&c[0].ts<m.start;){var t=c.shift();void 0===k&&t.ts>l.end&&(k=t)}t=function(a,b){void 0!==k&&(q=k.ts-l.end);d.push(new tracing.model.Slice("",a,b,l.end,{},q));void 0!==k&&(d.push(new tracing.model.Slice("","Runnable",g,k.ts,{"wakeup from tid":k.fromTid},
m.start-k.ts)),k=void 0)};if("S"==l.args.stateWhenDescheduled)t("Sleeping",h);else if("R"==l.args.stateWhenDescheduled||"R+"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","Runnable",g,l.end,{},q));else if("D"==l.args.stateWhenDescheduled)t("Uninterruptible Sleep",j);else if("T"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","__TASK_STOPPED",j,l.end,{},q));else if("t"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","debug",j,l.end,{},q));else if("Z"==
l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","Zombie",j,l.end,{},q));else if("X"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","Exit Dead",j,l.end,{},q));else if("x"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","Task Dead",j,l.end,{},q));else if("W"==l.args.stateWhenDescheduled)d.push(new tracing.model.Slice("","WakeKill",j,l.end,{},q));else if("D|W"==l.args.stateWhenDescheduled)t("Uninterruptable Sleep | WakeKill",j);else throw Error("Unrecognized state: ")+
l.args.stateWhenDescheduled;d.push(new tracing.model.Slice("","Running",f,m.start,{},m.duration))}a.cpuSlices=d}})},alignClocks:function(a){if(0==this.clockSyncRecords_.length){if(!a)return!0;this.abortImport();return!1}a=this.clockSyncRecords_[0];if(0==a.parentTS||a.parentTS==a.perfTS)return!0;a=a.parentTS-a.perfTS;for(var b in this.cpuStates_){for(var c=this.cpuStates_[b].cpu,d=0;d<c.slices.length;d++){var e=c.slices[d];e.start+=a;e.duration=e.duration}for(var f in c.counters){d=c.counters[f];for(e=
0;e<d.timestamps.length;e++)d.timestamps[e]+=a}}for(var g in this.kernelThreadStates_)this.kernelThreadStates_[g].thread.shiftTimestampsForward(a);return!0},abortImport:function(){if(this.pushedEventsToThreads)throw Error("Cannot abort, have alrady pushedCpuDataToThreads.");for(var a in this.cpuStates_)delete this.model_.cpus[a];for(var b in this.kernelThreadStates_){a=this.kernelThreadStates_[b].thread;var c=a.parent;delete c.threads[a.tid];delete this.model_.processes[c.pid]}this.model_.importErrors.push("Cannot import kernel trace without a clock sync.")},
createParsers:function(){for(var a=tracing.importer.linux_perf.Parser.getSubtypeConstructors(),b=0;b<a.length;++b)this.parsers_.push(new a[b](this));this.registerEventHandler("tracing_mark_write:trace_event_clock_sync",c.prototype.traceClockSyncEvent.bind(this));this.registerEventHandler("tracing_mark_write",c.prototype.traceMarkingWriteEvent.bind(this));this.registerEventHandler("0:trace_event_clock_sync",c.prototype.traceClockSyncEvent.bind(this));this.registerEventHandler("0",c.prototype.traceMarkingWriteEvent.bind(this))},
registerEventHandler:function(a,b){this.eventHandlers_[a]=b},markPidRunnable:function(a,b,c,d,e){this.wakeups_.push({ts:a,tid:b,fromTid:e})},importError:function(a){this.model_.importErrors.push("Line "+(this.lineNumberBase+this.lineNumber+1)+": "+a)},traceClockSyncEvent:function(a,b,c,d,e){a=/parent_ts=(\d+\.?\d*)/.exec(e.details);if(!a)return!1;this.clockSyncRecords_.push({perfTS:d,parentTS:1E3*a[1]});return!0},traceMarkingWriteEvent:function(a,b,c,d,e,f){var g=/^\s*(\w+):\s*(.*)$/.exec(e.details);
if(g)e.subEventName=g[1],e.details=g[2];else if(g=e.details.substring(0,2),"B|"==g||"E"==g||"E|"==g||"C|"==g)e.subEventName="android";else return!1;a=a+":"+e.subEventName;g=this.eventHandlers_[a];return!g?(this.importError("Unknown trace_marking_write event "+a),!0):g(a,b,c,d,e,f)},importCpuData:function(){var b=c._extractEventsFromSystraceHTML(this.events_,!0);b.ok?(this.lineNumberBase=b.events_begin_at_line,this.lines_=b.lines):(this.lineNumberBase=0,this.lines_=this.events_.split("\n"));b=null;
for(this.lineNumber=0;this.lineNumber<this.lines_.length;++this.lineNumber){var e=this.lines_[this.lineNumber];if(!(0==e.length||/^#/.test(e))){if(null==b&&(b=a(e),null==b)){this.importError("Cannot parse line: "+e);continue}var d=b(e);if(d){var f=parseInt(d.pid),g=parseInt(d.cpuNumber),h=1E3*parseFloat(d.timestamp),j=d.eventName,u=this.eventHandlers_[j];u?u(j,g,f,h,d)||this.importError("Malformed "+j+" event ("+e+")"):this.importError("Unknown event "+j+" ("+e+")")}else this.importError("Unrecognized line: "+
e)}}}};tracing.Model.registerImporter(c);return{LinuxPerfImporter:c,_LinuxPerfImporterTestExports:TestExports}});
base.exportTo("tracing.importer.v8",function(){function d(){}function c(a){this.dispatchTable_=a;this.lineNum_=0;this.csvParser_=new d}d.CSV_FIELD_RE_=/^"((?:[^"]|"")*)"|([^,]*)/;d.DOUBLE_QUOTE_RE_=/""/g;d.prototype.parseLine=function(a){var b=d.CSV_FIELD_RE_,c=d.DOUBLE_QUOTE_RE_,e=0,g=a.length,j=[];if(0<g){do{var h=b.exec(a.substr(e));"string"===typeof h[1]?(h=h[1],e+=h.length+3,j.push(h.replace(c,'"'))):(h=h[2],e+=h.length+1,j.push(h))}while(e<=g)}return j};c.prototype.printError=function(){};c.prototype.processLogChunk=
function(a){this.processLog_(a.split("\n"))};c.prototype.processLogLine=function(a){this.processLog_([a])};c.prototype.processStack=function(a,b,c){b=b?[a,b]:[a];for(var e=0,d=c.length;e<d;++e){var j=c[e],h=j.charAt(0);"+"==h||"-"==h?(a+=parseInt(j,16),b.push(a)):"o"!=h&&b.push(parseInt(j,16))}return b};c.prototype.skipDispatch=function(){return!1};c.prototype.dispatchLogRow_=function(a){var b=a[0];if(b in this.dispatchTable_&&(b=this.dispatchTable_[b],!(null===b||this.skipDispatch(b)))){for(var c=
[],e=0;e<b.parsers.length;++e){var d=b.parsers[e];if(null===d)c.push(a[1+e]);else if("function"==typeof d)c.push(d(a[1+e]));else{c.push(a.slice(1+e));break}}b.processor.apply(this,c)}};c.prototype.processLog_=function(a){for(var b=0,c=a.length;b<c;++b,++this.lineNum_){var d=a[b];if(d)try{var g=this.csvParser_.parseLine(d);this.dispatchLogRow_(g)}catch(j){this.printError("line "+(this.lineNum_+1)+": "+(j.message||j))}}};return{LogReader:c}});
base.exportTo("tracing.importer.v8",function(){function d(){}d.prototype.root_=null;d.prototype.isEmpty=function(){return!this.root_};d.prototype.insert=function(c,a){if(this.isEmpty())this.root_=new d.Node(c,a);else if(this.splay_(c),this.root_.key!=c){var b=new d.Node(c,a);c>this.root_.key?(b.left=this.root_,b.right=this.root_.right,this.root_.right=null):(b.right=this.root_,b.left=this.root_.left,this.root_.left=null);this.root_=b}};d.prototype.remove=function(c){if(this.isEmpty())throw Error("Key not found: "+
c);this.splay_(c);if(this.root_.key!=c)throw Error("Key not found: "+c);var a=this.root_;if(this.root_.left){var b=this.root_.right;this.root_=this.root_.left;this.splay_(c);this.root_.right=b}else this.root_=this.root_.right;return a};d.prototype.find=function(c){if(this.isEmpty())return null;this.splay_(c);return this.root_.key==c?this.root_:null};d.prototype.findMin=function(){if(this.isEmpty())return null;for(var c=this.root_;c.left;)c=c.left;return c};d.prototype.findMax=function(c){if(this.isEmpty())return null;
for(c=c||this.root_;c.right;)c=c.right;return c};d.prototype.findGreatestLessThan=function(c){if(this.isEmpty())return null;this.splay_(c);return this.root_.key<=c?this.root_:this.root_.left?this.findMax(this.root_.left):null};d.prototype.exportKeysAndValues=function(){var c=[];this.traverse_(function(a){c.push([a.key,a.value])});return c};d.prototype.exportValues=function(){var c=[];this.traverse_(function(a){c.push(a.value)});return c};d.prototype.splay_=function(c){if(!this.isEmpty()){var a,b,
f;a=b=f=new d.Node(null,null);for(var e=this.root_;;)if(c<e.key){if(!e.left)break;if(c<e.left.key){var g=e.left;e.left=g.right;g.right=e;e=g;if(!e.left)break}f=f.left=e;e=e.left}else if(c>e.key){if(!e.right)break;if(c>e.right.key&&(g=e.right,e.right=g.left,g.left=e,e=g,!e.right))break;b=b.right=e;e=e.right}else break;b.right=e.left;f.left=e.right;e.left=a.right;e.right=a.left;this.root_=e}};d.prototype.traverse_=function(c){for(var a=[this.root_];0<a.length;){var b=a.shift();null!=b&&(c(b),a.push(b.left),
a.push(b.right))}};d.Node=function(c,a){this.key=c;this.value=a};d.Node.prototype.left=null;d.Node.prototype.right=null;return{SplayTree:d}});base.require("importer.v8.splaytree");
base.exportTo("tracing.importer.v8",function(){function d(){this.dynamics_=new tracing.importer.v8.SplayTree;this.dynamicsNameGen_=new tracing.importer.v8.CodeMap.NameGenerator;this.statics_=new tracing.importer.v8.SplayTree;this.libraries_=new tracing.importer.v8.SplayTree;this.pages_=[]}d.PAGE_ALIGNMENT=12;d.PAGE_SIZE=1<<d.PAGE_ALIGNMENT;d.prototype.addCode=function(c,a){this.deleteAllCoveredNodes_(this.dynamics_,c,c+a.size);this.dynamics_.insert(c,a)};d.prototype.moveCode=function(c,a){var b=this.dynamics_.remove(c);
this.deleteAllCoveredNodes_(this.dynamics_,a,a+b.value.size);this.dynamics_.insert(a,b.value)};d.prototype.deleteCode=function(c){this.dynamics_.remove(c)};d.prototype.addLibrary=function(c,a){this.markPages_(c,c+a.size);this.libraries_.insert(c,a)};d.prototype.addStaticCode=function(c,a){this.statics_.insert(c,a)};d.prototype.markPages_=function(c,a){for(var b=c;b<=a;b+=d.PAGE_SIZE)this.pages_[b>>>d.PAGE_ALIGNMENT]=1};d.prototype.deleteAllCoveredNodes_=function(c,a,b){for(var d=[],e=b-1;e>=a;){var g=
c.findGreatestLessThan(e);if(!g)break;e=g.key;g=e+g.value.size;e<b&&a<g&&d.push(e);e-=1}a=0;for(b=d.length;a<b;++a)c.remove(d[a])};d.prototype.isAddressBelongsTo_=function(c,a){return c>=a.key&&c<a.key+a.value.size};d.prototype.findInTree_=function(c,a){var b=c.findGreatestLessThan(a);return b&&this.isAddressBelongsTo_(a,b)?b.value:null};d.prototype.findEntry=function(c){if(c>>>d.PAGE_ALIGNMENT in this.pages_)return this.findInTree_(this.statics_,c)||this.findInTree_(this.libraries_,c);var a=this.dynamics_.findMin(),
b=this.dynamics_.findMax();if(null!=b&&c<b.key+b.value.size&&c>=a.key){c=this.findInTree_(this.dynamics_,c);if(null==c)return null;c.nameUpdated_||(c.name=this.dynamicsNameGen_.getName(c.name),c.nameUpdated_=!0);return c}return null};d.prototype.findDynamicEntryByStartAddress=function(c){return(c=this.dynamics_.find(c))?c.value:null};d.prototype.getAllDynamicEntries=function(){return this.dynamics_.exportValues()};d.prototype.getAllDynamicEntriesWithAddresses=function(){return this.dynamics_.exportKeysAndValues()};
d.prototype.getAllStaticEntries=function(){return this.statics_.exportValues()};d.prototype.getAllLibrariesEntries=function(){return this.libraries_.exportValues()};d.CodeEntry=function(c,a){this.size=c;this.name=a||"";this.nameUpdated_=!1};d.CodeEntry.prototype.getName=function(){return this.name};d.CodeEntry.prototype.toString=function(){return this.name+": "+this.size.toString(16)};d.NameGenerator=function(){this.knownNames_={}};d.NameGenerator.prototype.getName=function(c){if(!(c in this.knownNames_))return this.knownNames_[c]=
0,c;var a=++this.knownNames_[c];return c+" {"+a+"}"};return{CodeMap:d}});base.require("model");base.require("model.slice");base.require("color_scheme");base.require("importer.v8.log_reader");base.require("importer.v8.codemap");
base.exportTo("tracing.importer",function(){function d(a,c){this.importPriority=3;this.model_=a;this.logData_=c;this.code_map_=new tracing.importer.v8.CodeMap;this.v8_samples_thread_=this.v8_stack_thread_=this.v8_timer_thread_=void 0}var c=["/d8","/libv8.so"],a={"V8.Execute":{pause:!1,no_execution:!1},"V8.External":{pause:!1,no_execution:!0},"V8.CompileFullCode":{pause:!0,no_execution:!0},"V8.RecompileSynchronous":{pause:!0,no_execution:!0},"V8.RecompileParallel":{pause:!1,no_execution:!1},"V8.CompileEval":{pause:!0,
no_execution:!0},"V8.Parse":{pause:!0,no_execution:!0},"V8.PreParse":{pause:!0,no_execution:!0},"V8.ParseLazy":{pause:!0,no_execution:!0},"V8.GCScavenger":{pause:!0,no_execution:!0},"V8.GCCompactor":{pause:!0,no_execution:!0},"V8.GCContext":{pause:!0,no_execution:!0}};d.canImport=function(a){return"string"!==typeof a&&!(a instanceof String)?!1:"timer-event,"==a.substring(0,12)||"tick,"==a.substring(0,5)||"shared-library,"==a.substring(0,15)||"profiler,"==a.substring(0,9)};d.prototype={__proto__:Object.prototype,
processTimerEvent_:function(b,c,d){var g=a[b];if(void 0!==g){c/=1E3;d/=1E3;var j=tracing.getStringColorId(b);b=new tracing.model.Slice("v8",b,j,c,g,d);this.v8_timer_thread_.pushSlice(b)}},processTimerEventStart_:function(b,c){debugger;var d=a[b];void 0!==d&&this.v8_timer_thread_.beginSlice("v8",b,c/1E3,d)},processTimerEventEnd_:function(a,c){debugger;this.v8_timer_thread_.endSlice(c/1E3)},processCodeCreateEvent_:function(a,c,d,g,j){a=new tracing.importer.v8.CodeMap.CodeEntry(g,j);a.kind=c;this.code_map_.addCode(d,
a)},processCodeMoveEvent_:function(a,c){this.code_map_.moveCode(a,c)},processCodeDeleteEvent_:function(a){this.code_map_.deleteCode(a)},processSharedLibrary_:function(a,d,e){e=new tracing.importer.v8.CodeMap.CodeEntry(e-d,a);e.kind=-3;for(var g=0;g<c.length;g++){var j=c[g];if(0<=a.indexOf(j,a.length-j.length)){e.kind=-1;break}}this.code_map_.addLibrary(d,e)},findCodeKind_:function(a){for(name in CodeKinds)if(0<=CodeKinds[name].kinds.indexOf(a))return CodeKinds[name]},nameForCodeEntry_:function(a){return a?
a.name:"UnknownCode"},processTickEvent_:function(a,c,d,g,j,h,k){c=this.code_map_.findEntry(a);c=this.nameForCodeEntry_(c);d/=1E3;this.v8_samples_thread_.addSample("v8",c,d);if(k&&k.length)for(a=0;8>a&&k[a];a++)c=this.code_map_.findEntry(k[a]),c=this.nameForCodeEntry_(c),g=tracing.getStringColorId(c),c=new tracing.model.Slice("v8",c,g,d,{},0),this.v8_stack_thread_.pushSlice(c)},processDistortion_:function(a){distortion_per_entry=a/1E6},processPlotRange_:function(a,c){xrange_start_override=a;xrange_end_override=
c},importEvents:function(){var a=new tracing.importer.v8.LogReader({"timer-event":{parsers:[null,parseInt,parseInt],processor:this.processTimerEvent_.bind(this)},"shared-library":{parsers:[null,parseInt,parseInt],processor:this.processSharedLibrary_.bind(this)},"timer-event-start":{parsers:[null,parseInt],processor:this.processTimerEventStart_.bind(this)},"timer-event-end":{parsers:[null,parseInt],processor:this.processTimerEventEnd_.bind(this)},"code-creation":{parsers:[null,parseInt,parseInt,parseInt,
null],processor:this.processCodeCreateEvent_.bind(this)},"code-move":{parsers:[parseInt,parseInt],processor:this.processCodeMoveEvent_.bind(this)},"code-delete":{parsers:[parseInt],processor:this.processCodeDeleteEvent_.bind(this)},tick:{parsers:[parseInt,parseInt,parseInt,null,null,parseInt,"var-args"],processor:this.processTickEvent_.bind(this)},distortion:{parsers:[parseInt],processor:this.processDistortion_.bind(this)},"plot-range":{parsers:[parseInt,parseInt],processor:this.processPlotRange_.bind(this)}});
this.v8_timer_thread_=this.model_.getOrCreateProcess(-32).getOrCreateThread(1);this.v8_timer_thread_.name="V8 Timers";this.v8_stack_thread_=this.model_.getOrCreateProcess(-32).getOrCreateThread(2);this.v8_stack_thread_.name="V8 JavaScript";this.v8_samples_thread_=this.model_.getOrCreateProcess(-32).getOrCreateThread(3);this.v8_samples_thread_.name="V8 PC";for(var c=this.logData_.split("\n"),d=0;d<c.length;d++)a.processLogLine(c[d])},finalizeImport:function(){}};tracing.Model.registerImporter(d);return{V8LogImporter:d}});
"use strict";
base.exportTo("base",function(){function d(){this.storage_=a?a:"G_testRunner"in global?new c:localStorage}function c(){}var a=void 0;d.setAlternativeStorageInstance=function(b){a=b};d.prototype={get:function(a,c,d){a=this.namespace_(a,d);a=this.storage_.getItem(a);return null===a||void 0===a?c:String(a)},set:function(a,c,d){this.storage_.setItem(this.namespace_(a,d),String(c))},keys:function(a){var c=[];a=a||"";for(var d=0;d<this.storage_.length;d++){var g=this.storage_.key(d);this.isnamespaced_(g,a)&&
c.push(this.unnamespace_(g,a))}return c},isnamespaced_:function(a,c){return 0==a.indexOf(this.normalize_(c))},namespace_:function(a,c){return this.normalize_(c)+a},unnamespace_:function(a,c){return a.replace(this.normalize_(c),"")},normalize_:function(a){return d.NAMESPACE+(a?a+".":"")}};d.NAMESPACE="trace-viewer";c.prototype={__proto__:Object.prototype,getItem:function(a){return void 0===this[a]||null===this[a]?null:this[a]},setItem:function(a,c){this[a]=c},key:function(a){return Object.keys(this).sort()[a]},
get length(){return Object.keys(this).length}};return{Settings:d}});"use strict";base.requireStylesheet("timeline_view");base.require("timeline_track_view");base.require("timeline_analysis_view");base.require("category_filter_dialog");base.require("filter");base.require("find_control");base.require("overlay");base.require("importer.trace_event_importer");base.require("importer.linux_perf_importer");base.require("importer.v8_log_importer");base.require("settings");
base.exportTo("tracing",function(){var d=tracing.ui.define("div");d.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.classList.add("view");this.titleEl_=document.createElement("div");this.titleEl_.textContent="Tracing: ";this.titleEl_.className="title";this.controlDiv_=document.createElement("div");this.controlDiv_.className="control";this.leftControlsEl_=document.createElement("div");this.leftControlsEl_.className="controls";this.rightControlsEl_=document.createElement("div");
this.rightControlsEl_.className="controls";var a=document.createElement("div");a.className="spacer";this.timelineContainer_=document.createElement("div");this.timelineContainer_.className="container";var b=document.createElement("div");b.className="analysis-container";this.analysisEl_=new tracing.TimelineAnalysisView;this.dragEl_=new c;this.dragEl_.target=b;this.findCtl_=new tracing.FindControl;this.findCtl_.controller=new tracing.FindController;this.importErrorsButton_=this.createImportErrorsButton_();
this.categoryFilterButton_=this.createCategoryFilterButton_();this.categoryFilterButton_.callback=this.updateCategoryFilterFromSettings_.bind(this);this.metadataButton_=this.createMetadataButton_();this.rightControls.appendChild(this.importErrorsButton_);this.rightControls.appendChild(this.categoryFilterButton_);this.rightControls.appendChild(this.metadataButton_);this.rightControls.appendChild(this.findCtl_);this.controlDiv_.appendChild(this.titleEl_);this.controlDiv_.appendChild(this.leftControlsEl_);
this.controlDiv_.appendChild(a);this.controlDiv_.appendChild(this.rightControlsEl_);this.appendChild(this.controlDiv_);this.appendChild(this.timelineContainer_);this.appendChild(this.dragEl_);b.appendChild(this.analysisEl_);this.appendChild(b);this.rightControls.appendChild(this.createHelpButton_());this.onSelectionChangedBoundToThis_=this.onSelectionChanged_.bind(this);document.addEventListener("keypress",this.onKeypress_.bind(this),!0)},createImportErrorsButton_:function(){function a(){c.style.display=
j.model&&j.model.importErrors.length?"":"none"}var b=new tracing.ui.Overlay;b.classList.add("view-import-errors-overlay");b.autoClose=!0;var c=document.createElement("div");c.className="button view-import-errors-button view-info-button";c.textContent="Import errors!";var d=document.createElement("div");d.className="info-button-text import-errors-dialog-text";var g=document.createElement("div");g.className="info-button-containerimport-errors-dialog";g.textContent="Errors occurred during import:";g.appendChild(d);
b.appendChild(g);var j=this;c.addEventListener("click",function(){b.visible=!0;d.textContent=j.model.importErrors.join("\n")}.bind(this));a();j.addEventListener("modelChange",a);return c},createCategoryFilterButton_:function(){function a(){c.style.display=d.model?"":"none"}var b,c=document.createElement("div");c.className="button view-info-button";c.textContent="Categories";c.__defineSetter__("callback",function(a){b=a});var d=this;a();d.addEventListener("modelChange",a);c.addEventListener("click",
function(){var a=new tracing.CategoryFilterDialog;a.categories=d.model.categories;a.settings=d.settings;a.settings_key="categories";a.settingUpdatedCallback=b;a.visible=!0}.bind(this));return c},createHelpButton_:function(){var a=new tracing.ui.Overlay;a.classList.add("view-help-overlay");a.autoClose=!0;a.additionalCloseKeyCodes.push(63);var b=document.createElement("div");b.className="button view-help-button";b.textContent="?";var c=document.createElement("div");c.style.whiteSpace="pre";c.style.fontFamily=
"monospace";a.appendChild(c);b.addEventListener("click",function(b){a.visible=!0;c.textContent=this.timeline_?this.timeline_.keyHelp:"No content loaded. For interesting help, load something.";b.stopPropagation();return!1}.bind(this));return b},createMetadataButton_:function(){function a(){c.style.display=j.model&&j.model.metadata.length?"":"none"}var b=new tracing.ui.Overlay;b.classList.add("view-metadata-overlay");b.autoClose=!0;var c=document.createElement("div");c.className="button view-metadata-button view-info-button";
c.textContent="Metadata";var d=document.createElement("div");d.className="info-button-text metadata-dialog-text";var g=document.createElement("div");g.className="info-button-container metadata-dialog";g.textContent="Metadata Info:";g.appendChild(d);b.appendChild(g);var j=this;c.addEventListener("click",function(){b.visible=!0;var a=[],c=j.model,f;for(f in c.metadata)a.push(JSON.stringify(c.metadata[f].name)+": "+JSON.stringify(c.metadata[f].value,void 0," "));d.textContent=a.join("\n")}.bind(this));
a();j.addEventListener("modelChange",a);return c},get leftControls(){return this.leftControlsEl_},get rightControls(){return this.rightControlsEl_},get title(){return this.titleEl_.textContent.substring(this.titleEl_.textContent.length-2)},set title(a){this.titleEl_.textContent=a+":"},set traceData(a){this.model=new tracing.Model(a)},get model(){if(this.timeline_)return this.timeline_.model},set model(a){var b=a!=this.model,c=a&&!a.bounds.isEmpty;b&&(this.timelineContainer_.textContent="",this.timeline_&&
(this.timeline_.removeEventListener("selectionChange",this.onSelectionChangedBoundToThis_),this.timeline_.detach(),this.timeline_=void 0,this.findCtl_.controller.timeline=void 0));c&&!this.timeline_&&(this.timeline_=new tracing.TimelineTrackView,this.timeline_.focusElement=this.focusElement_?this.focusElement_:this.parentElement,this.timelineContainer_.appendChild(this.timeline_),this.findCtl_.controller.timeline=this.timeline_,this.timeline_.addEventListener("selectionChange",this.onSelectionChangedBoundToThis_),
this.updateCategoryFilterFromSettings_());c&&(this.timeline_.model=a);base.dispatchSimpleEvent(this,"modelChange");if(b)this.onSelectionChanged_()},get timeline(){return this.timeline_},get settings(){this.settings_||(this.settings_=new base.Settings);return this.settings_},set focusElement(a){this.focusElement_=a;this.timeline_&&(this.timeline_.focusElement=a)},get focusElement(){return this.focusElement_?this.focusElement_:this.parentElement},get isAttachedToDocument_(){for(var a=this;a.parentNode;)a=
a.parentNode;return a==this.ownerDocument},get listenToKeys_(){if(this.isAttachedToDocument_)return!this.focusElement_?!0:0<=this.focusElement.tabIndex?document.activeElement==this.focusElement:!0},onKeypress_:function(a){this.listenToKeys_&&(47==event.keyCode?(this.findCtl_.focus(),event.preventDefault()):63==a.keyCode&&(this.querySelector(".view-help-button").click(),a.preventDefault()))},beginFind:function(){if(!this.findInProgress_){this.findInProgress_=!0;var a=tracing.FindControl();a.controller=
new tracing.FindController;a.controller.timeline=this.timeline;a.visible=!0;a.addEventListener("close",function(){this.findInProgress_=!1}.bind(this));a.addEventListener("findNext",function(){});a.addEventListener("findPrevious",function(){})}},onSelectionChanged_:function(){var a=this.timelineContainer_.scrollTop,b=this.timeline_?this.timeline_.selection:new tracing.Selection;this.analysisEl_.selection=b;this.timelineContainer_.scrollTop=a},updateCategoryFilterFromSettings_:function(){if(this.timeline_){for(var a=
this.settings.keys("categories"),b=[],c=0;c<a.length;c++)"false"==this.settings.get(a[c],"true","categories")&&b.push(a[c]);this.timeline_.categoryFilter=new tracing.CategoryFilter(b)}}};var c=tracing.ui.define("div");c.prototype={__proto__:HTMLDivElement.prototype,decorate:function(){this.className="drag-handle";this.lastMousePosY=0;this.dragAnalysis=this.dragAnalysis.bind(this);this.onMouseUp=this.onMouseUp.bind(this);this.addEventListener("mousedown",this.onMouseDown)},dragAnalysis:function(a){var b=
this.lastMousePosY-a.clientY;this.target.style.height||(this.target.style.height=window.getComputedStyle(this.target).height);this.target.style.height=parseInt(this.target.style.height)+b+"px";this.lastMousePosY=a.clientY},onMouseDown:function(a){this.lastMousePosY=a.clientY;document.addEventListener("mousemove",this.dragAnalysis);document.addEventListener("mouseup",this.onMouseUp);a.stopPropagation();return!1},onMouseUp:function(){document.removeEventListener("mousemove",this.dragAnalysis);document.removeEventListener("mouseup",
this.onMouseUp)}};return{TimelineView:d}});
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
\n";
</script>
<!-- END TRACE -->
</body>
</html>
@@ -0,0 +1,240 @@
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""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 errno, optparse, os, select, subprocess, sys, time, zlib
# This list is based on the tags in frameworks/native/include/utils/Trace.h.
trace_tag_bits = {
'gfx': 1<<1,
'input': 1<<2,
'view': 1<<3,
'webview': 1<<4,
'wm': 1<<5,
'am': 1<<6,
'sync': 1<<7,
'audio': 1<<8,
'video': 1<<9,
'camera': 1<<10,
}
flattened_css_file = 'style.css'
flattened_js_file = 'script.js'
def add_adb_serial(command, serial):
if serial != None:
command.insert(1, serial)
command.insert(1, '-s')
def main():
parser = optparse.OptionParser()
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('-d', '--disk', dest='trace_disk', default=False,
action='store_true', help='trace disk I/O (requires root)')
parser.add_option('-f', '--cpu-freq', dest='trace_cpu_freq', default=False,
action='store_true', help='trace CPU frequency changes')
parser.add_option('-i', '--cpu-idle', dest='trace_cpu_idle', default=False,
action='store_true', help='trace CPU idle events')
parser.add_option('-l', '--cpu-load', dest='trace_cpu_load', default=False,
action='store_true', help='trace CPU load')
parser.add_option('-s', '--no-cpu-sched', dest='trace_cpu_sched', default=True,
action='store_false', help='inhibit tracing CPU ' +
'scheduler (allows longer trace times by reducing data ' +
'rate into buffer)')
parser.add_option('-u', '--bus-utilization', dest='trace_bus_utilization',
default=False, action='store_true',
help='trace bus utilization (requires root)')
parser.add_option('-w', '--workqueue', dest='trace_workqueue', default=False,
action='store_true', help='trace the kernel workqueues ' +
'(requires root)')
parser.add_option('--set-tags', dest='set_tags', action='store',
help='set the enabled trace tags and exit; set to a ' +
'comma separated list of: ' +
', '.join(trace_tag_bits.iterkeys()))
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 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='adb device serial number')
options, args = parser.parse_args()
if options.set_tags:
flags = 0
tags = options.set_tags.split(',')
for tag in tags:
try:
flags |= trace_tag_bits[tag]
except KeyError:
parser.error('unrecognized tag: %s\nknown tags are: %s' %
(tag, ', '.join(trace_tag_bits.iterkeys())))
atrace_args = ['adb', 'shell', 'setprop', 'debug.atrace.tags.enableflags', hex(flags)]
add_adb_serial(atrace_args, options.device_serial)
try:
subprocess.check_call(atrace_args)
except subprocess.CalledProcessError, e:
print >> sys.stderr, 'unable to set tags: %s' % e
print '\nSet enabled tags to: %s\n' % ', '.join(tags)
print ('You will likely need to restart the Android framework for this to ' +
'take effect:\n\n adb shell stop\n adb shell ' +
'start\n')
return
atrace_args = ['adb', 'shell', 'atrace', '-z']
add_adb_serial(atrace_args, options.device_serial)
if options.trace_disk:
atrace_args.append('-d')
if options.trace_cpu_freq:
atrace_args.append('-f')
if options.trace_cpu_idle:
atrace_args.append('-i')
if options.trace_cpu_load:
atrace_args.append('-l')
if options.trace_cpu_sched:
atrace_args.append('-s')
if options.trace_bus_utilization:
atrace_args.append('-u')
if options.trace_workqueue:
atrace_args.append('-w')
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')
if options.from_file is not None:
atrace_args = ['cat', options.from_file]
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 = 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())
html_filename = options.output_file
trace_started = False
leftovers = ''
adb = subprocess.Popen(atrace_args, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
dec = zlib.decompressobj()
while True:
ready = select.select([adb.stdout, adb.stderr], [], [adb.stdout, adb.stderr])
if adb.stderr in ready[0]:
err = os.read(adb.stderr.fileno(), 4096)
sys.stderr.write(err)
sys.stderr.flush()
if adb.stdout in ready[0]:
out = leftovers + os.read(adb.stdout.fileno(), 4096)
if options.from_file is None:
out = out.replace('\r\n', '\n')
if out.endswith('\r'):
out = out[:-1]
leftovers = '\r'
else:
leftovers = ''
if not trace_started:
lines = out.splitlines(True)
out = ''
for i, line in enumerate(lines):
if line == 'TRACE:\n':
sys.stdout.write("downloading trace...")
sys.stdout.flush()
out = ''.join(lines[i+1:])
html_prefix = read_asset(script_dir, 'prefix.html')
html_file = open(html_filename, 'w')
html_file.write(html_prefix % (css, js))
trace_started = True
break
elif 'TRACE:'.startswith(line) and i == len(lines) - 1:
leftovers = line + leftovers
else:
sys.stdout.write(line)
sys.stdout.flush()
if len(out) > 0:
out = dec.decompress(out)
html_out = out.replace('\n', '\\n\\\n')
if len(html_out) > 0:
html_file.write(html_out)
result = adb.poll()
if result is not None:
break
if result != 0:
print >> sys.stderr, 'adb returned error code %d' % result
elif trace_started:
html_out = dec.flush().replace('\n', '\\n\\\n').replace('\r', '')
if len(html_out) > 0:
html_file.write(html_out)
html_suffix = read_asset(script_dir, 'suffix.html')
html_file.write(html_suffix)
html_file.close()
print " done\n\n wrote file://%s/%s\n" % (os.getcwd(), options.output_file)
else:
print >> sys.stderr, ('An error occured while capturing the trace. Output ' +
'file was not written.')
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', {}, {})
filenames = gen._get_input_filenames()
load_sequence = parse_deps.calc_load_sequence(filenames)
js_files = []
js_flattenizer = "window.FLATTENED = {};\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 style_sheet in module.style_sheets:
css_files.append(os.path.relpath(style_sheet.filename, src_dir))
sys.path.pop()
return (js_files, js_flattenizer, css_files)
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()
@@ -0,0 +1,274 @@
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""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 errno, optparse, os, select, subprocess, sys, time, zlib
flattened_css_file = 'style.css'
flattened_js_file = 'script.js'
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 get_device_sdk_version():
getprop_args = ['adb', 'shell', 'getprop', 'ro.build.version.sdk']
parser = OptionParserIgnoreErrors()
parser.add_option('-e', '--serial', dest='device_serial', type='string')
options, args = parser.parse_args()
if options.device_serial is not None:
getprop_args[1:1] = ['-s', options.device_serial]
adb = subprocess.Popen(getprop_args, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = adb.communicate()
if adb.returncode != 0:
print >> sys.stderr, 'Error querying device SDK-version:'
print >> sys.stderr, err
sys.exit(1)
version = int(out)
return version
def add_adb_serial(command, serial):
if serial != None:
command.insert(1, serial)
command.insert(1, '-s')
def main():
device_sdk_version = get_device_sdk_version()
if device_sdk_version < 18:
legacy_script = os.path.join(os.path.dirname(sys.argv[0]), 'systrace-legacy.py')
os.execv(legacy_script, sys.argv)
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('-k', '--ktrace', dest='kfuncs', action='store',
help='specify a comma-separated list of kernel functions to trace')
parser.add_option('-l', '--list-categories', dest='list_categories', default=False,
action='store_true', help='list the available categories and exit')
parser.add_option('-a', '--app', dest='app_name', default=None, type='string',
action='store', help='enable application-level tracing for comma-separated ' +
'list of app cmdlines')
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('--asset-dir', dest='asset_dir', default='trace-viewer',
type='string', help='')
parser.add_option('-e', '--serial', dest='device_serial', type='string',
help='adb device serial number')
options, args = parser.parse_args()
if options.list_categories:
atrace_args = ['adb', 'shell', 'atrace', '--list_categories']
expect_trace = False
elif options.from_file is not None:
atrace_args = ['cat', options.from_file]
expect_trace = True
else:
atrace_args = ['adb', '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')
if options.app_name is not None:
atrace_args.extend(['-a', options.app_name])
if options.kfuncs is not None:
atrace_args.extend(['-k', options.kfuncs])
atrace_args.extend(args)
if atrace_args[0] == 'adb':
add_adb_serial(atrace_args, options.device_serial)
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 = 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())
html_filename = options.output_file
adb = subprocess.Popen(atrace_args, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
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([adb.stdout, adb.stderr], [], [adb.stdout, adb.stderr])
if adb.stderr in ready[0]:
err = os.read(adb.stderr.fileno(), 4096)
sys.stderr.write(err)
sys.stderr.flush()
if adb.stdout in ready[0]:
out = os.read(adb.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 = adb.poll()
# Read and buffer the data portion of the output.
while True:
ready = select.select([adb.stdout, adb.stderr], [], [adb.stdout, adb.stderr])
keepReading = False
if adb.stderr in ready[0]:
err = os.read(adb.stderr.fileno(), 4096)
if len(err) > 0:
keepReading = True
sys.stderr.write(err)
sys.stderr.flush()
if adb.stdout in ready[0]:
out = os.read(adb.stdout.fileno(), 4096)
if len(out) > 0:
keepReading = True
data.append(out)
if result is not None and not keepReading:
break
result = adb.poll()
if result == 0:
if expect_trace:
data = ''.join(data)
# Collapse CRLFs that are added by adb shell.
if data.startswith('\r\n'):
data = data.replace('\r\n', '\n')
# Skip the initial newline.
data = data[1:]
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"
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))
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')
html_file.write(html_out)
html_file.write(html_suffix)
html_file.close()
print "\n wrote file://%s/%s\n" % (os.getcwd(), options.output_file)
else: # i.e. result != 0
print >> sys.stderr, 'adb 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', {}, {})
filenames = gen._get_input_filenames()
load_sequence = parse_deps.calc_load_sequence(filenames, src_dir)
js_files = []
js_flattenizer = "window.FLATTENED = {};\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 style_sheet in module.style_sheets:
css_files.append(os.path.relpath(style_sheet.filename, src_dir))
sys.path.pop()
return (js_files, js_flattenizer, css_files)
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()
+12
View File
@@ -0,0 +1,12 @@
epoll_create()
epoll_ctl()
epoll_wait()
inotify_init()
inotify_add_watch()
inotify_rm_watch()
poll()
eventfd2()
__ARM_NR_set_tls()
__ARM_NR_cacheflush()
cacheflush()
syscall()

Some files were not shown because too many files have changed in this diff Show More