From 315a18400cc3d1d2b8f746ec67b3a3ae79324123 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Sat, 19 May 2018 20:16:33 +0800 Subject: [PATCH] update go test --- ants_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ants_test.go b/ants_test.go index ea62ff3..b460152 100644 --- a/ants_test.go +++ b/ants_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/panjf2000/ants" "sync" + "runtime" ) var n = 100000 @@ -34,9 +35,9 @@ func TestDefaultPool(t *testing.T) { ants.Wait() - //mem := runtime.MemStats{} - //runtime.ReadMemStats(&mem) - //fmt.Println("memory usage:", mem.TotalAlloc/1024) + mem := runtime.MemStats{} + runtime.ReadMemStats(&mem) + t.Logf("memory usage:%d", mem.TotalAlloc/1024) } //func TestCustomPool(t *testing.T) { @@ -63,9 +64,10 @@ func TestNoPool(t *testing.T) { demoFunc() }() } + wg.Wait() - //mem := runtime.MemStats{} - //runtime.ReadMemStats(&mem) - //fmt.Println("memory usage:", mem.TotalAlloc/1024) + mem := runtime.MemStats{} + runtime.ReadMemStats(&mem) + t.Logf("memory usage:%d", mem.TotalAlloc/1024) }