Skip to content
Permalink
Browse files

Add a copy of the catapult trace event viewer. Also start a new proje…

…ct that contains the trace viewer for ease of use.

The trace_viewer_full.html file was generate at commit dd686e35e94691afce7ca90eb70324ce5ba8bd82
using the `tracing/bin/vulcanize_trace_viewer` program.

The index.html file was also brought in at the same commit, and has minor modifications to aid in rewriting the URLs it refers to.
  • Loading branch information...
carl-mastrangelo committed Jul 6, 2019
1 parent 86da391 commit ff38e3f1ea0a50ae0a81b491e86af54eb23bd5a8
26 NOTICE
@@ -0,0 +1,26 @@

Copyright 2019 Carl Mastrangelo

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-----------------------------------------------------------------------

This product contains a modified portion of 'Catapult', an open source
Trace Event viewer for Chome, Linux, and Android applications, which can
be obtained at:

* LICENSE:
* traceviewer/src/main/resources/io/perfmark/traceviewer/third_party/catapult/LICENSE (New BSD License)
* HOMEPAGE:
* https://github.com/catapult-project/catapult

@@ -7,7 +7,7 @@ include ":perfmark-java9"
include ":perfmark-tracewriter"
include ":perfmark-agent"
include ":perfmark-util"

include ":perfmark-traceviewer"

project(':perfmark-api').projectDir = "$rootDir/api" as File
project(':perfmark-impl').projectDir = "$rootDir/impl" as File
@@ -16,4 +16,5 @@ project(':perfmark-java7').projectDir = "$rootDir/java7" as File
project(':perfmark-java9').projectDir = "$rootDir/java9" as File
project(':perfmark-tracewriter').projectDir = "$rootDir/tracewriter" as File
project(':perfmark-agent').projectDir = "$rootDir/agent" as File
project(':perfmark-util').projectDir = "$rootDir/util" as File
project(':perfmark-util').projectDir = "$rootDir/util" as File
project(':perfmark-traceviewer').projectDir = "$rootDir/traceviewer" as File
@@ -0,0 +1,10 @@
description = "PerfMark Trace Viewer"

sourceCompatibility = 1.6
targetCompatibility = 1.6

dependencies {
compile project(':perfmark-tracewriter'),
libraries.jsr305
}

@@ -0,0 +1,19 @@
/*
* Copyright 2019 Carl Mastrangelo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@javax.annotation.CheckReturnValue
@javax.annotation.ParametersAreNonnullByDefault
package io.perfmark.traceviewer;
@@ -0,0 +1,27 @@
Copyright 2015 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 catapult 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 HOLDER 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,115 @@
<!DOCTYPE html>
<!--
Copyright (c) 2014 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.
-->
<head>
<script>
'use strict';
function onTraceViewerImportFail() {
document.addEventListener('DOMContentLoaded', function() {
document.body.textContent =
'tracing/bin/trace_viewer_full.html is missing. ' +
'Run vulcanize_trace_viewer from $TRACE_VIEWER and reload.';
});
}
</script>
<link rel="import" href="trace_viewer_full.html" <!-- IO_PERFMARK_TRACE_IMPORT -->
onerror="onTraceViewerImportFail(event)">

<style>
html, body {
box-sizing: border-box;
overflow: hidden;
margin: 0px;
padding: 0;
width: 100%;
height: 100%;
}
#trace-viewer {
width: 100%;
height: 100%;
}
#trace-viewer:focus {
outline: none;
}
</style>
<script>
'use strict';
(function() {
var viewer;
var url;
var model;
function load() {
var req = new XMLHttpRequest();
var isBinary = /[.]gz$/.test(url) || /[.]zip$/.test(url);
req.overrideMimeType('text/plain; charset=x-user-defined');
req.open('GET', url, true);
if (isBinary)
req.responseType = 'arraybuffer';
req.onreadystatechange = function(event) {
if (req.readyState !== 4)
return;
window.setTimeout(function() {
if (req.status === 200)
onResult(isBinary ? req.response : req.responseText);
else
onResultFail(req.status);
}, 0);
};
req.send(null);
}
function onResultFail(err) {
var overlay = new tr.ui.b.Overlay();
overlay.textContent = err + ': ' + url + ' could not be loaded';
overlay.title = 'Failed to fetch data';
overlay.visible = true;
}
function onResult(result) {
model = new tr.Model();
var i = new tr.importer.Import(model);
var p = i.importTracesWithProgressDialog([result]);
p.then(onModelLoaded, onImportFail);
}
function onModelLoaded() {
viewer.model = model;
viewer.viewTitle = url;
}
function onImportFail() {
var overlay = new tr.ui.b.Overlay();
overlay.textContent = tr.b.normalizeException(err).message;
overlay.title = 'Import error';
overlay.visible = true;
}
document.addEventListener('DOMContentLoaded', function() {
var container = document.createElement('track-view-container');
container.id = 'track_view_container';
viewer = document.createElement('tr-ui-timeline-view');
viewer.track_view_container = container;
Polymer.dom(viewer).appendChild(container);
viewer.id = 'trace-viewer';
viewer.globalMode = true;
Polymer.dom(document.body).appendChild(viewer);
url = './trace.json'; // IO_PERFMARK_TRACE_URL
load();
});
}());
</script>
</head>
<body>
</body>
</html>

0 comments on commit ff38e3f

Please sign in to comment.
You can’t perform that action at this time.