Converts CSV to pprof profile format.
Use csv2pprof when you have some data in a database or a spreadsheet you'd like to turn into a pprof profile.
go install github.com/google/csv2pprof@latest
csv2pprof < input.csv > output.pprof.gz
Input CSVs must have:
- a header row
- a semicolon-delimited
stackcolumn (similar to Brendan Gregg's Folded Stacks format) - one or more integer measurement columns (e.g. samples, or time). Measurements
can have units given after a forward-slash
/.
Example CSV input:
cpu-time/milliseconds,stack
1000,main;foo
2000,main;foo;bar
4000,main;baz
Or you can have many measurement columns:
cpu-time/milliseconds,samples,instructions,stack
1000,10,100,main;foo
2000,20,200,main;foo;bar
4000,40,400,main;baz
If you want to use a different separator for the stack than semicolon, use
--stacksep:
$ csv2pprof --stacksep=\n < input.csv > pprof.pb.gz
- Brendan Gregg's Folded Stacks Format uses semicolon-separated stacks, and a space-separated measurement.
- felixge's pprofutils converts folded stack format to pprof.
The folded stack format is just a little harder to generate from databases and spreadsheets.