-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjobstats.go
34 lines (25 loc) · 891 Bytes
/
jobstats.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package fileperf
import (
"fmt"
"time"
"github.com/dustin/go-humanize"
)
// JobStats report scanning tallies during and at the completion of scanning.
type JobStats struct {
// ElapsedRead is the total time spent reading files.
ElapsedRead time.Duration
// TotalBytes is the total number of bytes read.
TotalBytes int64
// Read is the number of files read without issue.
Read int
// Errors is the number of files that encountered an error.
Errors int
// Scanned is the number of files scanned.
Scanned int
// Skipped is the number of files not scanned due to filters.
Skipped int
}
// String returns a string representation of the job statistics.
func (s JobStats) String() string {
return fmt.Sprintf("%s cumulative read time, %s read, %d files read, %d errors, %d files skipped", s.ElapsedRead, humanize.Bytes(uint64(s.TotalBytes)), s.Read, s.Errors, s.Skipped)
}