benchmark

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context provides lightweight timing instrumentation for hook execution. Enabled via config.json: { "debug": { "benchmark": true } }. Output goes to the plugin log file via the provided logFunc.

func New

func New(enabled bool, logFunc func(string, ...interface{})) *Context

New creates a new benchmark context. When enabled, timing data is written to the log file via logFunc.

func (*Context) Async

func (c *Context) Async(name string)

Async marks a non-blocking operation that runs in the background.

func (*Context) Checkpoint

func (c *Context) Checkpoint(name string, success bool)

Checkpoint records a point-in-time event with a success/failure flag.

func (*Context) Elapsed

func (c *Context) Elapsed(name string)

Elapsed records the duration since the matching Start call.

func (*Context) Enabled

func (c *Context) Enabled() bool

Enabled returns whether benchmarking is active.

func (*Context) Report

func (c *Context) Report()

Report outputs all collected timing data to the plugin log file.

func (*Context) Start

func (c *Context) Start(name string)

Start begins timing a named operation.

type TimingEvent

type TimingEvent struct {
	Name     string  `json:"name"`
	Type     string  `json:"type"` // "interval", "checkpoint", "async"
	Duration float64 `json:"duration_ms"`
	Success  bool    `json:"success"`
}

TimingEvent represents a single timing measurement.

Jump to

Keyboard shortcuts

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