Kaido Kert | f309f9a | 2021-04-30 12:09:15 -0700 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <!-- Copyright 2018 the V8 project authors. All rights reserved. |
| 3 | Use of this source code is governed by a BSD-style license that can be |
| 4 | found in the LICENSE file. --> |
| 5 | |
| 6 | <html lang="en"> |
| 7 | |
| 8 | <head> |
| 9 | <meta charset="UTF-8"> |
| 10 | <title>V8 Heap Statistics</title> |
| 11 | <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'> |
| 12 | <script |
| 13 | src="https://www.gstatic.com/charts/loader.js"></script> |
| 14 | <script |
| 15 | src="https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.6/pako_inflate.min.js" |
| 16 | integrity="sha256-N1z6ddQzX83fjw8v7uSNe7/MgOmMKdwFUv1+AJMDqNM=" |
| 17 | crossorigin="anonymous"></script> |
| 18 | |
| 19 | <script src="https://cdnjs.cloudflare.com/ajax/libs/oboe.js/2.1.5/oboe-browser.min.js" |
| 20 | crossorigin="anonymous"></script> |
| 21 | <script src="helper.js"></script> |
| 22 | |
| 23 | <script type="module" src="details-selection.js"></script> |
| 24 | <script type="module" src="global-timeline.js"></script> |
| 25 | <script type="module" src="histogram-viewer.js"></script> |
| 26 | <script type="module" src="trace-file-reader.js"></script> |
| 27 | |
| 28 | <style> |
| 29 | body { |
| 30 | font-family: 'Roboto', sans-serif; |
| 31 | margin-left: 5%; |
| 32 | margin-right: 5%; |
| 33 | } |
| 34 | |
| 35 | </style> |
| 36 | <script> |
| 37 | 'use strict'; |
| 38 | |
| 39 | google.charts.load('current', {'packages':['line', 'corechart', 'bar']}); |
| 40 | |
| 41 | function $(id) { return document.querySelector(id); } |
| 42 | |
| 43 | function removeAllChildren(node) { |
| 44 | while (node.firstChild) { |
| 45 | node.removeChild(node.firstChild); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | let state = Object.create(null); |
| 50 | |
| 51 | function globalDataChanged(e) { |
| 52 | state.data = e.detail; |
| 53 | // Emit one entry with the whole model for debugging purposes. |
| 54 | console.log(state.data); |
| 55 | state.selection = null; |
| 56 | $('#global-timeline').selection = state.selection; |
| 57 | $('#global-timeline').data = state.data; |
| 58 | $('#histogram-viewer').selection = state.selection; |
| 59 | $('#histogram-viewer').data = state.data; |
| 60 | $('#details-selection').data = state.data; |
| 61 | } |
| 62 | |
| 63 | function globalSelectionChangedA(e) { |
| 64 | state.selection = e.detail; |
| 65 | console.log(state.selection); |
| 66 | $('#global-timeline').selection = state.selection; |
| 67 | $('#histogram-viewer').selection = state.selection; |
| 68 | } |
| 69 | |
| 70 | </script> |
| 71 | </head> |
| 72 | |
| 73 | <body> |
| 74 | <h1>V8 Heap Statistics</h1> |
| 75 | <trace-file-reader onchange="globalDataChanged(event)"></trace-file-reader> |
| 76 | |
| 77 | <details-selection id="details-selection" onchange="globalSelectionChangedA(event)"></details-selection> |
| 78 | <global-timeline id="global-timeline"></global-timeline> |
| 79 | <histogram-viewer id="histogram-viewer"></histogram-viewer> |
| 80 | |
| 81 | <p>Visualize object statistics that have been gathered using</p> |
| 82 | <ul> |
| 83 | <li><code>--trace-gc-object-stats</code> on V8</li> |
| 84 | <li> |
| 85 | <a |
| 86 | href="https://www.chromium.org/developers/how-tos/trace-event-profiling-tool">Chrome's |
| 87 | tracing infrastructure</a> collecting data for the category |
| 88 | <code>v8.gc_stats</code>. |
| 89 | </li> |
| 90 | </ul> |
| 91 | <p> |
| 92 | Note that you only get a data point on major GCs. You can enforce this by |
| 93 | using the <code>--gc-global</code> flag. |
| 94 | </p> |
| 95 | <p> |
| 96 | Note that the visualizer needs to run on a web server due to HTML imports |
| 97 | requiring <a |
| 98 | href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing">CORS</a>. |
| 99 | </p> |
| 100 | </body> |
| 101 | |
| 102 | </html> |