MCPcopy Create free account
hub / github.com/AdRoll/baker / Stats

Method Stats

input/inpututils/compressedstream.go:131–152  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129}
130
131func (s *inputStats) Stats() map[string]string {
132 stats := make(map[string]string)
133
134 processedSize := atomic.LoadInt64(&s.processedSize)
135 totalSize := atomic.LoadInt64(&s.totalSize)
136 if totalSize > 0 && processedSize > 0 {
137 var estimatedEnd time.Time
138
139 now := time.Now()
140 elapsed := now.Sub(s.beginTime)
141 speed := float64(elapsed) / float64(processedSize)
142 estimatedEnd = now.Add(time.Duration(speed * float64(totalSize-processedSize)))
143
144 eta := -time.Since(estimatedEnd)
145 stats["ETA"] = fmt.Sprint(eta - (eta % time.Second))
146 }
147
148 stats["ProcessedFiles"] = fmt.Sprint(atomic.LoadInt64(&s.processedFiles))
149 stats["TotalFiles"] = fmt.Sprint(atomic.LoadInt64(&s.totalFiles))
150
151 return stats
152}
153
154func NewCompressedInput(opener func(fn string) (io.ReadCloser, int64, time.Time, *url.URL, error), sizer func(fn string) (int64, error), done chan bool) *CompressedInput {
155 s := &CompressedInput{

Callers

nothing calls this directly

Calls 1

DurationMethod · 0.65

Tested by

no test coverage detected