File tree Expand file tree Collapse file tree 4 files changed +9
-10
lines changed
Expand file tree Collapse file tree 4 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 1818scripts /summary.md
1919CMD
2020VERSION
21+ INSTRUCTIONS
2122STATS
2223SIZE
2324CYCLES
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ ENV DEBIAN_FRONTEND="noninteractive" TZ="Europe/London"
44
55RUN apt-get update
66RUN apt-get install -y autoconf automake bc bison build-essential curl flex \
7- gawk gdb git jq libffi-dev libsigsegv-dev libtool lldb moreutils pkg-config \
8- tar texinfo unzip valgrind wget xz-utils zip && apt-get clean
7+ gawk gdb git jq libffi-dev libsigsegv-dev libtool linux-perf lldb moreutils \
8+ pkg-config tar texinfo unzip wget xz-utils zip && apt-get clean
99RUN apt-get install -y clang && apt-get clean
1010RUN apt-get install -y default-jdk default-jre && apt-get clean
1111RUN apt-get install -y erlang && apt-get clean
Original file line number Diff line number Diff line change 3939 just -l | grep -v ' build-all' | grep ' build-' | cut -d' -' -f2- | xargs
4040
4141build what :
42- rm -f CMD VERSION STATS SIZE CYCLES
42+ rm -f CMD VERSION STATS SIZE CYCLES INSTRUCTIONS
4343 just build-{{ what}}
4444
4545build-all :
@@ -100,11 +100,10 @@ measure what: (_check "bc hyperfine max_rss jq sponge")
100100 max_rss -ro STATS -- $(cat CMD)
101101 jq ' . += {"max_rss": ' $(cat STATS)' }' " $out" | sponge " $out"
102102
103- cycle_cmd=" $(cat CMD)"
104- cycle_cmd=" ${cycle_cmd/{{ i}} /100000}"
105- valgrind --tool=callgrind --callgrind-out-file=callgrind.txt $cycle_cmd
106- grep " summary:" callgrind.txt | awk ' {print $2}' > CYCLES
107- jq ' . += {"cycles": ' $(cat CYCLES)' }' " $out" | sponge " $out"
103+ perf_out=$(perf stat -x, -e cycles,instructions $(cat CMD) 2 >&1 >/ dev/ null)
104+ echo " $perf_out" | awk -F, ' $3~/^cycles/{print $1}' > CYCLES
105+ echo " $perf_out" | awk -F, ' $3~/^instructions/{print $1}' > INSTRUCTIONS
106+ jq ' . += {"cycles": ' $(cat CYCLES)' ,"instructions": ' $(cat INSTRUCTIONS)' }' " $out" | sponge " $out"
108107
109108measure-all :
110109 #!/usr/bin/env bash
Original file line number Diff line number Diff line change @@ -120,8 +120,7 @@ ${markdownTable(
120120 }
121121) }
122122
123- Note that cycles are counted with valgrind (using callgrind) and are only estimates of the actual CPU cycles used.
124- Called with \`100000\` as input.
123+ Note that cycles are counted with \`perf\` and are only estimates of the actual CPU cycles used, as this can vary.
125124
126125${ markdownTable (
127126 [
You can’t perform that action at this time.
0 commit comments