feat: meaningful comments for internal packages

This commit is contained in:
2025-12-29 20:39:43 -05:00
parent aabe92f2dc
commit 05cd8bc4f3
7 changed files with 25 additions and 0 deletions

View File

@@ -1,3 +1,5 @@
// Package "performance" provides a tracker to observer CPU performance during
// execution.
package performance
import (
@@ -6,16 +8,20 @@ import (
"runtime/pprof"
)
// Observes a reduction process, and publishes a CPU performance profile on
// completion.
type Tracker struct {
File string
filePointer *os.File
Error error
}
// Create a performance tracker that outputs a profile to "file".
func Track(file string) *Tracker {
return &Tracker{File: file}
}
// Begin profiling.
func (t *Tracker) Start() {
var absPath string
@@ -40,6 +46,7 @@ func (t *Tracker) Start() {
}
}
// Stop profiling.
func (t *Tracker) End() {
pprof.StopCPUProfile()
t.filePointer.Close()