diff --git a/progs/include/bpf_timeinstate.h b/progs/include/bpf_timeinstate.h index 61d3324..7cb7baa 100644 --- a/progs/include/bpf_timeinstate.h +++ b/progs/include/bpf_timeinstate.h @@ -45,6 +45,24 @@ typedef struct { uint32_t freq; } freq_idx_key_t; +// Maximum number of processes whose thread CPU time-in-state can be tracked simultaneously. +#define MAX_TRACKED_PIDS 8 + +// Indicates that the pid_tracked_map item is unused and further items in the array are also +// unused +#define TRACKED_PID_STATE_UNUSED 0 +// Indicates that the pid_tracked_map item contains a PID that is currently tracked +#define TRACKED_PID_STATE_ACTIVE 1 +// Indicates that the pid_tracked_map item is vacant, but further items in the array may +// contain tracked PIDs +#define TRACKED_PID_STATE_EXITED 2 + +typedef struct { + pid_t pid; + // TRACKED_PID_STATE_UNUSED, TRACKED_PID_STATE_ACTIVE or TRACKED_PID_STATE_EXITED + uint8_t state; +} tracked_pid_t; + typedef struct { pid_t tgid; uint16_t aggregation_key;