github.com/gogf/gf@v1.16.9/os/gtimer/gtimer_z_bench_test.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 package gtimer 8 9 import ( 10 "testing" 11 "time" 12 ) 13 14 var ( 15 timer = New() 16 ) 17 18 func Benchmark_Add(b *testing.B) { 19 for i := 0; i < b.N; i++ { 20 timer.Add(time.Hour, func() { 21 22 }) 23 } 24 } 25 26 func Benchmark_PriorityQueue_Pop(b *testing.B) { 27 for i := 0; i < b.N; i++ { 28 timer.queue.Pop() 29 } 30 } 31 32 func Benchmark_StartStop(b *testing.B) { 33 for i := 0; i < b.N; i++ { 34 timer.Start() 35 timer.Stop() 36 } 37 }