| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM power |
| 4 | |
| 5 | #if !defined(LTTNG_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define LTTNG_TRACE_POWER_H |
| 7 | |
| 8 | #include <probes/lttng-tracepoint-event.h> |
| 9 | #include <linux/ktime.h> |
| 10 | |
| 11 | LTTNG_TRACEPOINT_EVENT_CLASS(power_cpu, |
| 12 | |
| 13 | TP_PROTO(unsigned int state, unsigned int cpu_id), |
| 14 | |
| 15 | TP_ARGS(state, cpu_id), |
| 16 | |
| 17 | TP_FIELDS( |
| 18 | ctf_integer(u32, state, state) |
| 19 | ctf_integer(u32, cpu_id, cpu_id) |
| 20 | ) |
| 21 | ) |
| 22 | |
| 23 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_cpu, cpu_idle, |
| 24 | |
| 25 | power_cpu_idle, |
| 26 | |
| 27 | TP_PROTO(unsigned int state, unsigned int cpu_id), |
| 28 | |
| 29 | TP_ARGS(state, cpu_id) |
| 30 | ) |
| 31 | |
| 32 | /* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */ |
| 33 | #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING |
| 34 | #define _PWR_EVENT_AVOID_DOUBLE_DEFINING |
| 35 | |
| 36 | #define PWR_EVENT_EXIT -1 |
| 37 | #endif |
| 38 | |
| 39 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_cpu, cpu_frequency, |
| 40 | |
| 41 | power_cpu_frequency, |
| 42 | |
| 43 | TP_PROTO(unsigned int frequency, unsigned int cpu_id), |
| 44 | |
| 45 | TP_ARGS(frequency, cpu_id) |
| 46 | ) |
| 47 | |
| 48 | LTTNG_TRACEPOINT_EVENT_MAP(machine_suspend, |
| 49 | |
| 50 | power_machine_suspend, |
| 51 | |
| 52 | TP_PROTO(unsigned int state), |
| 53 | |
| 54 | TP_ARGS(state), |
| 55 | |
| 56 | TP_FIELDS( |
| 57 | ctf_integer(u32, state, state) |
| 58 | ) |
| 59 | ) |
| 60 | |
| 61 | LTTNG_TRACEPOINT_EVENT_CLASS(power_wakeup_source, |
| 62 | |
| 63 | TP_PROTO(const char *name, unsigned int state), |
| 64 | |
| 65 | TP_ARGS(name, state), |
| 66 | |
| 67 | TP_FIELDS( |
| 68 | ctf_string(name, name) |
| 69 | ctf_integer(u64, state, state) |
| 70 | ) |
| 71 | ) |
| 72 | |
| 73 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_wakeup_source, wakeup_source_activate, |
| 74 | |
| 75 | power_wakeup_source_activate, |
| 76 | |
| 77 | TP_PROTO(const char *name, unsigned int state), |
| 78 | |
| 79 | TP_ARGS(name, state) |
| 80 | ) |
| 81 | |
| 82 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_wakeup_source, wakeup_source_deactivate, |
| 83 | |
| 84 | power_wakeup_source_deactivate, |
| 85 | |
| 86 | TP_PROTO(const char *name, unsigned int state), |
| 87 | |
| 88 | TP_ARGS(name, state) |
| 89 | ) |
| 90 | |
| 91 | /* |
| 92 | * The clock events are used for clock enable/disable and for |
| 93 | * clock rate change |
| 94 | */ |
| 95 | LTTNG_TRACEPOINT_EVENT_CLASS(power_clock, |
| 96 | |
| 97 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 98 | |
| 99 | TP_ARGS(name, state, cpu_id), |
| 100 | |
| 101 | TP_FIELDS( |
| 102 | ctf_string(name, name) |
| 103 | ctf_integer(u64, state, state) |
| 104 | ctf_integer(u64, cpu_id, cpu_id) |
| 105 | ) |
| 106 | ) |
| 107 | |
| 108 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock, clock_enable, |
| 109 | |
| 110 | power_clock_enable, |
| 111 | |
| 112 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 113 | |
| 114 | TP_ARGS(name, state, cpu_id) |
| 115 | ) |
| 116 | |
| 117 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock, clock_disable, |
| 118 | |
| 119 | power_clock_disable, |
| 120 | |
| 121 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 122 | |
| 123 | TP_ARGS(name, state, cpu_id) |
| 124 | ) |
| 125 | |
| 126 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(power_clock, clock_set_rate, |
| 127 | |
| 128 | power_clock_set_rate, |
| 129 | |
| 130 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 131 | |
| 132 | TP_ARGS(name, state, cpu_id) |
| 133 | ) |
| 134 | |
| 135 | /* |
| 136 | * The power domain events are used for power domains transitions |
| 137 | */ |
| 138 | LTTNG_TRACEPOINT_EVENT_CLASS(power_domain, |
| 139 | |
| 140 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 141 | |
| 142 | TP_ARGS(name, state, cpu_id), |
| 143 | |
| 144 | TP_FIELDS( |
| 145 | ctf_string(name, name) |
| 146 | ctf_integer(u64, state, state) |
| 147 | ctf_integer(u64, cpu_id, cpu_id) |
| 148 | ) |
| 149 | ) |
| 150 | |
| 151 | LTTNG_TRACEPOINT_EVENT_INSTANCE(power_domain, power_domain_target, |
| 152 | |
| 153 | TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id), |
| 154 | |
| 155 | TP_ARGS(name, state, cpu_id) |
| 156 | ) |
| 157 | |
| 158 | #endif /* LTTNG_TRACE_POWER_H */ |
| 159 | |
| 160 | /* This part must be outside protection */ |
| 161 | #include <probes/define_trace.h> |