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

Method printCounters

dgraph/cmd/live/batch.go:461–479  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

459}
460
461func (l *loader) printCounters() {
462 period := 5 * time.Second
463 ticker := time.Tick(period)
464 start := time.Now()
465
466 var last Counter
467 for range ticker {
468 counter := l.Counter()
469 rate := float64(counter.Nquads-last.Nquads) / period.Seconds()
470 elapsed := time.Since(start).Round(time.Second)
471 timestamp := time.Now().Format("15:04:05Z0700")
472 fmt.Printf("[%s] Elapsed: %s Txns: %d N-Quads: %s N-Quads/s: %s"+
473 " Inflight: %2d/%2d Aborts: %d\n",
474 timestamp, x.FixedDuration(elapsed), counter.TxnsDone,
475 humanize.Comma(int64(counter.Nquads)), humanize.Comma(int64(rate)),
476 atomic.LoadInt32(&l.inflight), atomic.LoadInt32(&l.conc), counter.Aborts)
477 last = counter
478 }
479}
480
481// Counter returns the current state of the BatchMutation.
482func (l *loader) Counter() Counter {

Callers 1

runFunction · 0.80

Calls 3

CounterMethod · 0.95
FixedDurationFunction · 0.92
FormatMethod · 0.80

Tested by

no test coverage detected