Skip to content
Prev Previous commit
Next Next commit
Strip file:/ prefixes from scriptNames and fixed system tests
The inspector approach uses
[`CpuProfilingMode::kLeafNodeLineNumbers`](https://source.chromium.org/chromium/chromium/src/+/main:v8/include/v8-profiler.h;l=244;drc=27e39fa1dd71076618c358639ed8a327bc3873c4)
under the hood which changes the line numbering scheme. I updated the
tests to expect the new line number.
  • Loading branch information
aabmass committed Nov 2, 2022
commit 7211b6da90396dbb5b9e9ce4e634771896d20bf7
7 changes: 4 additions & 3 deletions system-test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

SRCDIR="/cloned_src"

trap "cd $SRCDIR && npm run clean" EXIT
trap "echo '** TEST FAILED **'" ERR
# trap "cd $SRCDIR && npm run clean" EXIT
# trap "echo '** TEST FAILED **'" ERR

function timeout_after() {
# timeout on Node 11 alpine image requires -t to specify time.
Expand Down Expand Up @@ -57,10 +57,11 @@ fi

node -v
node --trace-warnings "$BENCHPATH" 10 $VERIFY_TIME_LINE_NUMBERS
ls

if [[ "$VERIFY_TIME_LINE_NUMBERS" == "true" ]]; then
pprof -lines -top -nodecount=2 time.pb.gz | tee $tty | \
grep "busyLoop.*src/busybench.js:[2-3][08-9]"
grep "busyLoop.*src/busybench.js:27"
pprof -filefunctions -top -nodecount=2 heap.pb.gz | tee $tty | \
grep "busyLoop.*src/busybench.js"
else
Expand Down
3 changes: 2 additions & 1 deletion ts/src/time-profiler-inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ function translateToTimeProfile(
callFrame: {columnNumber, functionName, lineNumber, scriptId, url},
}: inspector.Profiler.ProfileNode): TimeProfileNode {
const parsedScriptId = parseInt(scriptId);
const scriptName = url.startsWith('file:/') ? url.slice(6) : url;
return {
name: functionName,
scriptName: url,
scriptName,

// Add 1 because these are zero-based
columnNumber: columnNumber + 1,
Expand Down