linux/include/trace/events/power.h
<<
>>
Prefs
   1#undef TRACE_SYSTEM
   2#define TRACE_SYSTEM power
   3
   4#if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
   5#define _TRACE_POWER_H
   6
   7#include <linux/ktime.h>
   8#include <linux/pm_qos.h>
   9#include <linux/tracepoint.h>
  10
  11DECLARE_EVENT_CLASS(cpu,
  12
  13        TP_PROTO(unsigned int state, unsigned int cpu_id),
  14
  15        TP_ARGS(state, cpu_id),
  16
  17        TP_STRUCT__entry(
  18                __field(        u32,            state           )
  19                __field(        u32,            cpu_id          )
  20        ),
  21
  22        TP_fast_assign(
  23                __entry->state = state;
  24                __entry->cpu_id = cpu_id;
  25        ),
  26
  27        TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
  28                  (unsigned long)__entry->cpu_id)
  29);
  30
  31DEFINE_EVENT(cpu, cpu_idle,
  32
  33        TP_PROTO(unsigned int state, unsigned int cpu_id),
  34
  35        TP_ARGS(state, cpu_id)
  36);
  37
  38TRACE_EVENT(powernv_throttle,
  39
  40        TP_PROTO(int chip_id, const char *reason, int pmax),
  41
  42        TP_ARGS(chip_id, reason, pmax),
  43
  44        TP_STRUCT__entry(
  45                __field(int, chip_id)
  46                __string(reason, reason)
  47                __field(int, pmax)
  48        ),
  49
  50        TP_fast_assign(
  51                __entry->chip_id = chip_id;
  52                __assign_str(reason, reason);
  53                __entry->pmax = pmax;
  54        ),
  55
  56        TP_printk("Chip %d Pmax %d %s", __entry->chip_id,
  57                  __entry->pmax, __get_str(reason))
  58);
  59
  60TRACE_EVENT(pstate_sample,
  61
  62        TP_PROTO(u32 core_busy,
  63                u32 scaled_busy,
  64                u32 from,
  65                u32 to,
  66                u64 mperf,
  67                u64 aperf,
  68                u64 tsc,
  69                u32 freq
  70                ),
  71
  72        TP_ARGS(core_busy,
  73                scaled_busy,
  74                from,
  75                to,
  76                mperf,
  77                aperf,
  78                tsc,
  79                freq
  80                ),
  81
  82        TP_STRUCT__entry(
  83                __field(u32, core_busy)
  84                __field(u32, scaled_busy)
  85                __field(u32, from)
  86                __field(u32, to)
  87                __field(u64, mperf)
  88                __field(u64, aperf)
  89                __field(u64, tsc)
  90                __field(u32, freq)
  91                ),
  92
  93        TP_fast_assign(
  94                __entry->core_busy = core_busy;
  95                __entry->scaled_busy = scaled_busy;
  96                __entry->from = from;
  97                __entry->to = to;
  98                __entry->mperf = mperf;
  99                __entry->aperf = aperf;
 100                __entry->tsc = tsc;
 101                __entry->freq = freq;
 102                ),
 103
 104        TP_printk("core_busy=%lu scaled=%lu from=%lu to=%lu mperf=%llu aperf=%llu tsc=%llu freq=%lu ",
 105                (unsigned long)__entry->core_busy,
 106                (unsigned long)__entry->scaled_busy,
 107                (unsigned long)__entry->from,
 108                (unsigned long)__entry->to,
 109                (unsigned long long)__entry->mperf,
 110                (unsigned long long)__entry->aperf,
 111                (unsigned long long)__entry->tsc,
 112                (unsigned long)__entry->freq
 113                )
 114
 115);
 116
 117/* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
 118#ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
 119#define _PWR_EVENT_AVOID_DOUBLE_DEFINING
 120
 121#define PWR_EVENT_EXIT -1
 122#endif
 123
 124DEFINE_EVENT(cpu, cpu_frequency,
 125
 126        TP_PROTO(unsigned int frequency, unsigned int cpu_id),
 127
 128        TP_ARGS(frequency, cpu_id)
 129);
 130
 131TRACE_EVENT(machine_suspend,
 132
 133        TP_PROTO(unsigned int state),
 134
 135        TP_ARGS(state),
 136
 137        TP_STRUCT__entry(
 138                __field(        u32,            state           )
 139        ),
 140
 141        TP_fast_assign(
 142                __entry->state = state;
 143        ),
 144
 145        TP_printk("state=%lu", (unsigned long)__entry->state)
 146);
 147
 148DECLARE_EVENT_CLASS(wakeup_source,
 149
 150        TP_PROTO(const char *name, unsigned int state),
 151
 152        TP_ARGS(name, state),
 153
 154        TP_STRUCT__entry(
 155                __string(       name,           name            )
 156                __field(        u64,            state           )
 157        ),
 158
 159        TP_fast_assign(
 160                __assign_str(name, name);
 161                __entry->state = state;
 162        ),
 163
 164        TP_printk("%s state=0x%lx", __get_str(name),
 165                (unsigned long)__entry->state)
 166);
 167
 168DEFINE_EVENT(wakeup_source, wakeup_source_activate,
 169
 170        TP_PROTO(const char *name, unsigned int state),
 171
 172        TP_ARGS(name, state)
 173);
 174
 175DEFINE_EVENT(wakeup_source, wakeup_source_deactivate,
 176
 177        TP_PROTO(const char *name, unsigned int state),
 178
 179        TP_ARGS(name, state)
 180);
 181
 182/*
 183 * The clock events are used for clock enable/disable and for
 184 *  clock rate change
 185 */
 186DECLARE_EVENT_CLASS(clock,
 187
 188        TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
 189
 190        TP_ARGS(name, state, cpu_id),
 191
 192        TP_STRUCT__entry(
 193                __string(       name,           name            )
 194                __field(        u64,            state           )
 195                __field(        u64,            cpu_id          )
 196        ),
 197
 198        TP_fast_assign(
 199                __assign_str(name, name);
 200                __entry->state = state;
 201                __entry->cpu_id = cpu_id;
 202        ),
 203
 204        TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
 205                (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
 206);
 207
 208DEFINE_EVENT(clock, clock_enable,
 209
 210        TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
 211
 212        TP_ARGS(name, state, cpu_id)
 213);
 214
 215DEFINE_EVENT(clock, clock_disable,
 216
 217        TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
 218
 219        TP_ARGS(name, state, cpu_id)
 220);
 221
 222DEFINE_EVENT(clock, clock_set_rate,
 223
 224        TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
 225
 226        TP_ARGS(name, state, cpu_id)
 227);
 228
 229/*
 230 * The power domain events are used for power domains transitions
 231 */
 232DECLARE_EVENT_CLASS(power_domain,
 233
 234        TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
 235
 236        TP_ARGS(name, state, cpu_id),
 237
 238        TP_STRUCT__entry(
 239                __string(       name,           name            )
 240                __field(        u64,            state           )
 241                __field(        u64,            cpu_id          )
 242        ),
 243
 244        TP_fast_assign(
 245                __assign_str(name, name);
 246                __entry->state = state;
 247                __entry->cpu_id = cpu_id;
 248),
 249
 250        TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
 251                (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
 252);
 253
 254DEFINE_EVENT(power_domain, power_domain_target,
 255
 256        TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
 257
 258        TP_ARGS(name, state, cpu_id)
 259);
 260
 261/*
 262 * The pm qos events are used for pm qos update
 263 */
 264DECLARE_EVENT_CLASS(pm_qos_request,
 265
 266        TP_PROTO(int pm_qos_class, s32 value),
 267
 268        TP_ARGS(pm_qos_class, value),
 269
 270        TP_STRUCT__entry(
 271                __field( int,                    pm_qos_class   )
 272                __field( s32,                    value          )
 273        ),
 274
 275        TP_fast_assign(
 276                __entry->pm_qos_class = pm_qos_class;
 277                __entry->value = value;
 278        ),
 279
 280        TP_printk("pm_qos_class=%s value=%d",
 281                  __print_symbolic(__entry->pm_qos_class,
 282                        { PM_QOS_CPU_DMA_LATENCY,       "CPU_DMA_LATENCY" },
 283                        { PM_QOS_NETWORK_LATENCY,       "NETWORK_LATENCY" },
 284                        { PM_QOS_NETWORK_THROUGHPUT,    "NETWORK_THROUGHPUT" }),
 285                  __entry->value)
 286);
 287
 288DEFINE_EVENT(pm_qos_request, pm_qos_add_request,
 289
 290        TP_PROTO(int pm_qos_class, s32 value),
 291
 292        TP_ARGS(pm_qos_class, value)
 293);
 294
 295DEFINE_EVENT(pm_qos_request, pm_qos_update_request,
 296
 297        TP_PROTO(int pm_qos_class, s32 value),
 298
 299        TP_ARGS(pm_qos_class, value)
 300);
 301
 302DEFINE_EVENT(pm_qos_request, pm_qos_remove_request,
 303
 304        TP_PROTO(int pm_qos_class, s32 value),
 305
 306        TP_ARGS(pm_qos_class, value)
 307);
 308
 309TRACE_EVENT(pm_qos_update_request_timeout,
 310
 311        TP_PROTO(int pm_qos_class, s32 value, unsigned long timeout_us),
 312
 313        TP_ARGS(pm_qos_class, value, timeout_us),
 314
 315        TP_STRUCT__entry(
 316                __field( int,                    pm_qos_class   )
 317                __field( s32,                    value          )
 318                __field( unsigned long,          timeout_us     )
 319        ),
 320
 321        TP_fast_assign(
 322                __entry->pm_qos_class = pm_qos_class;
 323                __entry->value = value;
 324                __entry->timeout_us = timeout_us;
 325        ),
 326
 327        TP_printk("pm_qos_class=%s value=%d, timeout_us=%ld",
 328                  __print_symbolic(__entry->pm_qos_class,
 329                        { PM_QOS_CPU_DMA_LATENCY,       "CPU_DMA_LATENCY" },
 330                        { PM_QOS_NETWORK_LATENCY,       "NETWORK_LATENCY" },
 331                        { PM_QOS_NETWORK_THROUGHPUT,    "NETWORK_THROUGHPUT" }),
 332                  __entry->value, __entry->timeout_us)
 333);
 334
 335DECLARE_EVENT_CLASS(pm_qos_update,
 336
 337        TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
 338
 339        TP_ARGS(action, prev_value, curr_value),
 340
 341        TP_STRUCT__entry(
 342                __field( enum pm_qos_req_action, action         )
 343                __field( int,                    prev_value     )
 344                __field( int,                    curr_value     )
 345        ),
 346
 347        TP_fast_assign(
 348                __entry->action = action;
 349                __entry->prev_value = prev_value;
 350                __entry->curr_value = curr_value;
 351        ),
 352
 353        TP_printk("action=%s prev_value=%d curr_value=%d",
 354                  __print_symbolic(__entry->action,
 355                        { PM_QOS_ADD_REQ,       "ADD_REQ" },
 356                        { PM_QOS_UPDATE_REQ,    "UPDATE_REQ" },
 357                        { PM_QOS_REMOVE_REQ,    "REMOVE_REQ" }),
 358                  __entry->prev_value, __entry->curr_value)
 359);
 360
 361DEFINE_EVENT(pm_qos_update, pm_qos_update_target,
 362
 363        TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
 364
 365        TP_ARGS(action, prev_value, curr_value)
 366);
 367
 368DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
 369
 370        TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
 371
 372        TP_ARGS(action, prev_value, curr_value),
 373
 374        TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
 375                  __print_symbolic(__entry->action,
 376                        { PM_QOS_ADD_REQ,       "ADD_REQ" },
 377                        { PM_QOS_UPDATE_REQ,    "UPDATE_REQ" },
 378                        { PM_QOS_REMOVE_REQ,    "REMOVE_REQ" }),
 379                  __entry->prev_value, __entry->curr_value)
 380);
 381
 382DECLARE_EVENT_CLASS(dev_pm_qos_request,
 383
 384        TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
 385                 s32 new_value),
 386
 387        TP_ARGS(name, type, new_value),
 388
 389        TP_STRUCT__entry(
 390                __string( name,                    name         )
 391                __field( enum dev_pm_qos_req_type, type         )
 392                __field( s32,                      new_value    )
 393        ),
 394
 395        TP_fast_assign(
 396                __assign_str(name, name);
 397                __entry->type = type;
 398                __entry->new_value = new_value;
 399        ),
 400
 401        TP_printk("device=%s type=%s new_value=%d",
 402                  __get_str(name),
 403                  __print_symbolic(__entry->type,
 404                        { DEV_PM_QOS_LATENCY,   "DEV_PM_QOS_LATENCY" },
 405                        { DEV_PM_QOS_FLAGS,     "DEV_PM_QOS_FLAGS" }),
 406                  __entry->new_value)
 407);
 408
 409DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_add_request,
 410
 411        TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
 412                 s32 new_value),
 413
 414        TP_ARGS(name, type, new_value)
 415);
 416
 417DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_update_request,
 418
 419        TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
 420                 s32 new_value),
 421
 422        TP_ARGS(name, type, new_value)
 423);
 424
 425DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request,
 426
 427        TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
 428                 s32 new_value),
 429
 430        TP_ARGS(name, type, new_value)
 431);
 432#endif /* _TRACE_POWER_H */
 433
 434/* This part must be outside protection */
 435#include <trace/define_trace.h>
 436