MCPcopy
hub / github.com/dgraph-io/dgraph / Progress

Method Progress

worker/restore_map.go:649–674  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

647}
648
649func (m *mapper) Progress() {
650 defer m.closer.Done()
651
652 ticker := time.Tick(time.Second)
653
654 start := time.Now()
655 update := func() {
656 read := atomic.LoadUint64(&m.bytesRead)
657 proc := atomic.LoadUint64(&m.bytesProcessed)
658 since := time.Since(start)
659 rate := uint64(float64(proc) / since.Seconds())
660 glog.Infof("Restore MAP %s read: %s. output: %s. rate: %s/sec. jemalloc: %s.\n",
661 x.FixedDuration(since), humanize.IBytes(read), humanize.IBytes(proc),
662 humanize.IBytes(rate), humanize.IBytes(uint64(z.NumAllocBytes())))
663 }
664 for {
665 select {
666 case <-m.closer.HasBeenClosed():
667 update()
668 glog.Infof("Restore MAP Done in %s.\n", x.FixedDuration(time.Since(start)))
669 return
670 case <-ticker:
671 update()
672 }
673 }
674}
675
676const bufSz = 64 << 20
677const bufSoftLimit = bufSz - 2<<20

Callers 1

RunMapperFunction · 0.95

Calls 3

FixedDurationFunction · 0.92
InfofMethod · 0.80
DoneMethod · 0.45

Tested by

no test coverage detected