()
| 647 | } |
| 648 | |
| 649 | func (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 | |
| 676 | const bufSz = 64 << 20 |
| 677 | const bufSoftLimit = bufSz - 2<<20 |
no test coverage detected