measure

package
v2.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

README

Tracer

A simple utility able to log measured time periods various events. To create a new tracer, call:

t := NewTracer(name string, log logging.Logger)

Tracer object can store a new entry with t.LogTime(entity string, start Time) where entity is a string representation of a measured object (name of a function, structure or just simple string) and start is a start time.

Tracer can measure repeating event (in a loop for example). Every event will be stored with the particular index.

Use t.Get() to read all measurements. The Trace object contains a list of entries and overall time duration.

Last method is t.Clear() which removes all entries from the internal database.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracer added in v1.6.0

type Tracer interface {
	// LogTime puts measured time to the table and resets the time.
	LogTime(msgName string, start time.Time)
	// Get all trace entries stored
	Get() *apitrace.Trace
	// Clear removes entries from the log database
	Clear()
}

Tracer allows to measure, store and list measured time entries.

func NewTracer added in v1.6.0

func NewTracer(msgName string) Tracer

NewTracer creates new tracer object

Directories

Path Synopsis
model

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL