Commit 0dddc6fd authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[object-stats] Add reader for Chrome's trace file format

Allows reading GC object stats data from an unpacked Chrome trace file.

No-try: true
Bug: v8:7266
Change-Id: I1b851a5b9c5937bd80ae08129d3daee8b4397500
Reviewed-on: https://chromium-review.googlesource.com/868211Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50622}
parent 96f55796
...@@ -5,7 +5,9 @@ For example, the tool can be used to visualize how much heap memory is used for ...@@ -5,7 +5,9 @@ For example, the tool can be used to visualize how much heap memory is used for
maintaining internal state versus actually allocated by the user. maintaining internal state versus actually allocated by the user.
The tool consumes log files produced by d8 (or Chromium) by passing The tool consumes log files produced by d8 (or Chromium) by passing
`--trace-gc-object-stats`. `--trace-gc-object-stats` or a trace captured using Chrome's tracing
infrastructure. Chrome trace files need to be unpacked before they can
be used though.
Hosting requires a web server, e.g.: Hosting requires a web server, e.g.:
......
...@@ -39,6 +39,7 @@ span { ...@@ -39,6 +39,7 @@ span {
margin-top: 10px; margin-top: 10px;
} }
</style> </style>
<h2>Data selection</h2>
<ul> <ul>
<li> <li>
<label for="isolate-select"> <label for="isolate-select">
......
...@@ -42,6 +42,8 @@ let state = Object.create(null); ...@@ -42,6 +42,8 @@ let state = Object.create(null);
function globalDataChanged(e) { function globalDataChanged(e) {
state.data = e.detail; state.data = e.detail;
// Emit one entry with the whole model for debugging purposes.
console.log(state.data);
state.selection = null; state.selection = null;
$('#global-timeline').selection = state.selection; $('#global-timeline').selection = state.selection;
$('#global-timeline').data = state.data; $('#global-timeline').data = state.data;
...@@ -62,10 +64,21 @@ function globalSelectionChangedA(e) { ...@@ -62,10 +64,21 @@ function globalSelectionChangedA(e) {
<body> <body>
<trace-file-reader onchange="globalDataChanged(event)"></trace-file-reader> <trace-file-reader onchange="globalDataChanged(event)"></trace-file-reader>
<h1>V8 Heap Statistics</h1> <h1>V8 Heap Statistics</h1>
<p>Visualize object statistics that have been gathered using</p>
<ul>
<li><code>--trace-gc-object-stats on V8</code></li>
<li>
<a
href="https://www.chromium.org/developers/how-tos/trace-event-profiling-tool">Chrome's
tracing infrastructure</a> collecting data for the category
<code>v8.gc_stats</code>. The trace file needs to be unpacked (e.g. using
<code>gunzip</code>).
</li>
</ul>
<p> <p>
Visualize object stats gathered using <code>--trace-gc-object-stats</code>. Note that the visualizer needs to run on a web server due to HTML imports
Needs to be run on a web server (e.g. <code>python -m requiring <a
SimpleHTTPServer</code>) due to HTML imports requiring CORS. href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing">CORS</a>.
</p> </p>
<details-selection id="details-selection" onchange="globalSelectionChangedA(event)"></details-selection> <details-selection id="details-selection" onchange="globalSelectionChangedA(event)"></details-selection>
<global-timeline id="global-timeline"></global-timeline> <global-timeline id="global-timeline"></global-timeline>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment