This package is not in the latest version of its module.
Package progress provides helpers to print progress status.
const ( Bytes = Type("bytes") Duration = Type("duration") Gauge = Type("gauge") )
Type values.
This section is empty.
MetricsStatus renders Status metrics as a string.
CountingReader wraps io.Reader to count bytes.
func NewCountingReader(r io.Reader) *CountingReader
NewCountingReader wraps an io.Reader with counters of bytes and lines.
func (cr *CountingReader) Bytes() int64
Bytes returns number of processed bytes.
func (cr *CountingReader) Lines() int64
Lines returns number of processed lines.
CountingWriter wraps io.Writer to count bytes.
func NewCountingWriter(w io.Writer) *CountingWriter
NewCountingWriter wraps an io.Writer with counters of bytes and lines.
func (cr *CountingWriter) Bytes() int64
Bytes returns number of processed bytes.
type MetricsExposer interface {
Metrics() []Metric
}
MetricsExposer provides metric counters.
type Progress struct {
Interval time.Duration
Print func(status Status)
ShowHeapStats bool
ShowLinesStats bool
// IncrementalSpeed shows speed and remaining estimate based on performance between two status updates.
IncrementalSpeed bool
// contains filtered or unexported fields
}
Progress reports reading performance.
AddMetrics adds more metrics to progress status message.
type Status struct {
Task string `json:"task"`
DonePercent float64 `json:"done_percent"`
LinesCompleted int64 `json:"lines_completed"`
BytesCompleted int64 `json:"bytes_completed"`
SpeedMBPS float64 `json:"speed_mbps"`
SpeedLPS float64 `json:"speed_lps"`
Elapsed time.Duration `json:"-"`
Remaining time.Duration `json:"-"`
Metrics []Metric `json:"-"`
}
Status describes current progress.