Home | History | Annotate | Download | only in tools
      1 <!DOCTYPE html>
      2 <!-- Copyright 2012 the V8 project authors. All rights reserved.
      3 
      4 Redistribution and use in source and binary forms, with or without
      5 modification, are permitted provided that the following conditions are
      6 met:
      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.
     16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     17 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     20 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     21 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     22 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     26 OF 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="tickprocessor.js"></script>
     54 
     55   <script type="text/javascript">
     56 
     57 var v8log_content;
     58 var textout;
     59 
     60 function load_logfile(evt) {
     61   textout.value = "";
     62   var f = evt.target.files[0];
     63   if (f) {
     64     var reader = new FileReader();
     65     reader.onload = function(event) {
     66       v8log_content = event.target.result;
     67       start_process();
     68     };
     69     reader.onerror = function(event) {
     70       console.error("File could not be read! Code " + event.target.error.code);
     71     };
     72     reader.readAsText(f);
     73   } else {
     74     alert("Failed to load file");
     75   }
     76 }
     77 
     78 function print(arg) {
     79   textout.value+=arg+"\n";
     80 }
     81 
     82 function start_process() {
     83   ArgumentsProcessor.DEFAULTS = {
     84     logFileName: 'v8.log',
     85     snapshotLogFileName: null,
     86     platform: 'unix',
     87     stateFilter: null,
     88     callGraphSize: 5,
     89     ignoreUnknown: false,
     90     separateIc: false,
     91     targetRootFS: '',
     92     nm: 'nm'
     93   };
     94 
     95   var entriesProviders = {
     96     'unix': UnixCppEntriesProvider,
     97     'windows': WindowsCppEntriesProvider,
     98     'mac': MacCppEntriesProvider
     99   };
    100 
    101   var snapshotLogProcessor; // not used
    102 
    103   var tickProcessor = new TickProcessor(
    104     new (entriesProviders[ArgumentsProcessor.DEFAULTS.platform])(
    105         ArgumentsProcessor.DEFAULTS.nm,
    106         ArgumentsProcessor.DEFAULTS.targetRootFS),
    107     ArgumentsProcessor.DEFAULTS.separateIc,
    108     ArgumentsProcessor.DEFAULTS.callGraphSize,
    109     ArgumentsProcessor.DEFAULTS.ignoreUnknown,
    110     ArgumentsProcessor.DEFAULTS.stateFilter,
    111     snapshotLogProcessor);
    112 
    113   tickProcessor.processLogChunk(v8log_content);
    114   tickProcessor.printStatistics();
    115 }
    116 
    117 function Load() {
    118   document.getElementById('fileinput').addEventListener(
    119       'change', load_logfile, false);
    120   textout = document.getElementById('textout');
    121 }
    122 </script>
    123 </head>
    124 <body onLoad="Load()">
    125 
    126 <h3 style="margin-top: 2px;">
    127   Chrome V8 profiling log processor
    128 </h3>
    129 <p>
    130 Process V8's profiling information log (sampling profiler tick information)
    131 in your browser. Particularly useful if you don't have the V8 shell (d8)
    132 at hand on your system. You still have to run Chrome with the appropriate
    133 <a href="https://code.google.com/p/v8/wiki/ProfilingChromiumWithV8">
    134   command line flags</a>
    135 to produce the profiling log.
    136 </p>
    137 <h4>Usage:</h4>
    138 <p>
    139 Click on the button and browse to the profiling log file (usually, v8.log).
    140 Process will start automatically and the output will be visible in the below
    141 text area.
    142 </p>
    143 <h4>Limitations and disclaimer:</h4>
    144 <p>
    145 This page offers a subset of the functionalities of the command-line tick
    146 processor utility in the V8 repository. In particular, this page cannot
    147 access the command-line utility that provides library symbol information,
    148 hence the [C++] section of the output stays empty. Also consider that this
    149 web-based tool is provided only for convenience and quick reference, you
    150 should refer to the
    151 <a href="https://code.google.com/p/v8/wiki/V8Profiler">
    152   command-line</a>
    153 version for full output.
    154 </p>
    155 <p>
    156 <input type="file" id="fileinput" />
    157 </p>
    158 <p>
    159 <textarea name="myTextArea" cols="120" rows="40" wrap="off" id="textout"
    160           readonly="yes"></textarea>
    161 </p>
    162 <p style="font-style:italic;">
    163 Copyright the V8 Authors - Last change to this page: 12/12/2012
    164 </p>
    165 
    166 
    167 </body>
    168 </html>
    169