summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorKan Liang <kan.liang@linux.intel.com>2025-12-05 16:16:41 -0800
committerPeter Zijlstra <peterz@infradead.org>2025-12-17 13:31:04 +0100
commitf5c7de8f84a152d559256aa4d0fc953118b73ca4 (patch)
tree811d4467bac90a238d4f7626118430a77e898950 /include/linux
parenteff95e170275d9e80b968f335cd03d0ac250d2d1 (diff)
perf: Clean up perf ctx time
The current perf tracks two timestamps for the normal ctx and cgroup. The same type of variables and similar codes are used to track the timestamps. In the following patch, the third timestamp to track the guest time will be introduced. To avoid the code duplication, add a new struct perf_time_ctx and factor out a generic function update_perf_time_ctx(). No functional change. Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Mingwei Zhang <mizhang@google.com> Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Xudong Hao <xudong.hao@intel.com> Link: https://patch.msgid.link/20251206001720.468579-6-seanjc@google.com
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/perf_event.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 31929da6e711..d5aa1bc3f088 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -999,6 +999,11 @@ struct perf_event_groups {
u64 index;
};
+struct perf_time_ctx {
+ u64 time;
+ u64 stamp;
+ u64 offset;
+};
/**
* struct perf_event_context - event context structure
@@ -1037,9 +1042,7 @@ struct perf_event_context {
/*
* Context clock, runs when context enabled.
*/
- u64 time;
- u64 timestamp;
- u64 timeoffset;
+ struct perf_time_ctx time;
/*
* These fields let us detect when two contexts have both
@@ -1172,9 +1175,7 @@ struct bpf_perf_event_data_kern {
* This is a per-cpu dynamically allocated data structure.
*/
struct perf_cgroup_info {
- u64 time;
- u64 timestamp;
- u64 timeoffset;
+ struct perf_time_ctx time;
int active;
};