Example #1
0
func (s *DiskvSpooler) Status() map[string]string {
	s.mux.Lock()
	defer s.mux.Unlock()
	s.status.Update("data-spooler-count", fmt.Sprintf("%d", s.count))
	s.status.Update("data-spooler-size", pct.Bytes(s.size))
	s.status.Update("data-spooler-oldest", fmt.Sprintf("%s", time.Unix(0, s.oldest).UTC()))
	return s.status.All()
}
Example #2
0
func (s *SysTestSuite) TestBytes(t *C) {
	t.Check(pct.Bytes(0), Equals, "0")
	t.Check(pct.Bytes(1024), Equals, "1.02 kB")
	t.Check(pct.Bytes(12749201), Equals, "12.75 MB")
	t.Check(pct.Bytes(222566303), Equals, "222.57 MB")
	t.Check(pct.Bytes(1987654321), Equals, "1.99 GB")
	t.Check(pct.Bytes(5001987654321), Equals, "5.00 TB")
}
Example #3
0
func (s *SenderStats) Report() SentReport {
	r := SentReport{
		Begin: s.begin,
		End:   s.end,
	}
	for e := s.sent.Back(); e != nil; e = e.Prev() {
		info := e.Value.(SentInfo)

		r.bytes += info.Bytes
		r.sendTime += info.SendTime
		r.Files += info.Files
		r.Errs += info.Errs
		r.ApiErrs += info.ApiErrs
		r.Timeouts += info.Timeouts
		r.BadFiles += info.BadFiles
	}
	r.Bytes = pct.Bytes(r.bytes)
	r.Duration = pct.Duration(s.end.Sub(s.begin).Seconds())
	r.Utilization = pct.Mbps(r.bytes, s.end.Sub(s.begin).Seconds()) + " Mbps"
	r.Throughput = pct.Mbps(r.bytes, r.sendTime) + " Mbps"
	return r
}