Documentation
¶
Overview ¶
Package perf captures 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 points in time
Example ¶
package main
import (
"fmt"
"time"
"github.com/FAU-CDI/drincw/pkg/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
type Snapshot ¶
Snapshot represents metrics at a specific point in time
func Now ¶
func Now() (s Snapshot)
Now returns a snapshot for the current moment
Example ¶
An example of capturing performance metrics
package main
import (
"fmt"
"runtime"
"time"
"github.com/FAU-CDI/drincw/pkg/perf"
)
func main() {
metrics := perf.Now()
// some fancy and slow task
{
var stuff [10000]int
defer runtime.KeepAlive(stuff)
time.Sleep(1 * time.Second)
}
// print out performance metrics
fmt.Println(perf.Since(metrics))
}
Click to show internal directories.
Click to hide internal directories.