From 64aeabbc95576892b61d3e99e60ea74bbf734f80 Mon Sep 17 00:00:00 2001 From: Camillo Bruni Date: Tue, 19 Jul 2022 15:11:01 +0200 Subject: [PATCH] [tools][profile] Add support for maglev optimisation markers Drive-by-fix: - Rename baseline to sparkplug for consistency - Add request timeouts for the local symbol server - Add script to start a local symbol server - Fix -h/--help support for linux-perf-chrome-renderer-cmd.sh Change-Id: I4c2fc3595d672871f20fc5c4065ba45e801a1111 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3769699 Auto-Submit: Camillo Bruni Commit-Queue: Camillo Bruni Reviewed-by: Toon Verwaest Cr-Commit-Position: refs/heads/main@{#81992} --- ...rocessor-test.separate-sparkplug-handlers} | 0 test/mjsunit/tools/tickprocessor.mjs | 10 ++-- tools/callstats.html | 2 +- tools/profile.mjs | 22 +++++--- .../linux-perf-chrome-renderer-cmd.sh | 2 +- tools/system-analyzer/index.html | 8 ++- tools/system-analyzer/local-server.sh | 55 +++++++++++++++++++ tools/system-analyzer/processor.mjs | 3 +- tools/tickprocessor.mjs | 20 +++---- 9 files changed, 95 insertions(+), 27 deletions(-) rename test/mjsunit/tools/{tickprocessor-test.separate-baseline-handlers => tickprocessor-test.separate-sparkplug-handlers} (100%) create mode 100755 tools/system-analyzer/local-server.sh diff --git a/test/mjsunit/tools/tickprocessor-test.separate-baseline-handlers b/test/mjsunit/tools/tickprocessor-test.separate-sparkplug-handlers similarity index 100% rename from test/mjsunit/tools/tickprocessor-test.separate-baseline-handlers rename to test/mjsunit/tools/tickprocessor-test.separate-sparkplug-handlers diff --git a/test/mjsunit/tools/tickprocessor.mjs b/test/mjsunit/tools/tickprocessor.mjs index b0ecc99f84..a09f99fe42 100644 --- a/test/mjsunit/tools/tickprocessor.mjs +++ b/test/mjsunit/tools/tickprocessor.mjs @@ -39,7 +39,7 @@ // Resources: test/mjsunit/tools/tickprocessor-test.log // Resources: test/mjsunit/tools/tickprocessor-test.log.symbols.json // Resources: test/mjsunit/tools/tickprocessor-test.only-summary -// Resources: test/mjsunit/tools/tickprocessor-test.separate-baseline-handlers +// Resources: test/mjsunit/tools/tickprocessor-test.separate-sparkplug-handlers // Resources: test/mjsunit/tools/tickprocessor-test.separate-bytecodes // Resources: test/mjsunit/tools/tickprocessor-test.separate-ic @@ -417,9 +417,9 @@ await (async function testProcessing() { 'SeparateBytecodes': [ 'tickprocessor-test.log', 'tickprocessor-test.separate-bytecodes', ['--separate-ic=false', '--separate-bytecodes']], - 'SeparateBaselineHandlers': [ - 'tickprocessor-test.log', 'tickprocessor-test.separate-baseline-handlers', - ['--separate-ic=false', '--separate-baseline-handlers']], + 'SeparateSparkplugHandlers': [ + 'tickprocessor-test.log', 'tickprocessor-test.separate-sparkplug-handlers', + ['--separate-ic=false', '--separate-sparkplug-handlers']], 'SeparateIc': [ 'tickprocessor-test.log', 'tickprocessor-test.separate-ic', ['--separate-ic=true']], @@ -479,4 +479,4 @@ async function testEndToEnd(dir, sourceFile, ignoredRefOutput, params) { const printMonitor = new PrintMonitor(dir + ignoredRefOutput); await tickProcessor.processLogFileInTest(tmpLogFile); tickProcessor.printStatistics(); -} \ No newline at end of file +} diff --git a/tools/callstats.html b/tools/callstats.html index 9a50059e1e..548a1e8d21 100644 --- a/tools/callstats.html +++ b/tools/callstats.html @@ -1185,7 +1185,7 @@ code is governed by a BSD-style license that can be found in the LICENSE file. let parts = location.pathname.split("/").slice(0, -1); url = location.origin + parts.join('/') + '/' + url; } - let response = await fetch(url); + let response = await fetch(url, {timeout: 20}); if (!response.ok) return false; let filename = url.split('/'); filename = filename[filename.length - 1]; diff --git a/tools/profile.mjs b/tools/profile.mjs index 60be2180f8..28490ea72e 100644 --- a/tools/profile.mjs +++ b/tools/profile.mjs @@ -186,15 +186,16 @@ export class Script { (async () => { try { let sourceMapPayload; + const options = { timeout: 15 }; try { - sourceMapPayload = await fetch(sourceMapURL); + sourceMapPayload = await fetch(sourceMapURL, options); } catch (e) { if (e instanceof TypeError && sourceMapFetchPrefix) { // Try again with fetch prefix. // TODO(leszeks): Remove the retry once the prefix is // configurable. sourceMapPayload = - await fetch(sourceMapFetchPrefix + sourceMapURL); + await fetch(sourceMapFetchPrefix + sourceMapURL, options); } else { throw e; } @@ -350,7 +351,8 @@ export class Profile { static CodeState = { COMPILED: 0, IGNITION: 1, - BASELINE: 2, + SPARKPLUG: 2, + MAGLEV: 4, TURBOFAN: 5, } @@ -359,7 +361,7 @@ export class Profile { GC: 1, PARSER: 2, BYTECODE_COMPILER: 3, - // TODO(cbruni): add BASELINE_COMPILER + // TODO(cbruni): add SPARKPLUG_COMPILER COMPILER: 4, OTHER: 5, EXTERNAL: 6, @@ -381,7 +383,9 @@ export class Profile { case '~': return this.CodeState.IGNITION; case '^': - return this.CodeState.BASELINE; + return this.CodeState.SPARKPLUG; + case '+': + return this.CodeState.MAGLEV; case '*': return this.CodeState.TURBOFAN; } @@ -393,8 +397,10 @@ export class Profile { return "Builtin"; } else if (state === this.CodeState.IGNITION) { return "Unopt"; - } else if (state === this.CodeState.BASELINE) { - return "Baseline"; + } else if (state === this.CodeState.SPARKPLUG) { + return "Sparkplug"; + } else if (state === this.CodeState.MAGLEV) { + return "Maglev"; } else if (state === this.CodeState.TURBOFAN) { return "Opt"; } @@ -425,7 +431,7 @@ export class Profile { /** * Called whenever the specified operation has failed finding a function - * containing the specified address. Should be overriden by subclasses. + * containing the specified address. Should be overridden by subclasses. * See the Profile.Operation enum for the list of * possible operations. * diff --git a/tools/profiling/linux-perf-chrome-renderer-cmd.sh b/tools/profiling/linux-perf-chrome-renderer-cmd.sh index 60fe73b241..c562520bc0 100755 --- a/tools/profiling/linux-perf-chrome-renderer-cmd.sh +++ b/tools/profiling/linux-perf-chrome-renderer-cmd.sh @@ -8,7 +8,7 @@ PERF_DATA_PREFIX="chrome_renderer" RENDERER_ID="0" for i in "$@"; do case $i in - --help) + -h|--help) echo "Usage: path/to/chrome --renderer-cmd-prefix='$0 [OPTION]' [CHROME OPTIONS]" echo "This script is mostly used in conjuction with linux_perf.py to run linux-perf" echo "for each renderer process." diff --git a/tools/system-analyzer/index.html b/tools/system-analyzer/index.html index 5c6d270c27..3d7e240409 100644 --- a/tools/system-analyzer/index.html +++ b/tools/system-analyzer/index.html @@ -13,7 +13,7 @@ found in the LICENSE file. -->