Skip to content

Commit

Permalink
fix(ebpf): register processor conditionally
Browse files Browse the repository at this point in the history
Register SchedProcessFork processors, including normalizeTimeArg,
only if proctree is enabled.
  • Loading branch information
geyslan committed Oct 10, 2024
1 parent cf1562d commit 30b33a4
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions pkg/ebpf/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,25 @@ func (t *Tracee) RegisterEventProcessor(id events.ID, proc func(evt *trace.Event

// registerEventProcessors registers all event processors, each to a specific event id.
func (t *Tracee) registerEventProcessors() {
//
// Event Timestamps Normalization
//

// Convert all time relate args to nanoseconds since epoch.
// NOTE: Make sure to convert time related args (of your event) in here, so that
// any later code has access to normalized time arguments.
t.RegisterEventProcessor(events.SchedProcessFork, t.normalizeTimeArg(
"start_time",
"parent_start_time",
"parent_process_start_time",
"leader_start_time",
))

//
// Process Tree Processors
//

// Processors registered when proctree source "events" is enabled.
switch t.config.ProcTree.Source {
case proctree.SourceEvents, proctree.SourceBoth:
// Event Timestamps Normalization
//
// Convert all time relate args to nanoseconds since epoch.
// NOTE: Make sure to convert time related args (of your event) in here, so that
// any later code has access to normalized time arguments.
t.RegisterEventProcessor(events.SchedProcessFork, t.normalizeTimeArg(
"start_time",
"parent_start_time",
"parent_process_start_time",
"leader_start_time",
))

t.RegisterEventProcessor(events.SchedProcessFork, t.procTreeForkProcessor)
t.RegisterEventProcessor(events.SchedProcessExec, t.procTreeExecProcessor)
t.RegisterEventProcessor(events.SchedProcessExit, t.procTreeExitProcessor)
Expand Down

0 comments on commit 30b33a4

Please sign in to comment.