1<!DOCTYPE html>
2<!-- Copyright 2012 the V8 project authors. All rights reserved.
3
4Redistribution and use in source and binary forms, with or without
5modification, are permitted provided that the following conditions are
6met:
7    * Redistributions of source code must retain the above copyright
8      notice, this list of conditions and the following disclaimer.
9    * Redistributions in binary form must reproduce the above
10      copyright notice, this list of conditions and the following
11      disclaimer in the documentation and/or other materials provided
12      with the distribution.
13    * Neither the name of Google Inc. nor the names of its
14      contributors may be used to endorse or promote products derived
15      from this software without specific prior written permission.
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -->
27
28<html lang="en">
29<head>
30  <meta charset="utf-8"/>
31  <title>V8 Tick Processor</title>
32
33  <style type="text/css">
34    body {
35      font-family: Verdana, Arial, Helvetica, sans-serif;
36      font-size: 10pt;
37    }
38    h4 {
39      margin-bottom: 0px;
40    }
41    p {
42      margin-top: 0px;
43    }
44  </style>
45
46  <script src="splaytree.js"></script>
47  <script src="codemap.js"></script>
48  <script src="csvparser.js"></script>
49  <script src="consarray.js"></script>
50  <script src="profile.js"></script>
51  <script src="profile_view.js"></script>
52  <script src="logreader.js"></script>
53  <script src="arguments.js"></script>
54  <script src="tickprocessor.js"></script>
55
56  <script type="text/javascript">
57
58var v8log_content;
59var textout;
60
61function load_logfile(evt) {
62  textout.value = "";
63  var f = evt.target.files[0];
64  if (f) {
65    var reader = new FileReader();
66    reader.onload = function(event) {
67      v8log_content = event.target.result;
68      start_process();
69    };
70    reader.onerror = function(event) {
71      console.error("File could not be read! Code " + event.target.error.code);
72    };
73    reader.readAsText(f);
74  } else {
75    alert("Failed to load file");
76  }
77}
78
79function print(arg) {
80  textout.value+=arg+"\n";
81}
82
83function start_process() {
84  let DEFAULTS = {
85    logFileName: 'v8.log',
86    platform: 'unix',
87    stateFilter: null,
88    callGraphSize: 5,
89    ignoreUnknown: false,
90    separateIc: true,
91    targetRootFS: '',
92    nm: 'nm'
93  };
94
95  var entriesProviders = {
96    'unix': UnixCppEntriesProvider,
97    'windows': WindowsCppEntriesProvider,
98    'mac': MacCppEntriesProvider
99  };
100
101  var tickProcessor = new TickProcessor(
102    new (entriesProviders[DEFAULTS.platform])(
103        DEFAULTS.nm, DEFAULTS.targetRootFS),
104    DEFAULTS.separateIc, DEFAULTS.callGraphSize,
105    DEFAULTS.ignoreUnknown, DEFAULTS.stateFilter);
106
107  tickProcessor.processLogChunk(v8log_content);
108  tickProcessor.printStatistics();
109}
110
111function Load() {
112  document.getElementById('fileinput').addEventListener(
113      'change', load_logfile, false);
114  textout = document.getElementById('textout');
115}
116</script>
117</head>
118<body onLoad="Load()">
119
120<h3 style="margin-top: 2px;">
121  Chrome V8 profiling log processor
122</h3>
123<p>
124Process V8's profiling information log (sampling profiler tick information)
125in your browser. Particularly useful if you don't have the V8 shell (d8)
126at hand on your system. You still have to run Chrome with the appropriate
127<a href="https://code.google.com/p/v8/wiki/ProfilingChromiumWithV8">
128  command line flags</a>
129to produce the profiling log.
130</p>
131<h4>Usage:</h4>
132<p>
133Click on the button and browse to the profiling log file (usually, v8.log).
134Process will start automatically and the output will be visible in the below
135text area.
136</p>
137<h4>Limitations and disclaimer:</h4>
138<p>
139This page offers a subset of the functionalities of the command-line tick
140processor utility in the V8 repository. In particular, this page cannot
141access the command-line utility that provides library symbol information,
142hence the [C++] section of the output stays empty. Also consider that this
143web-based tool is provided only for convenience and quick reference, you
144should refer to the
145<a href="https://code.google.com/p/v8/wiki/V8Profiler">
146  command-line</a>
147version for full output.
148</p>
149<p>
150<input type="file" id="fileinput" />
151</p>
152<p>
153<textarea name="myTextArea" cols="120" rows="40" wrap="off" id="textout"
154          readonly="yes"></textarea>
155</p>
156<p style="font-style:italic;">
157Copyright the V8 Authors - Last change to this page: 12/12/2012
158</p>
159
160
161</body>
162</html>
163