Skip to contentSkip to conversation

gpu/trace: add a gpu work period tracepoint

PATCH New Aakash Deep Sarkar 1 participant 1 message Oct 6, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpu/trace: add a gpu work period tracepoint

This patch adds the GPU work period kernel tracepoint as required by the Android platforms. GPU work period event defines a non-overlapping, non-zero period of time from start_time_ns (inclusive) until end_time_ns (exclusive) for a given uid, and includes details of how much work the GPU was performing for uid during the period.

The GPU work period event is required to have the following format:

Defines the structure of the kernel tracepoint:
/sys/kernel/tracing/events/power/gpu_work_period

A value that uniquely identifies the GPU within the system.
uint32_t gpu_id;

The UID of the application (i.e. persistent, unique ID of the Android app) that submitted work to the GPU.
uint32_t uid;

The start time of the period in nanoseconds. The clock must be CLOCK_MONOTONIC_RAW, as returned by the ktime_get_raw_ns(void) function.
uint64_t start_time_ns;

The end time of the period in nanoseconds. The clock must be CLOCK_MONOTONIC_RAW, as returned by the ktime_get_raw_ns(void) function.
uint64_t end_time_ns;

The amount of time the GPU was running GPU work for |uid| during the period, in nanoseconds, without double-counting parallel GPU work for the same |uid|. For example, this might include the amount of time the GPU spent performing shader work (vertex work, fragment work, etc.) for |uid|.
uint64_t total_active_duration_ns;

---
 drivers/gpu/trace/Kconfig       | 12 +++++++
 include/trace/gpu_work_period.h | 59 +++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)
 create mode 100644 include/trace/gpu_work_period.h
drivers/gpu/trace/Kconfig +12 -0
index cd3d19c4a201..33ffe865739b 100644
@@ -11,3 +11,15 @@ config TRACE_GPU_MEM
 	  Tracepoint availability varies by GPU driver.
 
 	  If in doubt, say "N".
+
+config TRACE_GPU_WORK_PERIOD
+        bool "Enable GPU work period tracepoint"
+        default n
+        help
+          Choose this option to enable tracepoint for tracking
+          GPU usage based on the UID. Intended for performance
+          profiling and required for Android.
+
+          Tracepoint availability varies by GPU driver.
+
+          If in doubt, say "N".
include/trace/gpu_work_period.h new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.49.0