diff options
| -rw-r--r-- | internal/bench_pipeline_test.go | 2 | ||||
| -rw-r--r-- | internal/runtime_builder.go | 4 | ||||
| -rw-r--r-- | internal/statsengine/engine.go | 12 |
3 files changed, 13 insertions, 5 deletions
diff --git a/internal/bench_pipeline_test.go b/internal/bench_pipeline_test.go index 7967e3a..bb6404a 100644 --- a/internal/bench_pipeline_test.go +++ b/internal/bench_pipeline_test.go @@ -197,7 +197,7 @@ func benchmarkPipelineTUIParquet(b *testing.B, mix benchutil.EventMix, events, n el := mustNewEventLoop(b, eventLoopConfig{}) preseedBenchComms(el, numThreads) - engine := statsengine.NewEngine(64) + engine := statsengine.NewEngine(statsengine.DefaultTopN) streamBuf := streamrow.NewRingBuffer() streamSeq := streamrow.NewSequencer(0) liveTrie := flamegraph.NewLiveTrie([]string{"comm", "tracepoint", "path"}, "count") diff --git a/internal/runtime_builder.go b/internal/runtime_builder.go index bc1c228..17a69c6 100644 --- a/internal/runtime_builder.go +++ b/internal/runtime_builder.go @@ -7,8 +7,6 @@ import ( "ior/internal/streamrow" ) -const defaultEngineCapacity = 64 - // runtimeComponents holds the freshly allocated trace-session components // produced by RuntimeBuilder.Build. All fields are non-nil after a successful // build. The caller is responsible for wiring these into the runtime bindings @@ -41,7 +39,7 @@ func newRuntimeBuilder(cfg flags.Config) RuntimeBuilder { // concurrent trace sessions. func (b RuntimeBuilder) Build() runtimeComponents { return runtimeComponents{ - engine: statsengine.NewEngine(defaultEngineCapacity), + engine: statsengine.NewEngine(statsengine.DefaultTopN), streamBuf: streamrow.NewRingBuffer(), streamSeq: streamrow.NewSequencer(0), liveTrie: flamegraph.NewLiveTrie(b.cfg.CollapsedFields, b.cfg.CountField), diff --git a/internal/statsengine/engine.go b/internal/statsengine/engine.go index 6681c66..78dbe65 100644 --- a/internal/statsengine/engine.go +++ b/internal/statsengine/engine.go @@ -9,7 +9,17 @@ import ( "ior/internal/types" ) -const trendWindowSlots = 20 +const ( + // trendWindowSlots is the number of slots used for trend detection in ring + // time series. Two consecutive windows of this size are compared to detect + // rising, falling, or stable throughput/latency trends. + trendWindowSlots = 20 + + // DefaultTopN is the default maximum number of top entries tracked per + // category (files, processes). It is exported so callers can use it as the + // standard capacity when constructing a new Engine via NewEngine. + DefaultTopN = 64 +) // Engine aggregates streaming syscall data into immutable snapshots. type Engine struct { |
