mirror of
https://github.com/jimeh/rbheap.git
synced 2026-02-19 12:56:46 +00:00
Track time required to parse dump files
This commit is contained in:
@@ -2,6 +2,7 @@ package leak
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/jimeh/rbheap/obj"
|
"github.com/jimeh/rbheap/obj"
|
||||||
)
|
)
|
||||||
@@ -21,6 +22,7 @@ type Finder struct {
|
|||||||
|
|
||||||
func (s *Finder) Process() error {
|
func (s *Finder) Process() error {
|
||||||
for i, filePath := range s.FilePaths {
|
for i, filePath := range s.FilePaths {
|
||||||
|
start := time.Now()
|
||||||
s.log(fmt.Sprintf("Parsing %s", filePath))
|
s.log(fmt.Sprintf("Parsing %s", filePath))
|
||||||
dump := obj.NewDump(filePath)
|
dump := obj.NewDump(filePath)
|
||||||
|
|
||||||
@@ -30,7 +32,12 @@ func (s *Finder) Process() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.Dumps[i] = dump
|
s.Dumps[i] = dump
|
||||||
s.log(fmt.Sprintf("Parsed %d objects", len(dump.Index)))
|
elapsed := time.Now().Sub(start)
|
||||||
|
s.log(fmt.Sprintf(
|
||||||
|
"Parsed %d objects in %.6f seconds",
|
||||||
|
len(dump.Index),
|
||||||
|
elapsed.Seconds(),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user