Allow multiple processes' threads tracked at the same time

Bug: 169279846
Test: atest bpf-time-in-state-tests
Change-Id: Ia2aa4dc3d87610651195c5f50d58fc37a9a84a2a
This commit is contained in:
Dmitri Plotnikov 2020-11-23 15:57:02 -08:00
commit 4f50ca45bc

View file

@ -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;