Documentation ¶
Overview ¶
Package perf provides a means of capturing performance metrics
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diff ¶
Diff represents the difference between two snapshots
Example ¶
package main import ( "fmt" "time" "github.com/tkw1536/pkglib/perf" ) func main() { // Diff holds both the amount of time an operation took, // the number of bytes consumed, and the total number of allocated objects. diff := perf.Diff{ Time: 15 * time.Second, Bytes: 100, Objects: 100, } fmt.Println(diff) }
Output: 15s, 100 B, 100 objects
func Since ¶
Since returns changes in metrics since start. It is a shortcut for start.Sub(perf.Now())
func (Diff) BytesString ¶
BytesString returns a human-readable string representing the bytes
func (Diff) ObjectsString ¶
ObjectsString returns a human-readable string representing the number of objects
type Snapshot ¶
type Snapshot struct { // Time the snapshot was captured Time time.Time // memory in use Bytes int64 // number of objects on the heap Objects int64 }
Snapshot holds metrics at a specific instance
func (Snapshot) BytesString ¶
BytesString returns a human-readable string representing the bytes
func (Snapshot) ObjectsString ¶
ObjectsString returns a human-readable string representing the number of objects
Click to show internal directories.
Click to hide internal directories.