MCPcopy
hub / github.com/perkeep/perkeep / DumpStats

Function DumpStats

cmd/pk-put/files.go:309–328  ·  view source on GitHub ↗

DumpStats creates the destFile and writes a line per received blob, with its blob size.

(sr *statspkg.Receiver, destFile string)

Source from the content-addressed store, hash-verified

307// DumpStats creates the destFile and writes a line per received blob,
308// with its blob size.
309func DumpStats(sr *statspkg.Receiver, destFile string) {
310 sr.Lock()
311 defer sr.Unlock()
312
313 f, err := os.Create(destFile)
314 if err != nil {
315 log.Fatal(err)
316 }
317
318 var sum int64
319 for _, size := range sr.Have {
320 fmt.Fprintf(f, "%d\n", size)
321 }
322 fmt.Printf("In-memory blob stats: %d blobs, %d bytes\n", len(sr.Have), sum)
323
324 err = f.Close()
325 if err != nil {
326 log.Fatal(err)
327 }
328}
329
330type stats struct {
331 files, bytes int64

Callers 1

RunCommandMethod · 0.85

Calls 6

LockMethod · 0.80
UnlockMethod · 0.80
CreateMethod · 0.80
FatalMethod · 0.80
PrintfMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected