From ea5025d8ab80d06f245c77f0f80d74ed1d75a826 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Wed, 23 May 2018 23:55:42 +0800 Subject: [PATCH] update --- ants_test.go | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/ants_test.go b/ants_test.go index 74c95e9..1092e21 100644 --- a/ants_test.go +++ b/ants_test.go @@ -73,7 +73,7 @@ func TestDefaultPool(t *testing.T) { t.Logf("running workers number:%d", ants.Running()) mem := runtime.MemStats{} runtime.ReadMemStats(&mem) - t.Logf("memory usage:%d", mem.TotalAlloc/MiB) + t.Logf("memory usage:%d MB", mem.TotalAlloc/MiB) } func TestNoPool(t *testing.T) { @@ -89,30 +89,30 @@ func TestNoPool(t *testing.T) { wg.Wait() mem := runtime.MemStats{} runtime.ReadMemStats(&mem) - t.Logf("memory usage:%d", mem.TotalAlloc/MiB) + t.Logf("memory usage:%d MB", mem.TotalAlloc/MiB) } -func TestAntsPoolWithFunc(t *testing.T) { - var wg sync.WaitGroup - p, _ := ants.NewPoolWithFunc(50000, func(i interface{}) error { - demoPoolFunc(i) - wg.Done() - return nil - }) - for i := 0; i < n; i++ { - wg.Add(1) - p.Serve(n) - } - wg.Wait() +//func TestAntsPoolWithFunc(t *testing.T) { +// var wg sync.WaitGroup +// p, _ := ants.NewPoolWithFunc(50000, func(i interface{}) error { +// demoPoolFunc(i) +// wg.Done() +// return nil +// }) +// for i := 0; i < n; i++ { +// wg.Add(1) +// p.Serve(n) +// } +// wg.Wait() //t.Logf("pool capacity:%d", ants.Cap()) //t.Logf("free workers number:%d", ants.Free()) - t.Logf("running workers number:%d", p.Running()) - mem := runtime.MemStats{} - runtime.ReadMemStats(&mem) - t.Logf("memory usage:%d", mem.TotalAlloc/GiB) -} +// t.Logf("running workers number:%d", p.Running()) +// mem := runtime.MemStats{} +// runtime.ReadMemStats(&mem) +// t.Logf("memory usage:%d", mem.TotalAlloc/GiB) +//} // func TestNoPool(t *testing.T) { // var wg sync.WaitGroup