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     platform: 'unix',
     86     stateFilter: null,
     87     callGraphSize: 5,
     88     ignoreUnknown: false,
     89     separateIc: false,
     90     targetRootFS: '',
     91     nm: 'nm'
     92   };
     93 
     94   var entriesProviders = {
     95     'unix': UnixCppEntriesProvider,
     96     'windows': WindowsCppEntriesProvider,
     97     'mac': MacCppEntriesProvider
     98   };
     99 
    100   var tickProcessor = new TickProcessor(
    101     new (entriesProviders[ArgumentsProcessor.DEFAULTS.platform])(
    102         ArgumentsProcessor.DEFAULTS.nm,
    103         ArgumentsProcessor.DEFAULTS.targetRootFS),
    104     ArgumentsProcessor.DEFAULTS.separateIc,
    105     ArgumentsProcessor.DEFAULTS.callGraphSize,
    106     ArgumentsProcessor.DEFAULTS.ignoreUnknown,
    107     ArgumentsProcessor.DEFAULTS.stateFilter);
    108 
    109   tickProcessor.processLogChunk(v8log_content);
    110   tickProcessor.printStatistics();
    111 }
    112 
    113 function Load() {
    114   document.getElementById('fileinput').addEventListener(
    115       'change', load_logfile, false);
    116   textout = document.getElementById('textout');
    117 }
    118 </script>
    119 </head>
    120 <body onLoad="Load()">
    121 
    122 <h3 style="margin-top: 2px;">
    123   Chrome V8 profiling log processor
    124 </h3>
    125 <p>
    126 Process V8's profiling information log (sampling profiler tick information)
    127 in your browser. Particularly useful if you don't have the V8 shell (d8)
    128 at hand on your system. You still have to run Chrome with the appropriate
    129 <a href="https://code.google.com/p/v8/wiki/ProfilingChromiumWithV8">
    130   command line flags</a>
    131 to produce the profiling log.
    132 </p>
    133 <h4>Usage:</h4>
    134 <p>
    135 Click on the button and browse to the profiling log file (usually, v8.log).
    136 Process will start automatically and the output will be visible in the below
    137 text area.
    138 </p>
    139 <h4>Limitations and disclaimer:</h4>
    140 <p>
    141 This page offers a subset of the functionalities of the command-line tick
    142 processor utility in the V8 repository. In particular, this page cannot
    143 access the command-line utility that provides library symbol information,
    144 hence the [C++] section of the output stays empty. Also consider that this
    145 web-based tool is provided only for convenience and quick reference, you
    146 should refer to the
    147 <a href="https://code.google.com/p/v8/wiki/V8Profiler">
    148   command-line</a>
    149 version for full output.
    150 </p>
    151 <p>
    152 <input type="file" id="fileinput" />
    153 </p>
    154 <p>
    155 <textarea name="myTextArea" cols="120" rows="40" wrap="off" id="textout"
    156           readonly="yes"></textarea>
    157 </p>
    158 <p style="font-style:italic;">
    159 Copyright the V8 Authors - Last change to this page: 12/12/2012
    160 </p>
    161 
    162 
    163 </body>
    164 </html>
    165