Skip to content

Commit

Permalink
feat: prover-client exec timing analysis scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
charlielye committed Dec 9, 2024
1 parent 866a5f7 commit 82434a2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
10 changes: 10 additions & 0 deletions yarn-project/prover-client/analyse_bin_timings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

NODE_NO_WARNINGS=1 strace -f -tt -T \
-e trace=execve \
-o /dev/stderr \
-s 4096 \
node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --forceExit \
src/test/bb_prover_full_rollup.test.ts \
2> >(./process_trace.sh) \
1>/dev/null
34 changes: 34 additions & 0 deletions yarn-project/prover-client/process_trace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

awk '
/execve/ && /aztec-packages/ {
# Extract the PID, timestamp, and command
pid = $1
match($0, /execve\([^,]+, \[(.+?)\]/, cmd)
command[pid] = cmd[1]
sub("/mnt/user-data/charlie/aztec-repos/aztec-packages/", "", command[pid])
sub(".* ", "", $2) # Remove the date from timestamp
start_time[pid] = $2
}
/\+\+\+ exited/ {
# Extract the PID and timestamp from the exit line
pid = $1
if (pid in start_time) {
sub(".* ", "", $2) # Remove the date from timestamp
end_time = $2
# Calculate the wall-clock time
split(start_time[pid], start, ":")
split(end_time, end, ":")
wall_clock = (end[1] * 3600 + end[2] * 60 + end[3]) - (start[1] * 3600 + start[2] * 60 + start[3])
if (wall_clock < 0) wall_clock += 86400 # Handle timestamp wrapping across midnight
# Print in the desired format: [timestamp] [wall-clock-time] [command]
printf "[%s] [%.3f] [%s]\n", start_time[pid], wall_clock, command[pid]
delete command[pid]
delete start_time[pid]
}
}
' $1

0 comments on commit 82434a2

Please sign in to comment.