xref: /aosp_15_r20/frameworks/native/cmds/atrace/README.md (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1*38e8c45fSAndroid Build Coastguard Worker# Atrace categories
2*38e8c45fSAndroid Build Coastguard Worker
3*38e8c45fSAndroid Build Coastguard WorkerThe atrace command (and the perfetto configuration) allow listing **categories**
4*38e8c45fSAndroid Build Coastguard Workerto select subsets of events to be traced.
5*38e8c45fSAndroid Build Coastguard Worker
6*38e8c45fSAndroid Build Coastguard WorkerEach category can include some userspace events and some ftrace events.
7*38e8c45fSAndroid Build Coastguard Worker
8*38e8c45fSAndroid Build Coastguard Worker## Vendor categories
9*38e8c45fSAndroid Build Coastguard Worker
10*38e8c45fSAndroid Build Coastguard WorkerIt's possible to extend exiting categories (or to define new categories) from
11*38e8c45fSAndroid Build Coastguard Workerthe /vendor partition in order to add hardware specific ftrace events.
12*38e8c45fSAndroid Build Coastguard Worker
13*38e8c45fSAndroid Build Coastguard WorkerSince android 14, if the file `/vendor/etc/atrace/atrace_categories.txt`, atrace
14*38e8c45fSAndroid Build Coastguard Workerand perfetto will consider the categories and ftrace events listed there.
15*38e8c45fSAndroid Build Coastguard Worker
16*38e8c45fSAndroid Build Coastguard WorkerThe file contains a list of categories, and for each category (on the following
17*38e8c45fSAndroid Build Coastguard Workerlines, indented with one or more spaces of time), a list of ftrace events that
18*38e8c45fSAndroid Build Coastguard Workershould be enabled when the category is enabled.
19*38e8c45fSAndroid Build Coastguard Worker
20*38e8c45fSAndroid Build Coastguard WorkerEach ftrace event should be a subdirectory in `/sys/kernel/tracing/events/` and
21*38e8c45fSAndroid Build Coastguard Workershould be of the form `group/event`. Listing a whole group is not supported,
22*38e8c45fSAndroid Build Coastguard Workereach event needs to be listed explicitly.
23*38e8c45fSAndroid Build Coastguard Worker
24*38e8c45fSAndroid Build Coastguard WorkerIt is not an error if an ftrace event is listed in the file, but not present on
25*38e8c45fSAndroid Build Coastguard Workerthe tracing file system.
26*38e8c45fSAndroid Build Coastguard Worker
27*38e8c45fSAndroid Build Coastguard WorkerExample:
28*38e8c45fSAndroid Build Coastguard Worker
29*38e8c45fSAndroid Build Coastguard Worker```
30*38e8c45fSAndroid Build Coastguard Workergfx
31*38e8c45fSAndroid Build Coastguard Worker mali/gpu_power_state
32*38e8c45fSAndroid Build Coastguard Worker mali/mali_pm_status
33*38e8c45fSAndroid Build Coastguard Workerthermal_tj
34*38e8c45fSAndroid Build Coastguard Worker thermal_exynos/thermal_cpu_pressure
35*38e8c45fSAndroid Build Coastguard Worker thermal_exynos/thermal_exynos_arm_update
36*38e8c45fSAndroid Build Coastguard Worker```
37*38e8c45fSAndroid Build Coastguard Worker
38*38e8c45fSAndroid Build Coastguard WorkerThe file lists two categories (`gfx` and `thermal_tj`). When the `gfx` category
39*38e8c45fSAndroid Build Coastguard Workeris enabled, atrace (or perfetto) will enable
40*38e8c45fSAndroid Build Coastguard Worker`/sys/kernel/tracing/events/mali/gpu_power_state` and
41*38e8c45fSAndroid Build Coastguard Worker`/sys/kernel/tracing/events/mali/mali_pm_status`. When the `thermal_tj` category
42*38e8c45fSAndroid Build Coastguard Workeris enabled, atrace (or perfetto) will enable
43*38e8c45fSAndroid Build Coastguard Worker`/sys/kernel/tracing/events/thermal_exynos/thermal_cpu_pressure` and
44*38e8c45fSAndroid Build Coastguard Worker`/sys/kernel/tracing/events/thermal_exynos/thermal_exynos_arm_update`.
45*38e8c45fSAndroid Build Coastguard Worker
46*38e8c45fSAndroid Build Coastguard WorkerSince android 14, if the file `/vendor/etc/atrace/atrace_categories.txt` exists
47*38e8c45fSAndroid Build Coastguard Workeron the file system, perfetto and atrace do not query the android.hardware.atrace
48*38e8c45fSAndroid Build Coastguard WorkerHAL (which is deprecated).
49