Documentation ¶
Overview ¶
Package profiler supports capture various kind of system profiler data while running test.
Usage
p, err := profiler.Start(ctx, s, Profiler.Perf(nil), ...) if err != nil { // Error handling... } defer func() { if err := p.End(); err != nil { // Error handling... } }()
Index ¶
Constants ¶
const (
// Used in perfStat to get CPU cycle count on all processes.
PerfAllProcs = 0
)
Type of perf
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PerfOpts ¶
type PerfOpts struct {
// contains filtered or unexported fields
}
PerfOpts represents options for running perf.
func PerfRecordOpts ¶
func PerfRecordOpts() *PerfOpts
PerfRecordOpts creates a PerfOpts for running "perf record -e cycles -g" on the DUT.
func PerfSchedOpts ¶
func PerfSchedOpts(out *PerfSchedOutput, procName string) *PerfOpts
PerfSchedOpts creates a PerfOpts for running "perf sched record" on the DUT.
func PerfStatOpts ¶
func PerfStatOpts(out *PerfStatOutput, pid int) *PerfOpts
PerfStatOpts creates a PerfOpts for running "perf stat -a" on the DUT. out is a pointer to PerfStatOutput, which will hold CPU cycle count per second spent on pid process after End() is called on RunningProf. Set pid to PerfAllProcs to get cycle count for the whole system.
func PerfStatRecordOpts ¶
func PerfStatRecordOpts() *PerfOpts
PerfStatRecordOpts creates a PerfOpts for running "perf stat record -a" on the DUT.
type PerfSchedOutput ¶
type PerfSchedOutput struct { // Maximum latency from wake up to switch MaxLatencyMs float64 }
PerfSchedOutput holds output metrics of perf sched.
type PerfStatOutput ¶
type PerfStatOutput struct {
CyclesPerSecond float64
}
PerfStatOutput holds output of perf stat.
type Profiler ¶
Profiler is a function construct a profiler instance and start the profiler.
func Perf ¶
Perf creates a Profiler instance that constructs the profiler. For opts parameter, nil is treated as the zero value of PerfOpts.
func Top ¶
Top creates a Profiler instance that constructs and runs the profiler. For opts parameter, nil is treated as the zero value of TopOpts.
func VMStat ¶
func VMStat(opts *VMStatOpts) Profiler
VMStat creates a Profiler instance that constructs and runs the profiler. For opts parameter, nil is treated as the zero value of VMStatOpts.
type RunningProf ¶
type RunningProf []instance
RunningProf is the list of all running profilers.
type TopOpts ¶
type TopOpts struct { // Interval indicates the duration between each poll. // The default value is 5 seconds. // Interval must be able to convert to a non-decimal in seconds. // For example, top can run 2 seconds but not 2.3 seconds. // 2.3 will be rounded to 2 for top interval. Interval time.Duration }
TopOpts represents options for running top.
type VMStatOpts ¶
type VMStatOpts struct { // Interval indicates the duration between each vmstat run. // The default value is 1 second. // Interval must be able to convert to a non-decimal in seconds. // For example, vmstat can run 2 seconds but not 2.3 seconds. // 2.3 will be rounded to 2 for vmstat interval. Interval time.Duration }
VMStatOpts represents options for running vmstat.