Documentation
¶
Overview ¶
Package profile measures generator work and writes CPU and memory profiles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BookMetrics ¶
type BookMetrics struct {
// contains filtered or unexported fields
}
BookMetrics collects wall time and inclusive sampled CPU time for named generator operations. Its zero value is ready for concurrent use.
func (*BookMetrics) LoadCPUProfile ¶
func (m *BookMetrics) LoadCPUProfile(filename string) error
LoadCPUProfile attributes sampled CPU time to every active operation, including its nested operations.
func (*BookMetrics) Measure ¶
func (m *BookMetrics) Measure(ctx context.Context, generator, name string, operation func(context.Context) error, labels ...string) (err error)
Measure runs an operation with pprof labels and records its elapsed time and result.
func (*BookMetrics) Print ¶
func (m *BookMetrics) Print()
Print reports named book-pipeline operations ordered by cumulative wall time. Concurrent wall times and nested CPU times overlap, so they cannot be summed.
func (*BookMetrics) Reset ¶
func (m *BookMetrics) Reset()
Reset removes metrics from a previous run.
type Files ¶
Files names the profiles produced by Capture. Empty paths mean profiling could not start and work ran without profile files.
type SheetMetricKey ¶
type SheetMetricKey struct {
Book string // Book is the source workbook name relative to the input directory.
Sheet string // Sheet is the imported worksheet name.
Detail string // Detail distinguishes operations such as a message or parsing pass.
}
SheetMetricKey identifies one generator operation on an imported sheet.
func (SheetMetricKey) String ¶
func (k SheetMetricKey) String() string
type SheetParserMetrics ¶
type SheetParserMetrics struct {
// contains filtered or unexported fields
}
SheetParserMetrics collects parser time and input metrics by sheet. Its zero value is ready for concurrent use.
func (*SheetParserMetrics) LoadCPUProfile ¶
func (m *SheetParserMetrics) LoadCPUProfile(filename string) (err error)
LoadCPUProfile attributes sampled processor time to sheets through the sheet_key pprof label. Short parser calls may have no samples and remain zero.
func (*SheetParserMetrics) Measure ¶
func (m *SheetParserMetrics) Measure(ctx context.Context, generator string, key SheetMetricKey, sheet *book.Sheet, parse func(context.Context) error) (err error)
Measure runs parse with pprof labels and records its wall time, result, and input metrics. The CPU profile uses sheet_key to attribute processor time without pinning the goroutine to an OS thread.
func (*SheetParserMetrics) Print ¶
func (m *SheetParserMetrics) Print()
Print reports each sheet's sampled CPU time, wall time, and input metrics.
func (*SheetParserMetrics) Reset ¶
func (m *SheetParserMetrics) Reset()
Reset removes metrics collected by the previous generator run.