Commit c057d5f1 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Add some GC data to benchmark.

parent 36aa391b
...@@ -106,6 +106,9 @@ func BenchmarkGoFuseThreadedStat(b *testing.B) { ...@@ -106,6 +106,9 @@ func BenchmarkGoFuseThreadedStat(b *testing.B) {
func TestingBOnePass(b *testing.B, threads int, files []string) (results []float64) { func TestingBOnePass(b *testing.B, threads int, files []string) (results []float64) {
runtime.GC() runtime.GC()
var before, after runtime.MemStats
runtime.ReadMemStats(&before)
todo := b.N todo := b.N
for todo > 0 { for todo > 0 {
...@@ -118,6 +121,10 @@ func TestingBOnePass(b *testing.B, threads int, files []string) (results []float ...@@ -118,6 +121,10 @@ func TestingBOnePass(b *testing.B, threads int, files []string) (results []float
b.StopTimer() b.StopTimer()
results = append(results, result) results = append(results, result)
} }
runtime.ReadMemStats(&after)
fmt.Printf("GC count %d, total GC time: %d ns/file\n",
after.NumGC-before.NumGC, (after.PauseTotalNs-before.PauseTotalNs)/uint64(b.N))
return results return results
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment