[object-stats] Unpack gzipped trace files on the fly
No-try: true Bug: v8:7266 Change-Id: I9ca2036a54c55c754cc2bb69dcca6157f88ea0fa Reviewed-on: https://chromium-review.googlesource.com/880960 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#50807}
This commit is contained in:
parent
b008859d9a
commit
546df30bfc
@ -6,8 +6,9 @@ maintaining internal state versus actually allocated by the user.
|
||||
|
||||
The tool consumes log files produced by d8 (or Chromium) by passing
|
||||
`--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.
|
||||
infrastructure. Chrome trace files can either be processed as gzip or raw text
|
||||
files.
|
||||
|
||||
|
||||
Hosting requires a web server, e.g.:
|
||||
|
||||
|
@ -9,7 +9,12 @@ found in the LICENSE file. -->
|
||||
<meta charset="UTF-8">
|
||||
<title>V8 Heap Statistics</title>
|
||||
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
|
||||
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="https://www.gstatic.com/charts/loader.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.6/pako_inflate.min.js"
|
||||
integrity="sha256-N1z6ddQzX83fjw8v7uSNe7/MgOmMKdwFUv1+AJMDqNM="
|
||||
crossorigin="anonymous"></script>
|
||||
|
||||
<link rel="import" href="details-selection.html">
|
||||
<link rel="import" href="global-timeline.html">
|
||||
@ -73,8 +78,7 @@ function globalSelectionChangedA(e) {
|
||||
<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>).
|
||||
<code>v8.gc_stats</code>.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
|
@ -50,17 +50,32 @@ class TraceFileReader extends HTMLElement {
|
||||
return;
|
||||
}
|
||||
|
||||
const result = new FileReader();
|
||||
result.onload = (e) => {
|
||||
let contents = e.target.result.split('\n');
|
||||
const return_data = (e.target.result.includes('V8.GC_Objects_Stats')) ?
|
||||
this.createModelFromChromeTraceFile(contents) :
|
||||
this.createModelFromV8TraceFile(contents);
|
||||
this.updateLabel('Finished loading \'' + file.name + '\'.');
|
||||
this.dispatchEvent(new CustomEvent(
|
||||
'change', {bubbles: true, composed: true, detail: return_data}));
|
||||
};
|
||||
result.readAsText(file);
|
||||
const reader = new FileReader();
|
||||
|
||||
if (file.type === 'application/gzip') {
|
||||
reader.onload = (e) => {
|
||||
try {
|
||||
const textResult = pako.inflate(e.target.result, {to: 'string'});
|
||||
this.processRawText(file, textResult);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
reader.readAsArrayBuffer(file);
|
||||
} else {
|
||||
reader.onload = (e) => this.processRawText(file, e.target.result);
|
||||
reader.readAsText(file);
|
||||
}
|
||||
}
|
||||
|
||||
processRawText(file, result) {
|
||||
let contents = result.split('\n');
|
||||
const return_data = (result.includes('V8.GC_Objects_Stats')) ?
|
||||
this.createModelFromChromeTraceFile(contents) :
|
||||
this.createModelFromV8TraceFile(contents);
|
||||
this.updateLabel('Finished loading \'' + file.name + '\'.');
|
||||
this.dispatchEvent(new CustomEvent(
|
||||
'change', {bubbles: true, composed: true, detail: return_data}));
|
||||
}
|
||||
|
||||
createOrUpdateEntryIfNeeded(data, keys, entry) {
|
||||
@ -193,7 +208,7 @@ class TraceFileReader extends HTMLElement {
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('Unable to parse chrome trace file.', e);
|
||||
console.error('Unable to parse chrome trace file.', e);
|
||||
}
|
||||
this.extendAndSanitizeModel(data, keys);
|
||||
return data;
|
||||
|
Loading…
Reference in New Issue
Block a user