I'm attempting to profile a golang test suite that uses the gocheck test framework.
I'm running the following commands to start the test with profiling:
go test -c -o integration.test -cpuprofile cpu.prof -blockprofile block.prof
./integration.test -test.cpuprofile cpu.prof -test.blockprofile block.prof
The test suite runs as it would normally, and produces the two expected files. The total test execution time is approxiately 50 minutes. The problem is with the contents of the files.
If I create a report with go tool pprof
or go-torch the profiles appear to only contain data for a few seconds, instead of the entire test run (50 minutes).
If I look at the stdout of the test runs, I notice some tests are much slower than others, and run for 50s, but those slow tests don't even appear in the profile data.
I believe something is causing pprof to write out incorrect data, but I'm not sure what that might be. My only guess is that it has to do with gocheck
s use of panic()
to run every test and test fixture.
This profile1.zip contains: the test binary, the profiles, and a framegraph report from them.