performance

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecoderMetrics

type DecoderMetrics struct {
	Name     string
	TotalNs  int64 // Total time in nanoseconds
	Count    int64 // Number of invocations
	Records  int64 // Number of records produced
	BytesOut int64 // Bytes written for this decoder
}

DecoderMetrics tracks metrics for a specific decoder

type DiskIOMetrics

type DiskIOMetrics struct {
	FileName   string
	WriteCount int64 // Number of write operations
	WriteNs    int64 // Total time in nanoseconds for writes
	BytesOut   int64 // Total bytes written
	SyncCount  int64 // Number of sync operations
	SyncNs     int64 // Total time in nanoseconds for syncs
}

DiskIOMetrics tracks disk I/O metrics for a specific file/type

type ResolverMetrics

type ResolverMetrics struct {
	Name     string
	TotalNs  int64 // Total time in nanoseconds
	Count    int64 // Number of lookups
	HitCount int64 // Number of cache hits (if tracked)
}

ResolverMetrics tracks metrics for a specific resolver

type RuleMetrics

type RuleMetrics struct {
	Name            string
	TotalNs         int64 // Total time in nanoseconds
	EvaluationCount int64 // Number of times rule was evaluated
	MatchCount      int64 // Number of times rule matched
	AlertCount      int64 // Number of alerts generated by this rule
}

RuleMetrics tracks metrics for a specific rule

type Tracker

type Tracker struct {

	// Packet processing metrics
	TotalPackets     int64
	TotalBytes       int64
	PacketDecodingNs int64 // Total time spent decoding packets
	PacketCount      int64 // Count of packets decoded

	// TCP reassembly metrics
	ReassemblyNs    int64 // Total time spent in TCP reassembly
	ReassemblyCount int64 // Count of packets reassembled

	// DPI metrics
	DPICallsNs int64 // Total time in nanoseconds
	DPICount   int64 // Number of DPI calls

	// Filter metrics
	FilterEvaluationsNs int64 // Total time in nanoseconds
	FilterEvaluations   int64 // Number of filter evaluations
	FilteredRecords     int64 // Number of records filtered out

	// Rules engine metrics
	RulesEvaluationsNs int64 // Total time in nanoseconds
	RulesEvaluations   int64 // Number of rules evaluations
	AlertsGenerated    int64 // Number of alerts generated

	// Timing
	StartTime time.Time
	EndTime   time.Time
	// contains filtered or unexported fields
}

Tracker tracks performance metrics for netcap operations

func NewTracker

func NewTracker() *Tracker

NewTracker creates a new performance tracker

func (*Tracker) Finalize

func (t *Tracker) Finalize()

Finalize marks the end time for the tracker

func (*Tracker) RecordAbstractDecoder

func (t *Tracker) RecordAbstractDecoder(name string, duration time.Duration)

RecordAbstractDecoder records metrics for an abstract decoder

func (*Tracker) RecordCustomDecoder

func (t *Tracker) RecordCustomDecoder(name string, duration time.Duration)

RecordCustomDecoder records metrics for a custom decoder

func (*Tracker) RecordDPI

func (t *Tracker) RecordDPI(duration time.Duration)

RecordDPI records time spent in DPI operations

func (*Tracker) RecordDiskSync

func (t *Tracker) RecordDiskSync(fileName string, duration time.Duration)

RecordDiskSync records a disk sync operation

func (*Tracker) RecordDiskWrite

func (t *Tracker) RecordDiskWrite(fileName string, duration time.Duration, bytesWritten int64)

RecordDiskWrite records a disk write operation

func (*Tracker) RecordFilterEvaluation

func (t *Tracker) RecordFilterEvaluation(duration time.Duration, filtered bool)

RecordFilterEvaluation records time spent evaluating a filter

func (*Tracker) RecordGoPacketDecoder

func (t *Tracker) RecordGoPacketDecoder(layerType string, duration time.Duration)

RecordGoPacketDecoder records metrics for a GoPacket decoder

func (*Tracker) RecordPacketDecoding

func (t *Tracker) RecordPacketDecoding(duration time.Duration)

RecordPacketDecoding records time spent decoding a packet

func (*Tracker) RecordReassembly

func (t *Tracker) RecordReassembly(duration time.Duration)

RecordReassembly records time spent in TCP reassembly

func (*Tracker) RecordResolver

func (t *Tracker) RecordResolver(name string, duration time.Duration, cacheHit bool)

RecordResolver records metrics for a resolver lookup

func (*Tracker) RecordRuleExecution

func (t *Tracker) RecordRuleExecution(ruleName string, duration time.Duration, matched bool, alertGenerated bool)

RecordRuleExecution records metrics for a single rule execution

func (*Tracker) RecordRulesEvaluation

func (t *Tracker) RecordRulesEvaluation(duration time.Duration, alertsGenerated int)

RecordRulesEvaluation records time spent evaluating rules and number of alerts generated

func (*Tracker) RecordStreamDecoder

func (t *Tracker) RecordStreamDecoder(name string, duration time.Duration)

RecordStreamDecoder records metrics for a stream decoder

func (*Tracker) SetTotalPacketsAndBytes

func (t *Tracker) SetTotalPacketsAndBytes(packets, bytes int64)

SetTotalPacketsAndBytes sets the total packets and bytes processed

func (*Tracker) UpdateDecoderRecords

func (t *Tracker) UpdateDecoderRecords(decoderType, name string, records, bytes int64)

UpdateDecoderRecords updates the record count and bytes for a decoder

func (*Tracker) WriteReport

func (t *Tracker) WriteReport(filename string) error

WriteReport writes a performance report to the specified file

Jump to

Keyboard shortcuts

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