Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reporter ¶
Reporter can be used to output timing information on how long something is taking.
func (*Reporter) Enable ¶
func (r *Reporter) Enable()
Enable will cause future TimeOperation() calls to to time the operation. This is so that if not enabled, you can have TimeOperation() calls throughout your code and it won't be expensive since they will do nothing until you chose to Enable() the reporter. NB: this is NOT thread safe.
func (*Reporter) Report ¶
func (r *Reporter) Report()
Report outputs timings collected since the last Report() call. Operations that returned an error are not included in these reports.
func (*Reporter) ReportFinal ¶
func (r *Reporter) ReportFinal()
ReportFinal reports overall and failed timings.
func (*Reporter) StartReporting ¶
StartReporting calls Enable() and then Report() regularly every frequency. NB: this is NOT thread safe.
func (*Reporter) StopReporting ¶
func (r *Reporter) StopReporting()
StopReporting stops the regular calling of Report() and triggers ReportFinal().
func (*Reporter) TimeOperation ¶
TimeOperation, if Enable() has not yet been called, will simply call your given func and return its error. If Enable() has been called, it will time how long your func takes to run, so that Report() can report details about your func.