3 # A small script to help visualizing CPU usage over time data collected on CI
6 # This script is expected to be called with two arguments. The first is the full
7 # commit SHA of the build you're interested in, and the second is the name of
8 # the builder. For example:
10 # ./src/etc/cpu-usage-over-time-plot.sh 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c x86_64-gnu
12 # That will generate `$builder.png` in the current directory which you can open
13 # up to see a hopefully pretty graph.
15 # Improvements to this script are greatly appreciated!
17 if [[ $# != 2 ]]; then
18 echo "expected 2 arguments, recieved $#"
19 echo "example usage: './src/etc/cpu-usage-over-time-plot.sh \
20 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c \
31 curl -O https://$bucket.s3.amazonaws.com/rustc-builds/$commit/cpu-$builder.csv
35 set timefmt '%Y-%m-%dT%H:%M:%S'
37 set ylabel "CPU Usage %"
40 set term png size 3000,1000
41 set output "$builder-$commit-cpu-usage-plot.png"
45 fit f(x) 'cpu-$builder.csv' using 1:(100-\$2) via mean_y
47 set label 1 gprintf("Average = %g%%", mean_y) center font ",18"
48 set label 1 at graph 0.50, 0.25
49 set xtics rotate by 45 offset -2,-2.4 300
54 mean_y with lines linetype 1 linecolor rgb "#ff0000" title "average", "cpu-$builder.csv" \\
55 using 1:(100-\$2) with points pointtype 7 pointsize 0.4 title "$builder", "" \\
56 using 1:(100-\$2) smooth bezier linewidth 3 title "bezier"