πŸ“·



Visualizing poke_cpu with AWK and Google Sheets

Had some dtrace output from the following script, used to measure interrupts and cross-calls (section 2.3.3 of Solaris Internals: Core Kernel Components) that looked like:

cpu=0 pokes=1427  
cpu=1 pokes=946  
...
time=1522435657  
cpu=0 pokes=804  

After some "simple" AWK

awk -F= '/time/{system("TZ=UTC date -r " $2 " +\"%Y-%m-%d %H:%M:%S\"")};{print}'

2018-03-30 18:47:36     0       1427  
2018-03-30 18:47:36     1       946  
...
2018-03-30 18:47:36     0       804  
...

Then, aggregating similar values for the datetime using the laziest possible way to "join" an array:

{
arr[$3] = $4;  
if ($3 == "0") {  
  printf $1 " " $2 "\t" ;
  for (idx in arr) { printf arr[idx] "\t" } ;
  print " "
}
}

In this case, we build an array of cpu-index to poke count and output a dynamic number of columns which Google Sheets can process easily. That output looks like this:

2018-03-30 18:47:36     1427     946     ...  
2018-03-30 18:47:37     804      ...  

tps vs pokes per cpu over time

Before going through this analysis, I wanted to get an idea of how many calls to poke_cpu were occurring in aggregate. A simple pivot table using datetime for rows and SUM(pokes) for values gives a better idea of how much poking as actually going on:

tps vs aggregate pokes over time

That seems like it might be pretty annoying πŸ₯