Skip to content

Instantly share code, notes, and snippets.

@drj11
Last active July 13, 2016 10:53
Show Gist options
  • Save drj11/ff80d26f496f2cc8c834e88ce298defc to your computer and use it in GitHub Desktop.
Save drj11/ff80d26f496f2cc8c834e88ce298defc to your computer and use it in GitHub Desktop.

Average CPU job: 4900 seconds

$ awk -F: '{print $35, $37}' 1percent | awk '{a+=$2};END{print a/NR}'
4852.23

Average number of cores, per CPU second

awk -F: '{print $35, $37}' 1percent | awk '{p+=$1*$2;a+=$2}; END {print p/a}'
34.9133

Average over whole dataset:

awk -F: '{print $35, $37}' accounting | awk '{p+=$1*$2;a+=$2};END{print p/a}'
37.7884

CPU counts per user

awk -F: '{cpu[$4]+=$37};END{for(a in cpu){printf "%.0f %s\n",cpu[a],a}}' 1percent | sort -n

Everything since 2015-01-01

awk -F: '$9 >= 1420070400' accounting > full-2015

Table of (slots, CPU-seconds)

awk -F: 'BEGIN{OFMT="%.0f";Slots=35;Wall=14};{t[$Slots]+=$Wall*$Slots};END{for(n in t) { print n, t[n] } }' full-2015 > slot-cpu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment