bench

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CPU_USAGE_ALL_THREADS = syscall.RUSAGE_SELF
	CPU_USAGE_THIS_THREAD = syscall.RUSAGE_THREAD
)

Variables

This section is empty.

Functions

func EnableBpfStats

func EnableBpfStats() func() error

func GetBpfStats

func GetBpfStats() map[int64]*BpfProgStats

func GetBpfStatsSince

func GetBpfStatsSince(oldStats map[int64]*BpfProgStats) map[int64]*BpfProgStats

func TraceBenchNameOrPanic

func TraceBenchNameOrPanic(s string) string

func TraceBenchSupported

func TraceBenchSupported() []string

Types

type Arguments

type Arguments struct {
	Trace       string
	Crd         string
	CmdArgs     []string
	Debug       bool
	StoreEvents bool
	PrintEvents bool
	JSONEncode  bool
	Baseline    bool
	RBSize      int
}

func (*Arguments) String

func (args *Arguments) String() string

type BpfProgStats

type BpfProgStats struct {
	Id     int64  `json:"id"`
	Type   string `json:"type"`
	Name   string `json:"name"`
	RunNs  int64  `json:"run_time_ns"`
	RunCnt int64  `json:"run_cnt"`
}

func (*BpfProgStats) String

func (bps *BpfProgStats) String() string

type CPUUsage

type CPUUsage struct {
	SystemTime      time.Duration
	UserTime        time.Duration
	MaxRss          int64
	ContextSwitches int64
}

func CPUUsageFromRusage

func CPUUsageFromRusage(rusage *syscall.Rusage) (cpuUsage CPUUsage)

func GetCPUUsage

func GetCPUUsage(tgt CPUUsageTarget) CPUUsage

func (CPUUsage) Add

func (cu CPUUsage) Add(cu2 CPUUsage) CPUUsage

func (CPUUsage) String

func (cu CPUUsage) String() string

func (CPUUsage) Sub

func (cu CPUUsage) Sub(cu2 CPUUsage) CPUUsage

type CPUUsageTarget

type CPUUsageTarget int

type CountingDiscardWriter

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

func (*CountingDiscardWriter) String

func (cw *CountingDiscardWriter) String() string

func (*CountingDiscardWriter) Write

func (cw *CountingDiscardWriter) Write(p []byte) (n int, err error)

type Summary

type Summary struct {
	Args *Arguments

	ExitEvents, ExecEvents int64

	StartTime          time.Time
	EndTime            time.Time
	RunTime            time.Time
	SetupDurationNanos time.Duration
	TestDurationNanos  time.Duration

	JSONEncodingDurationNanos time.Duration
	ExportStats               CountingDiscardWriter

	TetragonCPUUsage CPUUsage

	// key is the bpf program id
	BpfStats map[int64]*BpfProgStats

	Error string
}

Summary gathers benchmark results. Serializes to JSON. This is updated from multiple places concurrently (ExportStats are from tetragon process), but currently there is no overlap on writes, so this isn't yet protected by a mutex.

func RunTraceBench

func RunTraceBench(args *Arguments) (summary *Summary)

func (*Summary) CSVPrint added in v0.9.0

func (s *Summary) CSVPrint(path, name string) error

func (*Summary) Dump

func (s *Summary) Dump()

func (*Summary) PrettyPrint

func (s *Summary) PrettyPrint()

func (*Summary) WriteFile

func (s *Summary) WriteFile(path string) error

type TraceBench

type TraceBench interface {
	ConfigFilename(args *Arguments) string
	Run(ctx context.Context, args *Arguments, summary *Summary) error
}

Jump to

Keyboard shortcuts

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