feat: fix go test -test.bench result

This commit is contained in:
ganglin.song
2017-08-31 09:57:15 +08:00
parent eaebf92131
commit 7e70178155

View File

@@ -153,12 +153,12 @@ func Benchmark_TimeConsumingFunction(b *testing.B) {
```
我们执行命令`go test -file webbench_test.go -test.bench=".*"`,可以看到如下结果:
我们执行命令`go test webbench_test.go -test.bench=".*"`,可以看到如下结果:
PASS
Benchmark_Division 500000000 7.76 ns/op
Benchmark_TimeConsumingFunction 500000000 7.80 ns/op
ok gotest 9.364s
Benchmark_Division-4 500000000 7.76 ns/op 456 B/op 14 allocs/op
Benchmark_TimeConsumingFunction-4 500000000 7.80 ns/op 224 B/op 4 allocs/op
PASS
ok gotest 9.364s
上面的结果显示我们没有执行任何`TestXXX`的单元测试函数,显示的结果只执行了压力测试函数,第一条显示了`Benchmark_Division`执行了500000000次每次的执行平均时间是7.76纳秒,第二条显示了`Benchmark_TimeConsumingFunction`执行了500000000每次的平均执行时间是7.80纳秒。最后一条显示总共的执行时间。