Documentation
¶
Overview ¶
Package pace provides a threadsafe counter for measuring ticks in the specified timeframe.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pace ¶
type Pace interface {
// Step increments the counter of pace.
Step(f float64)
// StepN increments the counter of pace, using integer N.
StepN(n int)
// Pause stops reporting until resumed, all steps continue to be counted.
Pause()
// Resume resumes the reporting, starting a report with info since the last tick.
// Specify a new interval or 0 if you don't want to override it.
Resume(interval time.Duration)
// Report manually triggers a report with time frame less than the defined interval.
// Specify a custom reporter function just for this one report.
Report(reporter ReporterFunc)
}
Pace is a an interface to register ticks, force reporting and pause/resume the meter.
type ReporterFunc ¶
ReporterFunc defines a function used to report current pace.
func DefaultReporter ¶
func DefaultReporter() ReporterFunc
DefaultReporter reports using log.Printf and stops reporting when flow of events is stoped.
Click to show internal directories.
Click to hide internal directories.
