doujia1988 2016-09-01 21:53
浏览 49

如何分析使用gocheck测试框架的golang测试套件

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 gochecks 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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥15 BC260Y用MQTT向阿里云发布主题消息一直错误
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)