go test

//测试所有方法
go test 
//输出更多的信息
go test -v 
//go test -bench xregx正则匹配
//基准测试,运行所有的基准测试方法
go test -bench .
//-benchtime 运行多次时间 10s、1h20s、30m
go test -bench .   -benchtime 10s
//-benchtime 运行多次时间 10s、1h20s、30m
//Nx 运行多少次
go test -bench .   -benchtime 100x
//所有的test方法和基准测试方法运行10次
go test -bench .   -count  10
//指定开启多少个cpu运行,默认是GOMAXPROCS.
go test -bench .   -cpu 1,2,4
//benchmem  打印内存分配
go test -bench=. -benchtime 2s -count 2 -benchmem 
//分别生成block、cpu、mutex、trace的文件,并用go tool pprof 分析
 go test -bench=. -benchtime 2s -count 2 -benchmem  -blockprofile block.out -cpuprofile cpu.out -mutexprofile mutex.out  -trace trace.out
 go tool pprof xxx.out 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值