Commit 615255dd authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[tools] Profiler builtins and sparkplug fixes

- Add filter to skip baseline handlers
- Make profiler types more readable
- Refactor tickprocessor test to use serialized symbols
- Add large tickprocessor stress test with a complete V8 log

Change-Id: Icc09c2eb8ea63c1805d793d2d47f79b0d5080b5b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2784686
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarPatrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74094}
parent 2a19c775
......@@ -150,6 +150,7 @@
'wasm/atomics64-stress': [PASS, SLOW, NO_VARIANTS, ['mode != release or dcheck_always_on', SKIP], ['tsan', SKIP]],
'wasm/compare-exchange-stress': [PASS, SLOW, NO_VARIANTS],
'wasm/compare-exchange64-stress': [PASS, SLOW, NO_VARIANTS],
'tools/tickprocessor-test-large': [PASS, SLOW, NO_VARIANTS, ['mode != release', SKIP]],
# Very slow on ARM and MIPS, contains no architecture dependent code.
'unicode-case-overoptimization0': [PASS, NO_VARIANTS, ['arch in (arm, arm64, mipsel, mips64el, mips64, mips, riscv64)', SKIP]],
......
[
["exp",4158389888,4158390051],
["fegetexcept",4158374368,4158374389],
["v8::internal::Runtime_Math_exp(v8::internal::Arguments)",135412512,135412608],
["v8::internal::JSObject::LookupOwnRealNamedProperty(v8::internal::String*, v8::internal::LookupResult*)",135235584,135237008],
["v8::internal::HashTable<v8::internal::StringDictionaryShape, v8::internal::String*>::FindEntry(v8::internal::String*)",135234064,135235584]
]
\ No newline at end of file
Statistical profiling result from v8.log, (303 ticks, 0 unaccounted, 0 excluded).
[Shared libraries]:
ticks total nonlib name
9 3.0% /usr/local/google/home/cbruni/Documents/v8/v8/out/x64.release/d8
6 2.0% /usr/lib/x86_64-linux-gnu/libc-2.31.so
[JavaScript]:
ticks total nonlib name
102 33.7% 35.4% LazyCompile: *<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
25 8.3% 8.7% LazyCompile: *ics test/mjsunit/tools/tickprocessor-test.js:47:13
21 6.9% 7.3% LazyCompile: *loop test/mjsunit/tools/tickprocessor-test.js:10:14
[C++]:
ticks total nonlib name
99 32.7% 34.4% v8_Default_embedded_blob_code_data_
12 4.0% 4.2% __write
3 1.0% 1.0% fwrite
2 0.7% 0.7% v8::internal::RootScavengeVisitor::VisitRootPointer(v8::internal::Root, char const*, v8::internal::FullObjectSlot)
2 0.7% 0.7% __pthread_mutex_unlock_usercnt
2 0.7% 0.7% __libc_malloc
2 0.7% 0.7% _IO_file_xsputn
1 0.3% 0.3% v8::internal::compiler::TopLevelLiveRange::AddUseInterval(v8::internal::compiler::LifetimePosition, v8::internal::compiler::LifetimePosition, v8::internal::Zone*, bool)
1 0.3% 0.3% v8::internal::compiler::Scheduler::PrepareUses()
1 0.3% 0.3% v8::internal::compiler::CommonOperatorBuilder::CommonOperatorBuilder(v8::internal::Zone*)
1 0.3% 0.3% v8::internal::SpaceWithLinearArea::AdvanceAllocationObservers()
1 0.3% 0.3% v8::internal::SerializerDeserializer::Iterate(v8::internal::Isolate*, v8::internal::RootVisitor*)
1 0.3% 0.3% v8::internal::Log::MessageBuilder::AppendString(char const*, unsigned long, bool)
1 0.3% 0.3% v8::internal::LargeObjectSpace::SizeOfObjects()
1 0.3% 0.3% v8::internal::Heap::Scavenge()
1 0.3% 0.3% v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment)
1 0.3% 0.3% v8::internal::Heap::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment)
1 0.3% 0.3% v8::OutputStream::GetChunkSize()
1 0.3% 0.3% std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char)
1 0.3% 0.3% std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::do_put(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, std::__1::ios_base&, char, long) const
1 0.3% 0.3% std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(unsigned long)
1 0.3% 0.3% int v8::internal::Deserializer::ReadSingleBytecodeData<v8::internal::SlotAccessorForHeapObject>(unsigned char, v8::internal::SlotAccessorForHeapObject)
1 0.3% 0.3% __pthread_cond_wait
1 0.3% 0.3% __pthread_cond_signal
1 0.3% 0.3% Cr_z_inflate_fast_chunk_
[Summary]:
ticks total nonlib name
148 48.8% 51.4% JavaScript
140 46.2% 48.6% C++
20 6.6% 6.9% GC
15 5.0% Shared libraries
[C++ entry points]:
ticks cpp total name
93 93.9% 30.7% v8_Default_embedded_blob_code_data_
4 4.0% 1.3% v8::internal::Runtime_CompileForOnStackReplacement(int, unsigned long*, v8::internal::Isolate*)
2 2.0% 0.7% v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*)
[Bottom up (heavy) profile]:
Note: percentage shows a share of a particular caller in the total
amount of its parent calls.
Callers occupying less than 1.0% are not shown.
ticks parent name
102 33.7% LazyCompile: *<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
99 32.7% v8_Default_embedded_blob_code_data_
76 76.8% LazyCompile: *<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
16 16.2% LazyCompile: *ics test/mjsunit/tools/tickprocessor-test.js:47:13
16 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
1 1.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
25 8.3% LazyCompile: *ics test/mjsunit/tools/tickprocessor-test.js:47:13
25 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
21 6.9% LazyCompile: *loop test/mjsunit/tools/tickprocessor-test.js:10:14
21 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
12 4.0% __write
9 3.0% /usr/local/google/home/cbruni/Documents/v8/v8/out/x64.release/d8
4 44.4% LazyCompile: ~ics test/mjsunit/tools/tickprocessor-test.js:47:13
4 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
2 22.2% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
2 22.2% LazyCompile: ~read_megamorphic test/mjsunit/tools/tickprocessor-test.js:35:26
2 100.0% LazyCompile: ~ics test/mjsunit/tools/tickprocessor-test.js:47:13
2 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
6 2.0% /usr/lib/x86_64-linux-gnu/libc-2.31.so
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Sample file for creating tickprocessor-test.log
"use strict"
let result;
function loop() {
let result = 0;
for (let i = 0; i < 10_000_000; i++) {
result = add(result, 1);
}
return result;
}
function add(a, b) {
return a + b;
}
result = loop();
result = loop();
// Cause some IC misses
function read_monomorphic(o) {
return o.value
}
function read_polymorphic(o) {
return o.value
}
function read_megamorphic(o) {
return o.value
}
const objects = [];
for (let i = 0; i < 100; i++) {
const object = {};
object['key' + i ];
object['value'] = 1 + i/100;
objects.push(object)
}
function ics() {
result = 0;
for (let i = 0; i < objects.length; i++) {
result += read_monomorphic(objects[0]);
result += read_polymorphic(objects[i % 3])
result += read_megamorphic(objects[i]);
}
}
for (let i = 0; i < 100_000; i++) {
ics();
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
[
["exp",4158389888,4158390051],
["fegetexcept",4158374368,4158374389],
["v8::internal::Runtime_Math_exp(v8::internal::Arguments)",135412512,135412608],
["v8::internal::JSObject::LookupOwnRealNamedProperty(v8::internal::String*, v8::internal::LookupResult*)",135235584,135237008],
["v8::internal::HashTable<v8::internal::StringDictionaryShape, v8::internal::String*>::FindEntry(v8::internal::String*)",135234064,135235584]
]
\ No newline at end of file
Statistical profiling result from v8.log, (13 ticks, 2 unaccounted, 0 excluded).
[Shared libraries]:
ticks total nonlib name
3 23.1% /lib32/libm-2.7.so
1 7.7% ffffe000-fffff000
[JavaScript]:
ticks total nonlib name
[C++]:
ticks total nonlib name
2 15.4% 22.2% v8::internal::Runtime_Math_exp(v8::internal::Arguments)
1 7.7% 11.1% v8::internal::JSObject::LookupOwnRealNamedProperty(v8::internal::String*, v8::internal::LookupResult*)
1 7.7% 11.1% v8::internal::HashTable<v8::internal::StringDictionaryShape, v8::internal::String*>::FindEntry(v8::internal::String*)
1 7.7% 11.1% exp
[Summary]:
ticks total nonlib name
0 0.0% 0.0% JavaScript
5 38.5% 55.6% C++
0 0.0% 0.0% GC
4 30.8% Shared libraries
2 15.4% Unaccounted
[C++ entry points]:
ticks cpp total name
2 40.0% 15.4% v8::internal::Runtime_Math_exp(v8::internal::Arguments)
1 20.0% 7.7% v8::internal::JSObject::LookupOwnRealNamedProperty(v8::internal::String*, v8::internal::LookupResult*)
1 20.0% 7.7% v8::internal::HashTable<v8::internal::StringDictionaryShape, v8::internal::String*>::FindEntry(v8::internal::String*)
1 20.0% 7.7% exp
[Bottom up (heavy) profile]:
Note: percentage shows a share of a particular caller in the total
amount of its parent calls.
Callers occupying less than 1.0% are not shown.
ticks parent name
3 23.1% /lib32/libm-2.7.so
3 100.0% LazyCompile: exp native math.js:41
3 100.0% Script: exp.js
2 15.4% v8::internal::Runtime_Math_exp(v8::internal::Arguments)
2 100.0% LazyCompile: exp native math.js:41
2 100.0% Script: exp.js
2 15.4% UNKNOWN
1 50.0% LazyCompile: exp native math.js:41
1 100.0% Script: exp.js
1 7.7% v8::internal::JSObject::LookupOwnRealNamedProperty(v8::internal::String*, v8::internal::LookupResult*)
1 100.0% Script: exp.js
1 7.7% v8::internal::HashTable<v8::internal::StringDictionaryShape, v8::internal::String*>::FindEntry(v8::internal::String*)
1 100.0% Script: exp.js
1 7.7% ffffe000-fffff000
1 7.7% exp
1 100.0% LazyCompile: exp native math.js:41
1 100.0% Script: exp.js
Statistical profiling result from v8.log, (13 ticks, 2 unaccounted, 0 excluded).
[Shared libraries]:
ticks total nonlib name
3 23.1% /lib32/libm-2.7.so
1 7.7% ffffe000-fffff000
[JavaScript]:
ticks total nonlib name
[C++]:
ticks total nonlib name
2 15.4% 22.2% v8::internal::Runtime_Math_exp(v8::internal::Arguments)
1 7.7% 11.1% v8::internal::JSObject::LookupOwnRealNamedProperty(v8::internal::String*, v8::internal::LookupResult*)
1 7.7% 11.1% v8::internal::HashTable<v8::internal::StringDictionaryShape, v8::internal::String*>::FindEntry(v8::internal::String*)
1 7.7% 11.1% exp
[Summary]:
ticks total nonlib name
0 0.0% 0.0% JavaScript
5 38.5% 55.6% C++
0 0.0% 0.0% GC
4 30.8% Shared libraries
2 15.4% Unaccounted
[C++ entry points]:
ticks cpp total name
2 40.0% 15.4% v8::internal::Runtime_Math_exp(v8::internal::Arguments)
1 20.0% 7.7% v8::internal::JSObject::LookupOwnRealNamedProperty(v8::internal::String*, v8::internal::LookupResult*)
1 20.0% 7.7% v8::internal::HashTable<v8::internal::StringDictionaryShape, v8::internal::String*>::FindEntry(v8::internal::String*)
1 20.0% 7.7% exp
[Bottom up (heavy) profile]:
Note: percentage shows a share of a particular caller in the total
amount of its parent calls.
Callers occupying less than 1.0% are not shown.
ticks parent name
3 23.1% /lib32/libm-2.7.so
3 100.0% LazyCompile: exp native math.js:41
3 100.0% Script: exp.js
2 15.4% v8::internal::Runtime_Math_exp(v8::internal::Arguments)
2 100.0% LazyCompile: exp native math.js:41
2 100.0% Script: exp.js
2 15.4% UNKNOWN
1 50.0% LazyCompile: exp native math.js:41
1 100.0% Script: exp.js
1 7.7% v8::internal::JSObject::LookupOwnRealNamedProperty(v8::internal::String*, v8::internal::LookupResult*)
1 100.0% Script: exp.js
1 7.7% v8::internal::HashTable<v8::internal::StringDictionaryShape, v8::internal::String*>::FindEntry(v8::internal::String*)
1 100.0% Script: exp.js
1 7.7% ffffe000-fffff000
1 7.7% exp
1 100.0% LazyCompile: exp native math.js:41
1 100.0% Script: exp.js
......@@ -353,30 +353,23 @@ import {
})();
function CppEntriesProviderMock() {
};
CppEntriesProviderMock.prototype.parseVmSymbols = function(
name, startAddr, endAddr, slideAddr, symbolAdder) {
var symbols = {
'shell':
[['v8::internal::JSObject::LookupOwnRealNamedProperty(v8::internal::String*, v8::internal::LookupResult*)', 0x080f8800, 0x080f8d90],
['v8::internal::HashTable<v8::internal::StringDictionaryShape, v8::internal::String*>::FindEntry(v8::internal::String*)', 0x080f8210, 0x080f8800],
['v8::internal::Runtime_Math_exp(v8::internal::Arguments)', 0x08123b20, 0x08123b80]],
'/lib32/libm-2.7.so':
[['exp', startAddr + 0x00009e80, startAddr + 0x00009e80 + 0xa3],
['fegetexcept', startAddr + 0x000061e0, startAddr + 0x000061e0 + 0x15]],
'ffffe000-fffff000': []};
assertTrue(name in symbols);
var syms = symbols[name];
for (var i = 0; i < syms.length; ++i) {
symbolAdder.apply(null, syms[i]);
class CppEntriesProviderMock {
constructor(filename) {
this.isLoaded = false;
this.symbols = JSON.parse(readFile(filename));
}
};
parseVmSymbols(name, startAddr, endAddr, slideAddr, symbolAdder) {
if (this.isLoaded) return;
this.isLoaded = true;
for (let symbol of this.symbols) {
symbolAdder.apply(null, symbol);
}
}
}
function PrintMonitor(outputOrFileName) {
class PrintMonitor {
constructor(outputOrFileName) {
this.expectedOut = outputOrFileName;
this.outputFile = undefined;
if (typeof outputOrFileName == 'string') {
......@@ -406,34 +399,37 @@ function PrintMonitor(outputOrFileName) {
}
}
};
};
}
PrintMonitor.prototype.loadExpectedOutput = function(fileName) {
loadExpectedOutput(fileName) {
var output = readFile(fileName);
return output.split('\n');
};
}
PrintMonitor.prototype.finish = function() {
finish() {
print = this.oldPrint;
if (this.diffs.length > 0 || this.unexpectedOut != null) {
print("===== actual output: =====");
print(this.realOut.join('\n'));
print("===== expected output: =====");
console.log("===== actual output: =====");
console.log(this.realOut.join('\n'));
console.log("===== expected output: =====");
if (this.outputFile) {
print("===== File: " + this.outputFile + " =====");
console.log("===== File: " + this.outputFile + " =====");
}
print(this.expectedOut.join('\n'));
console.log(this.expectedOut.join('\n'));
if (this.diffs.length > 0) {
this.diffs.forEach(line => console.log(line))
assertEquals([], this.diffs);
}
assertNull(this.unexpectedOut);
}
};
}
}
function driveTickProcessorTest(
separateIc, separateBytecodes, separateBuiltins, separateStubs,
ignoreUnknown, stateFilter, logInput, refOutput, onlySummary) {
separateBaselineHandlers, ignoreUnknown, stateFilter, logInput,
refOutput, onlySummary) {
// TEST_FILE_NAME must be provided by test runner.
assertEquals('string', typeof TEST_FILE_NAME);
var pathLen = TEST_FILE_NAME.lastIndexOf('/');
......@@ -441,22 +437,24 @@ function driveTickProcessorTest(
pathLen = TEST_FILE_NAME.lastIndexOf('\\');
}
assertTrue(pathLen != -1);
var testsPath = TEST_FILE_NAME.substr(0, pathLen + 1);
var tp = new TickProcessor(new CppEntriesProviderMock(),
const testsPath = TEST_FILE_NAME.substr(0, pathLen + 1);
const symbolsFile = testsPath + logInput + '.symbols.json';
const tp = new TickProcessor(new CppEntriesProviderMock(symbolsFile),
separateIc,
separateBytecodes,
separateBuiltins,
separateStubs,
separateBaselineHandlers,
TickProcessor.CALL_GRAPH_SIZE,
ignoreUnknown,
stateFilter,
"0",
"auto,auto",
false,
null,
false,
false,
onlySummary);
var pm = new PrintMonitor(testsPath + refOutput);
const pm = new PrintMonitor(testsPath + refOutput);
tp.processLogFileInTest(testsPath + logInput);
tp.printStatistics();
pm.finish();
......@@ -466,27 +464,36 @@ function driveTickProcessorTest(
(function testProcessing() {
var testData = {
'Default': [
false, false, true, true, false, null,
false, false, true, true, false, false, null,
'tickprocessor-test.log', 'tickprocessor-test.default', false],
'SeparateBytecodes': [
false, true, true, true, false, false, null,
'tickprocessor-test.log', 'tickprocessor-test.separate-bytecodes', false],
'SeparateBaselineHandlers': [
false, false, true, true, true, false, null,
'tickprocessor-test.log', 'tickprocessor-test.separate-baseline-handlers', false],
'SeparateIc': [
true, false, true, true, false, null,
true, false, true, true, false, false, null,
'tickprocessor-test.log', 'tickprocessor-test.separate-ic', false],
'IgnoreUnknown': [
false, false, true, true, true, null,
false, false, true, true, false, true, null,
'tickprocessor-test.log', 'tickprocessor-test.ignore-unknown', false],
'GcState': [
false, false, true, true, false, TickProcessor.VmStates.GC,
false, false, true, true, false, false, TickProcessor.VmStates.GC,
'tickprocessor-test.log', 'tickprocessor-test.gc-state', false],
'OnlySummary': [
false, false, true, true, false, false, null,
'tickprocessor-test.log', 'tickprocessor-test.only-summary', true],
'FunctionInfo': [
false, false, true, true, false, null,
false, false, true, true, false, false, null,
'tickprocessor-test-func-info.log', 'tickprocessor-test.func-info',
false],
'OnlySummary': [
false, false, true, true, false, null,
'tickprocessor-test.log', 'tickprocessor-test.only-summary', true]
'DefaultLarge': [
false, false, true, true, false, false, null,
'tickprocessor-test-large.log', 'tickprocessor-test-large.default', false],
};
for (var testName in testData) {
print('=== testProcessing-' + testName + ' ===');
driveTickProcessorTest.apply(null, testData[testName]);
console.log('=== testProcessing-' + testName + ' ===');
driveTickProcessorTest(...testData[testName]);
}
})();
......@@ -252,11 +252,18 @@ export class CodeMap {
}
/**
* Returns an array of all libraries entries.
* Returns an array of all library entries.
*/
getAllLibrariesEntries() {
getAllLibraryEntries() {
return this.libraries_.exportValues();
}
/**
* Returns an array of pairs of all library entries and their addresses.
*/
getAllLibraryEntriesWithAddresses() {
return this.libraries_.exportKeysAndValues();
}
}
......
......@@ -151,6 +151,14 @@ export class Profile {
scripts_ = [];
urlToScript_ = new Map();
serializeVMSymbols() {
let result = this.codeMap_.getAllStaticEntriesWithAddresses();
result.concat(this.codeMap_.getAllLibraryEntriesWithAddresses())
return result.map(([startAddress, codeEntry]) => {
return [codeEntry.getName(), startAddress, startAddress + codeEntry.size]
});
}
/**
* Returns whether a function with the specified name must be skipped.
* Should be overriden by subclasses.
......
......@@ -6,11 +6,12 @@
let codeKinds = [
"UNKNOWN",
"CPPPARSE",
"CPPCOMPBC",
"CPPCOMP",
"CPPGC",
"CPPEXT",
"CPP_PARSE",
"CPP_COMP_BC",
"CPP_COMP_BASELINE",
"CPP_COMP",
"CPP_GC",
"CPP_EXT",
"CPP",
"LIB",
"IC",
......@@ -18,10 +19,10 @@ let codeKinds = [
"STUB",
"BUILTIN",
"REGEXP",
"JSOPT",
"JSUNOPT",
"JSTURBOPROP",
"JSBASELINE",
"JS_OPT",
"JS_UNOPT",
"JS_TURBOPROP",
"JS_BASELINE",
];
function resolveCodeKind(code) {
......@@ -52,15 +53,15 @@ function resolveCodeKind(code) {
return "CODE";
} else if (code.type === "JS") {
if (code.kind === "Builtin") {
return "JSUNOPT";
return "JS_UNOPT";
} else if (code.kind === "Opt") {
return "JSOPT";
return "JS_OPT";
} else if (code.kind === "Unopt") {
return "JSUNOPT";
return "JS_UNOPT";
} else if (code.kind === "Baseline") {
return "JSBASELINE";
return "JS_BASELINE";
} else if (code.kind === "Turboprop") {
return "JSTURBOPROP";
return "JS_TURBOPROP";
}
}
console.log("Unknown code type '" + type + "'.");
......@@ -70,16 +71,17 @@ function resolveCodeKindAndVmState(code, vmState) {
let kind = resolveCodeKind(code);
if (kind === "CPP") {
if (vmState === 1) {
kind = "CPPGC";
kind = "CPP_GC";
} else if (vmState === 2) {
kind = "CPPPARSE";
kind = "CPP_PARSE";
} else if (vmState === 3) {
kind = "CPPCOMPBC";
kind = "CPP_COMP_BC";
} else if (vmState === 4) {
kind = "CPPCOMP";
kind = "CPP_COMP";
} else if (vmState === 6) {
kind = "CPPEXT";
kind = "CPP_EXT";
}
// TODO(cbruni): add CPP_COMP_BASELINE
}
return kind;
}
......@@ -269,19 +271,20 @@ function buildCategoryTreeAndLookup() {
}
root.children.push(n);
}
addCategory("JS Optimized", [ "JSOPT" ]);
addCategory("JS Turboprop", [ "JSTURBOPROP" ]);
addCategory("JS Baseline", [ "JSBASELINE" ]);
addCategory("JS Unoptimized", [ "JSUNOPT", "BC" ]);
addCategory("JS Optimized", [ "JS_OPT" ]);
addCategory("JS Turboprop", [ "JS_TURBOPROP" ]);
addCategory("JS Baseline", [ "JS_BASELINE" ]);
addCategory("JS Unoptimized", [ "JS_UNOPT", "BC" ]);
addCategory("IC", [ "IC" ]);
addCategory("RegExp", [ "REGEXP" ]);
addCategory("Other generated", [ "STUB", "BUILTIN" ]);
addCategory("C++", [ "CPP", "LIB" ]);
addCategory("C++/GC", [ "CPPGC" ]);
addCategory("C++/Parser", [ "CPPPARSE" ]);
addCategory("C++/Bytecode compiler", [ "CPPCOMPBC" ]);
addCategory("C++/Compiler", [ "CPPCOMP" ]);
addCategory("C++/External", [ "CPPEXT" ]);
addCategory("C++/GC", [ "CPP_GC" ]);
addCategory("C++/Parser", [ "CPP_PARSE" ]);
addCategory("C++/Bytecode Compiler", [ "CPP_COMP_BC" ]);
addCategory("C++/Baseline Compiler", [ "CPP_COMP_BASELINE" ]);
addCategory("C++/Compiler", [ "CPP_COMP" ]);
addCategory("C++/External", [ "CPP_EXT" ]);
addCategory("Unknown", [ "UNKNOWN" ]);
return { categories, root };
......
......@@ -212,58 +212,90 @@ let main = {
const CATEGORY_COLOR = "#f5f5f5";
const bucketDescriptors =
[ { kinds : [ "JSOPT" ],
color : "#64dd17",
backgroundColor : "#80e27e",
text : "JS Optimized" },
{ kinds : [ "JSTURBOPROP" ],
color : "#693eb8",
backgroundColor : "#a6c452",
text : "JS Turboprop" },
{ kinds : [ "JSBASELINE" ],
color : "#b3005b",
backgroundColor : "#ff9e80",
text : "JS Baseline" },
{ kinds : [ "JSUNOPT", "BC" ],
color : "#dd2c00",
backgroundColor : "#ff9e80",
text : "JS Unoptimized" },
{ kinds : [ "IC" ],
color : "#ff6d00",
backgroundColor : "#ffab40",
text : "IC" },
{ kinds : [ "STUB", "BUILTIN", "REGEXP" ],
color : "#ffd600",
backgroundColor : "#ffea00",
text : "Other generated" },
{ kinds : [ "CPP", "LIB" ],
color : "#304ffe",
backgroundColor : "#6ab7ff",
text : "C++" },
{ kinds : [ "CPPEXT" ],
color : "#003c8f",
backgroundColor : "#c0cfff",
text : "C++/external" },
{ kinds : [ "CPPPARSE" ],
color : "#aa00ff",
backgroundColor : "#ffb2ff",
text : "C++/Parser" },
{ kinds : [ "CPPCOMPBC" ],
color : "#43a047",
backgroundColor : "#88c399",
text : "C++/Bytecode compiler" },
{ kinds : [ "CPPCOMP" ],
color : "#00e5ff",
backgroundColor : "#6effff",
text : "C++/Compiler" },
{ kinds : [ "CPPGC" ],
color : "#6200ea",
backgroundColor : "#e1bee7",
text : "C++/GC" },
{ kinds : [ "UNKNOWN" ],
color : "#bdbdbd",
backgroundColor : "#efefef",
text : "Unknown" }
[{
kinds: ["JS_OPT"],
color: "#64dd17",
backgroundColor: "#80e27e",
text: "JS Optimized"
},
{
kinds: ["JS_TURBOPROP"],
color: "#693eb8",
backgroundColor: "#a6c452",
text: "JS Turboprop"
},
{
kinds: ["JS_BASELINE"],
color: "#b3005b",
backgroundColor: "#ff9e80",
text: "JS Baseline"
},
{
kinds: ["JS_UNOPT", "BC"],
color: "#dd2c00",
backgroundColor: "#ff9e80",
text: "JS Unoptimized"
},
{
kinds: ["IC"],
color: "#ff6d00",
backgroundColor: "#ffab40",
text: "IC"
},
{
kinds: ["STUB", "BUILTIN", "REGEXP"],
color: "#ffd600",
backgroundColor: "#ffea00",
text: "Other generated"
},
{
kinds: ["CPP", "LIB"],
color: "#304ffe",
backgroundColor: "#6ab7ff",
text: "C++"
},
{
kinds: ["CPP_EXT"],
color: "#003c8f",
backgroundColor: "#c0cfff",
text: "C++/external"
},
{
kinds: ["CPP_PARSE"],
color: "#aa00ff",
backgroundColor: "#ffb2ff",
text: "C++/Parser"
},
{
kinds: ["CPP_COMP_BC"],
color: "#43a047",
backgroundColor: "#88c399",
text: "C++/Bytecode compiler"
},
{
kinds: ["CPP_COMP_BASELINE"],
color: "#43a047",
backgroundColor: "#5a8000",
text: "C++/Baseline compiler"
},
{
kinds: ["CPP_COMP"],
color: "#00e5ff",
backgroundColor: "#6effff",
text: "C++/Compiler"
},
{
kinds: ["CPP_GC"],
color: "#6200ea",
backgroundColor: "#e1bee7",
text: "C++/GC"
},
{
kinds: ["UNKNOWN"],
color: "#bdbdbd",
backgroundColor: "#efefef",
text: "Unknown"
}
];
let kindToBucketDescriptor = {};
......@@ -290,15 +322,17 @@ function codeTypeToText(type) {
switch (type) {
case "UNKNOWN":
return "Unknown";
case "CPPPARSE":
case "CPP_PARSE":
return "C++ Parser";
case "CPPCOMPBC":
return "C++ Bytecode Compiler)";
case "CPPCOMP":
case "CPP_COMP_BASELINE":
return "C++ Baseline Compiler";
case "CPP_COMP_BC":
return "C++ Bytecode Compiler";
case "CPP_COMP":
return "C++ Compiler";
case "CPPGC":
case "CPP_GC":
return "C++ GC";
case "CPPEXT":
case "CPP_EXT":
return "C++ External";
case "CPP":
return "C++";
......@@ -314,11 +348,13 @@ function codeTypeToText(type) {
return "Builtin";
case "REGEXP":
return "RegExp";
case "JSOPT":
case "JS_OPT":
return "JS opt";
case "JSTURBOPROP":
case "JS_TURBOPROP":
return "JS Turboprop";
case "JSUNOPT":
case "JS_BASELINE":
return "JS Baseline";
case "JS_UNOPT":
return "JS unopt";
}
console.error("Unknown type: " + type);
......
......@@ -73,6 +73,7 @@ const tickProcessor = new TickProcessor(
params.separateBytecodes,
params.separateBuiltins,
params.separateStubs,
params.separateBaselineHandlers,
params.callGraphSize,
params.ignoreUnknown,
params.stateFilter,
......@@ -85,4 +86,9 @@ const tickProcessor = new TickProcessor(
params.runtimeTimerFilter,
params.preprocessJson);
tickProcessor.processLogFile(params.logFileName);
tickProcessor.printStatistics();
if (params.serializeVMSymbols) {
tickProcessor.printVMSymbols();
} else {
tickProcessor.printStatistics();
}
......@@ -35,10 +35,12 @@ class V8Profile extends Profile {
static IC_RE =
/^(LoadGlobalIC: )|(Handler: )|(?:CallIC|LoadIC|StoreIC)|(?:Builtin: (?:Keyed)?(?:Load|Store)IC_)/;
static BYTECODES_RE = /^(BytecodeHandler: )/;
static BASELINE_HANDLERS_RE = /^(Builtin: .*Baseline.*)/;
static BUILTINS_RE = /^(Builtin: )/;
static STUBS_RE = /^(Stub: )/;
constructor(separateIc, separateBytecodes, separateBuiltins, separateStubs) {
constructor(separateIc, separateBytecodes, separateBuiltins, separateStubs,
separateBaselineHandlers) {
super();
const regexps = [];
if (!separateIc) regexps.push(V8Profile.IC_RE);
......@@ -46,7 +48,7 @@ class V8Profile extends Profile {
if (!separateBuiltins) regexps.push(V8Profile.BUILTINS_RE);
if (!separateStubs) regexps.push(V8Profile.STUBS_RE);
if (regexps.length > 0) {
this.skipThisFunction = function (name) {
this.skipThisFunction = function(name) {
for (let i = 0; i < regexps.length; i++) {
if (regexps[i].test(name)) return true;
}
......@@ -64,7 +66,7 @@ export function readFile(fileName) {
try {
return read(fileName);
} catch (e) {
printErr(`${fileName}: ${e.message || e}`);
printErr(`file="${fileName}": ${e.message || e}`);
throw e;
}
}
......@@ -77,6 +79,7 @@ export class TickProcessor extends LogReader {
separateBytecodes,
separateBuiltins,
separateStubs,
separateBaselineHandlers,
callGraphSize,
ignoreUnknown,
stateFilter,
......@@ -211,7 +214,7 @@ export class TickProcessor extends LogReader {
this.profile_ = new JsonProfile();
} else {
this.profile_ = new V8Profile(separateIc, separateBytecodes,
separateBuiltins, separateStubs);
separateBuiltins, separateStubs, separateBaselineHandlers);
}
this.codeTypes_ = {};
// Count each tick as a time unit.
......@@ -228,6 +231,7 @@ export class TickProcessor extends LogReader {
GC: 1,
PARSER: 2,
BYTECODE_COMPILER: 3,
// TODO(cbruni): add BASELINE_COMPILER
COMPILER: 4,
OTHER: 5,
EXTERNAL: 6,
......@@ -285,7 +289,7 @@ export class TickProcessor extends LogReader {
processSharedLibrary(name, startAddr, endAddr, aslrSlide) {
const entry = this.profile_.addLibrary(name, startAddr, endAddr, aslrSlide);
this.setCodeType(entry.getName(), 'SHARED_LIB');
const libFuncs = this.cppEntriesProvider_.parseVmSymbols(
this.cppEntriesProvider_.parseVmSymbols(
name, startAddr, endAddr, aslrSlide, (fName, fStart, fEnd) => {
this.profile_.addStaticCode(fName, fStart, fEnd);
this.setCodeType(fName, 'CPP');
......@@ -409,6 +413,11 @@ export class TickProcessor extends LogReader {
this.generation_++;
}
printVMSymbols() {
console.log(
JSON.stringify(this.profile_.serializeVMSymbols()));
}
printStatistics() {
if (this.preprocessJson) {
this.profile_.writeJson();
......@@ -854,6 +863,8 @@ export class ArgumentsProcessor extends BaseArgumentsProcessor {
'Separate Builtin entries'],
'--separate-stubs': ['separateStubs', parseBool,
'Separate Stub entries'],
'--separate-baseline-handlers': ['separateBaselineHandlers', parseBool,
'Separate Baseline Handler entries'],
'--unix': ['platform', 'unix',
'Specify that we are running on *nix platform'],
'--windows': ['platform', 'windows',
......@@ -880,6 +891,8 @@ export class ArgumentsProcessor extends BaseArgumentsProcessor {
'Ignore ticks outside pairs of Date.now() calls'],
'--only-summary': ['onlySummary', true,
'Print only tick summary, exclude other information'],
'--serialize-vm-symbols': ['serializeVMSymbols', true,
'Print all C++ symbols and library addresses as JSON data'],
'--preprocess': ['preprocessJson', true,
'Preprocess for consumption with web interface']
};
......@@ -903,6 +916,7 @@ export class ArgumentsProcessor extends BaseArgumentsProcessor {
separateBytecodes: false,
separateBuiltins: true,
separateStubs: true,
separateBaselineHandlers: false,
preprocessJson: null,
targetRootFS: '',
nm: 'nm',
......@@ -913,6 +927,7 @@ export class ArgumentsProcessor extends BaseArgumentsProcessor {
pairwiseTimedRange: false,
onlySummary: false,
runtimeTimerFilter: null,
serializeVMSymbols: false,
};
}
}
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