Commit 26689077 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[tools] Fix profview for sparkplug

- Handle sparkplug code
- Handle regexp code-creation events in the tick-processor, which
  have no valid state marker in the maybe_func data
- Remove calls to print() that break the tick-processor web version

Change-Id: Ic726d1ae3a41cd46f42cf5498e8463564d3b6b83
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2784562Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarPatrick Thier <pthier@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73631}
parent d8c6b2ec
...@@ -23,10 +23,10 @@ export class BaseArgumentsProcessor { ...@@ -23,10 +23,10 @@ export class BaseArgumentsProcessor {
result() { return this.result_ } result() { return this.result_ }
printUsageAndExit() { printUsageAndExit() {
print('Cmdline args: [options] [log-file-name]\n' + console.log('Cmdline args: [options] [log-file-name]\n' +
'Default log file name is "' + 'Default log file name is "' +
this.result_.logFileName + '".\n'); this.result_.logFileName + '".\n');
print('Options:'); console.log('Options:');
for (const arg in this.argsDispatch_) { for (const arg in this.argsDispatch_) {
const synonyms = [arg]; const synonyms = [arg];
const dispatch = this.argsDispatch_[arg]; const dispatch = this.argsDispatch_[arg];
...@@ -36,7 +36,7 @@ export class BaseArgumentsProcessor { ...@@ -36,7 +36,7 @@ export class BaseArgumentsProcessor {
delete this.argsDispatch_[synArg]; delete this.argsDispatch_[synArg];
} }
} }
print(` ${synonyms.join(', ').padEnd(20)} ${dispatch[2]}`); console.log(` ${synonyms.join(', ').padEnd(20)} ${dispatch[2]}`);
} }
quit(2); quit(2);
} }
......
...@@ -27,7 +27,7 @@ export class CppProcessor extends LogReader { ...@@ -27,7 +27,7 @@ export class CppProcessor extends LogReader {
* @override * @override
*/ */
printError(str) { printError(str) {
print(str); console.log(str);
} }
processLogFile(fileName) { processLogFile(fileName) {
...@@ -61,7 +61,7 @@ export class CppProcessor extends LogReader { ...@@ -61,7 +61,7 @@ export class CppProcessor extends LogReader {
const entry = staticEntries[i]; const entry = staticEntries[i];
const printValues = ['cpp', `0x${entry[0].toString(16)}`, entry[1].size, const printValues = ['cpp', `0x${entry[0].toString(16)}`, entry[1].size,
`"${entry[1].name}"`]; `"${entry[1].name}"`];
print(printValues.join(',')); console.log(printValues.join(','));
} }
} }
} }
...@@ -22,7 +22,7 @@ export function readFile(fileName) { ...@@ -22,7 +22,7 @@ export function readFile(fileName) {
try { try {
return read(fileName); return read(fileName);
} catch (e) { } catch (e) {
print(fileName + ': ' + (e.message || e)); console.log(fileName + ': ' + (e.message || e));
throw e; throw e;
} }
} }
...@@ -78,13 +78,13 @@ const accumulator = { ...@@ -78,13 +78,13 @@ const accumulator = {
StoreInArrayLiteralIC: 0, StoreInArrayLiteralIC: 0,
} }
for (const ic of processor.icTimeline.all) { for (const ic of processor.icTimeline.all) {
print(Object.values(ic)); console.log(Object.values(ic));
accumulator[ic.type]++; accumulator[ic.type]++;
} }
print("========================================"); console.log("========================================");
for (const key of Object.keys(accumulator)) { for (const key of Object.keys(accumulator)) {
print(key + ": " + accumulator[key]); console.log(key + ": " + accumulator[key]);
} }
...@@ -21,7 +21,8 @@ let codeKinds = [ ...@@ -21,7 +21,8 @@ let codeKinds = [
"JSOPT", "JSOPT",
"JSUNOPT", "JSUNOPT",
"JSNCI", "JSNCI",
"JSTURBOPROP" "JSTURBOPROP",
"JSBASELINE",
]; ];
function resolveCodeKind(code) { function resolveCodeKind(code) {
...@@ -59,6 +60,8 @@ function resolveCodeKind(code) { ...@@ -59,6 +60,8 @@ function resolveCodeKind(code) {
return "JSUNOPT"; return "JSUNOPT";
} else if (code.kind === "NCI") { } else if (code.kind === "NCI") {
return "JSNCI"; return "JSNCI";
} else if (code.kind === "Baseline") {
return "JSBASELINE";
} else if (code.kind === "Turboprop") { } else if (code.kind === "Turboprop") {
return "JSTURBOPROP"; return "JSTURBOPROP";
} }
...@@ -272,6 +275,7 @@ function buildCategoryTreeAndLookup() { ...@@ -272,6 +275,7 @@ function buildCategoryTreeAndLookup() {
addCategory("JS Optimized", [ "JSOPT" ]); addCategory("JS Optimized", [ "JSOPT" ]);
addCategory("JS NCI", [ "JSNCI" ]); addCategory("JS NCI", [ "JSNCI" ]);
addCategory("JS Turboprop", [ "JSTURBOPROP" ]); addCategory("JS Turboprop", [ "JSTURBOPROP" ]);
addCategory("JS Baseline", [ "JSBASELINE" ]);
addCategory("JS Unoptimized", [ "JSUNOPT", "BC" ]); addCategory("JS Unoptimized", [ "JSUNOPT", "BC" ]);
addCategory("IC", [ "IC" ]); addCategory("IC", [ "IC" ]);
addCategory("RegExp", [ "REGEXP" ]); addCategory("RegExp", [ "REGEXP" ]);
......
...@@ -224,6 +224,10 @@ const bucketDescriptors = ...@@ -224,6 +224,10 @@ const bucketDescriptors =
color : "#693eb8", color : "#693eb8",
backgroundColor : "#a6c452", backgroundColor : "#a6c452",
text : "JS Turboprop" }, text : "JS Turboprop" },
{ kinds : [ "JSBASELINE" ],
color : "#b3005b",
backgroundColor : "#ff9e80",
text : "JS Baseline" },
{ kinds : [ "JSUNOPT", "BC" ], { kinds : [ "JSUNOPT", "BC" ],
color : "#dd2c00", color : "#dd2c00",
backgroundColor : "#ff9e80", backgroundColor : "#ff9e80",
......
...@@ -293,7 +293,7 @@ export class TickProcessor extends LogReader { ...@@ -293,7 +293,7 @@ export class TickProcessor extends LogReader {
} }
processCodeCreation(type, kind, timestamp, start, size, name, maybe_func) { processCodeCreation(type, kind, timestamp, start, size, name, maybe_func) {
if (maybe_func.length) { if (type != 'RegExp' && maybe_func.length) {
const funcAddr = parseInt(maybe_func[0]); const funcAddr = parseInt(maybe_func[0]);
const state = Profile.parseState(maybe_func[1]); const state = Profile.parseState(maybe_func[1]);
this.profile_.addFuncCode(type, name, timestamp, start, size, funcAddr, state); this.profile_.addFuncCode(type, name, timestamp, start, size, funcAddr, state);
......
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