add my perf script specify hook name for perf data

This commit is contained in:
bgkillas 2025-06-18 12:17:45 -04:00
parent 5d3e99298a
commit a5d6de8bc8
2 changed files with 14 additions and 1 deletions

View file

@ -54,7 +54,7 @@ function ctx.add_hook(hook_name, system_name, fn)
util.tpcall(entry.fn, ...)
local end_time = GameGetRealWorldTimeSinceStarted()
local delta = (end_time - start_time) * 1000000
ctx.timings = ctx.timings .. entry.system_name .. ":" .. delta .. ","
ctx.timings = ctx.timings .. hook_name .. "/" .. entry.system_name .. ":" .. delta .. ","
end
end,
})

13
scripts/perf.sh Executable file
View file

@ -0,0 +1,13 @@
set -e
f=$(cat $1)
a=$(echo "$f"|grep "LUA: \["|sed 's/LUA: \[//g;s/].*//;s/ //g'|awk -F',' '{col1 = col1 $1 " "; col2 = col2 $2 " "; col3 = col3 $3 " "} END {print col1; print col2; print col3}'|sed 's/ /,/g;s/,$/}/g;s/^/{/')
for b in $a;do
echo "{mean$b,standarddeviation$b,max$b,len$b}"|kalc
done
a=$(echo "$f"|grep "LUA: {"|sed 's/LUA: {//g;s/}.*//;s/ //g'|sed 's/,/\n/g'|sort -n)
for i in $(echo "$a"|sed 's/:.*//g'|uniq);do
b=$(echo {$(echo "$a"|grep "^$i:"|sed 's/.*://g')}|sed 's/ /,/g')
echo -ne "$i "
echo "{mean$b,standarddeviation$b,max$b,len$b}"|kalc
done