gf/g/os/gwheel/gwheel_z_bench_test.go

22 lines
561 B
Go
Raw Normal View History

2018-12-30 11:08:07 +08:00
// Copyright 2019 gf Author(https://gitee.com/johng/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://gitee.com/johng/gf.
2019-01-01 19:43:31 +08:00
package gwheel_test
2018-12-30 11:08:07 +08:00
import (
2019-01-01 19:43:31 +08:00
"gitee.com/johng/gf/g/os/gwheel"
2018-12-30 11:08:07 +08:00
"testing"
)
func Benchmark_Add(b *testing.B) {
for i := 0; i < b.N; i++ {
2018-12-30 14:53:16 +08:00
// 基准测试的时候不能设置为1秒否则大量的任务会崩掉系统
2019-01-01 19:43:31 +08:00
gwheel.Add(100000, func() {
2018-12-30 11:08:07 +08:00
})
}
}