summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorDmitri Plotnikov <dplotnikov@google.com>2020-11-23 15:57:02 -0800
committerDmitri Plotnikov <dplotnikov@google.com>2020-11-23 15:57:02 -0800
commit4f50ca45bc5fe9574be975fcd403de0b0d23f777 (patch)
treecb506498cd651edeb5cefe8afc44463e459744e5 /progs
parent7c31522a0ca2e104e3990df0d39346079eebe9e5 (diff)
downloadbpf-4f50ca45bc5fe9574be975fcd403de0b0d23f777.tar.gz
Allow multiple processes' threads tracked at the same time
Bug: 169279846 Test: atest bpf-time-in-state-tests Change-Id: Ia2aa4dc3d87610651195c5f50d58fc37a9a84a2a
Diffstat (limited to 'progs')
-rw-r--r--progs/include/bpf_timeinstate.h18
1 files changed, 18 insertions, 0 deletions
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;