UPSTREAM: ANDROID: tracing: add power/gpu_frequency
From Android 16 CDD: [7.1.4.6/H-1-4] MUST report a GPU Frequency tracepoint as specified by the format: power/gpu_frequency. Bug: 457797217 Test: cat /sys/kernel/tracing/events/power/gpu_frequency/format Change-Id: Ie8cd95cb8fe8471c2de19c48cdf57c8cf59f2370 Signed-off-by: Chia-I Wu <olv@google.com> Signed-off-by: Sorayukii <sorayukii69@gmail.com>
This commit is contained in:
parent
26cdf7ce8b
commit
b24d8263d0
5 changed files with 59 additions and 2 deletions
|
|
@ -2,7 +2,6 @@
|
|||
# taken to initialize them in the correct order. Link order is the only way
|
||||
# to ensure this currently.
|
||||
obj-$(CONFIG_TEGRA_HOST1X) += host1x/
|
||||
obj-y += drm/ vga/
|
||||
obj-y += drm/ vga/ trace/
|
||||
obj-$(CONFIG_IMX_IPUV3_CORE) += ipu-v3/
|
||||
obj-$(CONFIG_QCOM_KGSL) += msm/
|
||||
obj-$(CONFIG_TRACE_GPU_MEM) += trace/
|
||||
|
|
|
|||
|
|
@ -11,3 +11,15 @@ config TRACE_GPU_MEM
|
|||
Tracepoint availability varies by GPU driver.
|
||||
|
||||
If in doubt, say "N".
|
||||
|
||||
config TRACE_GPU_POWER
|
||||
bool "Enable GPU power usage tracepoints"
|
||||
default n
|
||||
help
|
||||
Choose this option to enable tracepoints for tracking
|
||||
global and per-process GPU power usage. Intended for
|
||||
performance profiling and required for Android.
|
||||
|
||||
Tracepoint availability varies by GPU driver.
|
||||
|
||||
If in doubt, say "N".
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
obj-$(CONFIG_TRACE_GPU_MEM) += trace_gpu_mem.o
|
||||
obj-$(CONFIG_TRACE_GPU_POWER) += trace_gpu_power.o
|
||||
|
|
|
|||
11
drivers/gpu/trace/trace_gpu_power.c
Normal file
11
drivers/gpu/trace/trace_gpu_power.c
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright 2025 Google LLC
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/gpu_power.h>
|
||||
|
||||
EXPORT_TRACEPOINT_SYMBOL(gpu_frequency);
|
||||
34
include/trace/events/gpu_power.h
Normal file
34
include/trace/events/gpu_power.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM power // just "power" for historical reasons
|
||||
|
||||
#if !defined(_TRACE_GPU_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_GPU_POWER_H
|
||||
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
TRACE_EVENT(gpu_frequency,
|
||||
|
||||
TP_PROTO(unsigned int state, unsigned int gpu_id),
|
||||
|
||||
TP_ARGS(state, gpu_id),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(unsigned int, state)
|
||||
__field(unsigned int, gpu_id)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->state = state;
|
||||
__entry->gpu_id = gpu_id;
|
||||
),
|
||||
|
||||
TP_printk("state=%u gpu_id=%u", __entry->state, __entry->gpu_id)
|
||||
);
|
||||
|
||||
#endif /* _TRACE_GPU_POWER_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#undef TRACE_INCLUDE_FILE
|
||||
#define TRACE_INCLUDE_FILE gpu_power
|
||||
#include <trace/define_trace.h>
|
||||
Loading…
Reference in a new issue