power.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM power
  3. #if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_POWER_H
  5. #include <linux/ktime.h>
  6. #include <linux/pm_qos.h>
  7. #include <linux/tracepoint.h>
  8. #include <linux/trace_events.h>
  9. #define TPS(x) tracepoint_string(x)
  10. DECLARE_EVENT_CLASS(cpu,
  11. TP_PROTO(unsigned int state, unsigned int cpu_id),
  12. TP_ARGS(state, cpu_id),
  13. TP_STRUCT__entry(
  14. __field( u32, state )
  15. __field( u32, cpu_id )
  16. ),
  17. TP_fast_assign(
  18. __entry->state = state;
  19. __entry->cpu_id = cpu_id;
  20. ),
  21. TP_printk("state=%lu cpu_id=%lu", (unsigned long)__entry->state,
  22. (unsigned long)__entry->cpu_id)
  23. );
  24. DEFINE_EVENT(cpu, cpu_idle,
  25. TP_PROTO(unsigned int state, unsigned int cpu_id),
  26. TP_ARGS(state, cpu_id)
  27. );
  28. TRACE_EVENT(powernv_throttle,
  29. TP_PROTO(int chip_id, const char *reason, int pmax),
  30. TP_ARGS(chip_id, reason, pmax),
  31. TP_STRUCT__entry(
  32. __field(int, chip_id)
  33. __string(reason, reason)
  34. __field(int, pmax)
  35. ),
  36. TP_fast_assign(
  37. __entry->chip_id = chip_id;
  38. __assign_str(reason, reason);
  39. __entry->pmax = pmax;
  40. ),
  41. TP_printk("Chip %d Pmax %d %s", __entry->chip_id,
  42. __entry->pmax, __get_str(reason))
  43. );
  44. TRACE_EVENT(pstate_sample,
  45. TP_PROTO(u32 core_busy,
  46. u32 scaled_busy,
  47. u32 from,
  48. u32 to,
  49. u64 mperf,
  50. u64 aperf,
  51. u64 tsc,
  52. u32 freq,
  53. u32 io_boost
  54. ),
  55. TP_ARGS(core_busy,
  56. scaled_busy,
  57. from,
  58. to,
  59. mperf,
  60. aperf,
  61. tsc,
  62. freq,
  63. io_boost
  64. ),
  65. TP_STRUCT__entry(
  66. __field(u32, core_busy)
  67. __field(u32, scaled_busy)
  68. __field(u32, from)
  69. __field(u32, to)
  70. __field(u64, mperf)
  71. __field(u64, aperf)
  72. __field(u64, tsc)
  73. __field(u32, freq)
  74. __field(u32, io_boost)
  75. ),
  76. TP_fast_assign(
  77. __entry->core_busy = core_busy;
  78. __entry->scaled_busy = scaled_busy;
  79. __entry->from = from;
  80. __entry->to = to;
  81. __entry->mperf = mperf;
  82. __entry->aperf = aperf;
  83. __entry->tsc = tsc;
  84. __entry->freq = freq;
  85. __entry->io_boost = io_boost;
  86. ),
  87. TP_printk("core_busy=%lu scaled=%lu from=%lu to=%lu mperf=%llu aperf=%llu tsc=%llu freq=%lu io_boost=%lu",
  88. (unsigned long)__entry->core_busy,
  89. (unsigned long)__entry->scaled_busy,
  90. (unsigned long)__entry->from,
  91. (unsigned long)__entry->to,
  92. (unsigned long long)__entry->mperf,
  93. (unsigned long long)__entry->aperf,
  94. (unsigned long long)__entry->tsc,
  95. (unsigned long)__entry->freq,
  96. (unsigned long)__entry->io_boost
  97. )
  98. );
  99. /* This file can get included multiple times, TRACE_HEADER_MULTI_READ at top */
  100. #ifndef _PWR_EVENT_AVOID_DOUBLE_DEFINING
  101. #define _PWR_EVENT_AVOID_DOUBLE_DEFINING
  102. #define PWR_EVENT_EXIT -1
  103. #endif
  104. #define pm_verb_symbolic(event) \
  105. __print_symbolic(event, \
  106. { PM_EVENT_SUSPEND, "suspend" }, \
  107. { PM_EVENT_RESUME, "resume" }, \
  108. { PM_EVENT_FREEZE, "freeze" }, \
  109. { PM_EVENT_QUIESCE, "quiesce" }, \
  110. { PM_EVENT_HIBERNATE, "hibernate" }, \
  111. { PM_EVENT_THAW, "thaw" }, \
  112. { PM_EVENT_RESTORE, "restore" }, \
  113. { PM_EVENT_RECOVER, "recover" })
  114. DEFINE_EVENT(cpu, cpu_frequency,
  115. TP_PROTO(unsigned int frequency, unsigned int cpu_id),
  116. TP_ARGS(frequency, cpu_id)
  117. );
  118. TRACE_EVENT(cpu_frequency_limits,
  119. TP_PROTO(unsigned int max_freq, unsigned int min_freq,
  120. unsigned int cpu_id),
  121. TP_ARGS(max_freq, min_freq, cpu_id),
  122. TP_STRUCT__entry(
  123. __field( u32, min_freq )
  124. __field( u32, max_freq )
  125. __field( u32, cpu_id )
  126. ),
  127. TP_fast_assign(
  128. __entry->min_freq = min_freq;
  129. __entry->max_freq = max_freq;
  130. __entry->cpu_id = cpu_id;
  131. ),
  132. TP_printk("min=%lu max=%lu cpu_id=%lu",
  133. (unsigned long)__entry->min_freq,
  134. (unsigned long)__entry->max_freq,
  135. (unsigned long)__entry->cpu_id)
  136. );
  137. DEFINE_EVENT(cpu, cpu_capacity,
  138. TP_PROTO(unsigned int capacity, unsigned int cpu_id),
  139. TP_ARGS(capacity, cpu_id)
  140. );
  141. TRACE_EVENT(cpu_frequency_switch_start,
  142. TP_PROTO(unsigned int start_freq, unsigned int end_freq,
  143. unsigned int cpu_id),
  144. TP_ARGS(start_freq, end_freq, cpu_id),
  145. TP_STRUCT__entry(
  146. __field( u32, start_freq )
  147. __field( u32, end_freq )
  148. __field( u32, cpu_id )
  149. ),
  150. TP_fast_assign(
  151. __entry->start_freq = start_freq;
  152. __entry->end_freq = end_freq;
  153. __entry->cpu_id = cpu_id;
  154. ),
  155. TP_printk("start=%lu end=%lu cpu_id=%lu",
  156. (unsigned long)__entry->start_freq,
  157. (unsigned long)__entry->end_freq,
  158. (unsigned long)__entry->cpu_id)
  159. );
  160. TRACE_EVENT(cpu_frequency_switch_end,
  161. TP_PROTO(unsigned int cpu_id),
  162. TP_ARGS(cpu_id),
  163. TP_STRUCT__entry(
  164. __field( u32, cpu_id )
  165. ),
  166. TP_fast_assign(
  167. __entry->cpu_id = cpu_id;
  168. ),
  169. TP_printk("cpu_id=%lu", (unsigned long)__entry->cpu_id)
  170. );
  171. TRACE_EVENT(device_pm_callback_start,
  172. TP_PROTO(struct device *dev, const char *pm_ops, int event),
  173. TP_ARGS(dev, pm_ops, event),
  174. TP_STRUCT__entry(
  175. __string(device, dev_name(dev))
  176. __string(driver, dev_driver_string(dev))
  177. __string(parent, dev->parent ? dev_name(dev->parent) : "none")
  178. __string(pm_ops, pm_ops ? pm_ops : "none ")
  179. __field(int, event)
  180. ),
  181. TP_fast_assign(
  182. __assign_str(device, dev_name(dev));
  183. __assign_str(driver, dev_driver_string(dev));
  184. __assign_str(parent,
  185. dev->parent ? dev_name(dev->parent) : "none");
  186. __assign_str(pm_ops, pm_ops ? pm_ops : "none ");
  187. __entry->event = event;
  188. ),
  189. TP_printk("%s %s, parent: %s, %s[%s]", __get_str(driver),
  190. __get_str(device), __get_str(parent), __get_str(pm_ops),
  191. pm_verb_symbolic(__entry->event))
  192. );
  193. TRACE_EVENT(device_pm_callback_end,
  194. TP_PROTO(struct device *dev, int error),
  195. TP_ARGS(dev, error),
  196. TP_STRUCT__entry(
  197. __string(device, dev_name(dev))
  198. __string(driver, dev_driver_string(dev))
  199. __field(int, error)
  200. ),
  201. TP_fast_assign(
  202. __assign_str(device, dev_name(dev));
  203. __assign_str(driver, dev_driver_string(dev));
  204. __entry->error = error;
  205. ),
  206. TP_printk("%s %s, err=%d",
  207. __get_str(driver), __get_str(device), __entry->error)
  208. );
  209. TRACE_EVENT(suspend_resume,
  210. TP_PROTO(const char *action, int val, bool start),
  211. TP_ARGS(action, val, start),
  212. TP_STRUCT__entry(
  213. __field(const char *, action)
  214. __field(int, val)
  215. __field(bool, start)
  216. ),
  217. TP_fast_assign(
  218. __entry->action = action;
  219. __entry->val = val;
  220. __entry->start = start;
  221. ),
  222. TP_printk("%s[%u] %s", __entry->action, (unsigned int)__entry->val,
  223. (__entry->start)?"begin":"end")
  224. );
  225. DECLARE_EVENT_CLASS(wakeup_source,
  226. TP_PROTO(const char *name, unsigned int state),
  227. TP_ARGS(name, state),
  228. TP_STRUCT__entry(
  229. __string( name, name )
  230. __field( u64, state )
  231. ),
  232. TP_fast_assign(
  233. __assign_str(name, name);
  234. __entry->state = state;
  235. ),
  236. TP_printk("%s state=0x%lx", __get_str(name),
  237. (unsigned long)__entry->state)
  238. );
  239. DEFINE_EVENT(wakeup_source, wakeup_source_activate,
  240. TP_PROTO(const char *name, unsigned int state),
  241. TP_ARGS(name, state)
  242. );
  243. DEFINE_EVENT(wakeup_source, wakeup_source_deactivate,
  244. TP_PROTO(const char *name, unsigned int state),
  245. TP_ARGS(name, state)
  246. );
  247. /*
  248. * The clock events are used for clock enable/disable and for
  249. * clock rate change
  250. */
  251. DECLARE_EVENT_CLASS(clock,
  252. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  253. TP_ARGS(name, state, cpu_id),
  254. TP_STRUCT__entry(
  255. __string( name, name )
  256. __field( u64, state )
  257. __field( u64, cpu_id )
  258. ),
  259. TP_fast_assign(
  260. __assign_str(name, name);
  261. __entry->state = state;
  262. __entry->cpu_id = cpu_id;
  263. ),
  264. TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
  265. (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
  266. );
  267. DEFINE_EVENT(clock, clock_enable,
  268. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  269. TP_ARGS(name, state, cpu_id)
  270. );
  271. DEFINE_EVENT(clock, clock_disable,
  272. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  273. TP_ARGS(name, state, cpu_id)
  274. );
  275. DEFINE_EVENT(clock, clock_set_rate,
  276. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  277. TP_ARGS(name, state, cpu_id)
  278. );
  279. DEFINE_EVENT(clock, clock_set_rate_complete,
  280. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  281. TP_ARGS(name, state, cpu_id)
  282. );
  283. TRACE_EVENT(clock_set_parent,
  284. TP_PROTO(const char *name, const char *parent_name),
  285. TP_ARGS(name, parent_name),
  286. TP_STRUCT__entry(
  287. __string( name, name )
  288. __string( parent_name, parent_name )
  289. ),
  290. TP_fast_assign(
  291. __assign_str(name, name);
  292. __assign_str(parent_name, parent_name);
  293. ),
  294. TP_printk("%s parent=%s", __get_str(name), __get_str(parent_name))
  295. );
  296. TRACE_EVENT(clock_state,
  297. TP_PROTO(const char *name, unsigned long prepare_count,
  298. unsigned long count, unsigned long rate),
  299. TP_ARGS(name, prepare_count, count, rate),
  300. TP_STRUCT__entry(
  301. __string(name, name)
  302. __field(unsigned long, prepare_count)
  303. __field(unsigned long, count)
  304. __field(unsigned long, rate)
  305. ),
  306. TP_fast_assign(
  307. __assign_str(name, name);
  308. __entry->prepare_count = prepare_count;
  309. __entry->count = count;
  310. __entry->rate = rate;
  311. ),
  312. TP_printk("%s\t[%lu:%lu]\t%lu", __get_str(name), __entry->prepare_count,
  313. __entry->count, __entry->rate)
  314. );
  315. /*
  316. * The power domain events are used for power domains transitions
  317. */
  318. DECLARE_EVENT_CLASS(power_domain,
  319. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  320. TP_ARGS(name, state, cpu_id),
  321. TP_STRUCT__entry(
  322. __string( name, name )
  323. __field( u64, state )
  324. __field( u64, cpu_id )
  325. ),
  326. TP_fast_assign(
  327. __assign_str(name, name);
  328. __entry->state = state;
  329. __entry->cpu_id = cpu_id;
  330. ),
  331. TP_printk("%s state=%lu cpu_id=%lu", __get_str(name),
  332. (unsigned long)__entry->state, (unsigned long)__entry->cpu_id)
  333. );
  334. DEFINE_EVENT(power_domain, power_domain_target,
  335. TP_PROTO(const char *name, unsigned int state, unsigned int cpu_id),
  336. TP_ARGS(name, state, cpu_id)
  337. );
  338. /*
  339. * The pm qos events are used for pm qos update
  340. */
  341. DECLARE_EVENT_CLASS(pm_qos_request,
  342. TP_PROTO(int pm_qos_class, s32 value),
  343. TP_ARGS(pm_qos_class, value),
  344. TP_STRUCT__entry(
  345. __field( int, pm_qos_class )
  346. __field( s32, value )
  347. ),
  348. TP_fast_assign(
  349. __entry->pm_qos_class = pm_qos_class;
  350. __entry->value = value;
  351. ),
  352. TP_printk("pm_qos_class=%s value=%d",
  353. __print_symbolic(__entry->pm_qos_class,
  354. { PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
  355. { PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
  356. { PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
  357. __entry->value)
  358. );
  359. DEFINE_EVENT(pm_qos_request, pm_qos_add_request,
  360. TP_PROTO(int pm_qos_class, s32 value),
  361. TP_ARGS(pm_qos_class, value)
  362. );
  363. DEFINE_EVENT(pm_qos_request, pm_qos_update_request,
  364. TP_PROTO(int pm_qos_class, s32 value),
  365. TP_ARGS(pm_qos_class, value)
  366. );
  367. DEFINE_EVENT(pm_qos_request, pm_qos_remove_request,
  368. TP_PROTO(int pm_qos_class, s32 value),
  369. TP_ARGS(pm_qos_class, value)
  370. );
  371. TRACE_EVENT(pm_qos_update_request_timeout,
  372. TP_PROTO(int pm_qos_class, s32 value, unsigned long timeout_us),
  373. TP_ARGS(pm_qos_class, value, timeout_us),
  374. TP_STRUCT__entry(
  375. __field( int, pm_qos_class )
  376. __field( s32, value )
  377. __field( unsigned long, timeout_us )
  378. ),
  379. TP_fast_assign(
  380. __entry->pm_qos_class = pm_qos_class;
  381. __entry->value = value;
  382. __entry->timeout_us = timeout_us;
  383. ),
  384. TP_printk("pm_qos_class=%s value=%d, timeout_us=%ld",
  385. __print_symbolic(__entry->pm_qos_class,
  386. { PM_QOS_CPU_DMA_LATENCY, "CPU_DMA_LATENCY" },
  387. { PM_QOS_NETWORK_LATENCY, "NETWORK_LATENCY" },
  388. { PM_QOS_NETWORK_THROUGHPUT, "NETWORK_THROUGHPUT" }),
  389. __entry->value, __entry->timeout_us)
  390. );
  391. DECLARE_EVENT_CLASS(pm_qos_update,
  392. TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
  393. TP_ARGS(action, prev_value, curr_value),
  394. TP_STRUCT__entry(
  395. __field( enum pm_qos_req_action, action )
  396. __field( int, prev_value )
  397. __field( int, curr_value )
  398. ),
  399. TP_fast_assign(
  400. __entry->action = action;
  401. __entry->prev_value = prev_value;
  402. __entry->curr_value = curr_value;
  403. ),
  404. TP_printk("action=%s prev_value=%d curr_value=%d",
  405. __print_symbolic(__entry->action,
  406. { PM_QOS_ADD_REQ, "ADD_REQ" },
  407. { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
  408. { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
  409. __entry->prev_value, __entry->curr_value)
  410. );
  411. DEFINE_EVENT(pm_qos_update, pm_qos_update_target,
  412. TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
  413. TP_ARGS(action, prev_value, curr_value)
  414. );
  415. DEFINE_EVENT_PRINT(pm_qos_update, pm_qos_update_flags,
  416. TP_PROTO(enum pm_qos_req_action action, int prev_value, int curr_value),
  417. TP_ARGS(action, prev_value, curr_value),
  418. TP_printk("action=%s prev_value=0x%x curr_value=0x%x",
  419. __print_symbolic(__entry->action,
  420. { PM_QOS_ADD_REQ, "ADD_REQ" },
  421. { PM_QOS_UPDATE_REQ, "UPDATE_REQ" },
  422. { PM_QOS_REMOVE_REQ, "REMOVE_REQ" }),
  423. __entry->prev_value, __entry->curr_value)
  424. );
  425. DECLARE_EVENT_CLASS(dev_pm_qos_request,
  426. TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
  427. s32 new_value),
  428. TP_ARGS(name, type, new_value),
  429. TP_STRUCT__entry(
  430. __string( name, name )
  431. __field( enum dev_pm_qos_req_type, type )
  432. __field( s32, new_value )
  433. ),
  434. TP_fast_assign(
  435. __assign_str(name, name);
  436. __entry->type = type;
  437. __entry->new_value = new_value;
  438. ),
  439. TP_printk("device=%s type=%s new_value=%d",
  440. __get_str(name),
  441. __print_symbolic(__entry->type,
  442. { DEV_PM_QOS_RESUME_LATENCY, "DEV_PM_QOS_RESUME_LATENCY" },
  443. { DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS" }),
  444. __entry->new_value)
  445. );
  446. DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_add_request,
  447. TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
  448. s32 new_value),
  449. TP_ARGS(name, type, new_value)
  450. );
  451. DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_update_request,
  452. TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
  453. s32 new_value),
  454. TP_ARGS(name, type, new_value)
  455. );
  456. DEFINE_EVENT(dev_pm_qos_request, dev_pm_qos_remove_request,
  457. TP_PROTO(const char *name, enum dev_pm_qos_req_type type,
  458. s32 new_value),
  459. TP_ARGS(name, type, new_value)
  460. );
  461. TRACE_EVENT(bw_hwmon_meas,
  462. TP_PROTO(const char *name, unsigned long mbps,
  463. unsigned long us, int wake),
  464. TP_ARGS(name, mbps, us, wake),
  465. TP_STRUCT__entry(
  466. __string( name, name )
  467. __field( unsigned long, mbps )
  468. __field( unsigned long, us )
  469. __field( int, wake )
  470. ),
  471. TP_fast_assign(
  472. __assign_str(name, name);
  473. __entry->mbps = mbps;
  474. __entry->us = us;
  475. __entry->wake = wake;
  476. ),
  477. TP_printk("dev: %s, mbps = %lu, us = %lu, wake = %d",
  478. __get_str(name),
  479. __entry->mbps,
  480. __entry->us,
  481. __entry->wake)
  482. );
  483. TRACE_EVENT(bw_hwmon_update,
  484. TP_PROTO(const char *name, unsigned long mbps, unsigned long freq,
  485. unsigned long up_thres, unsigned long down_thres),
  486. TP_ARGS(name, mbps, freq, up_thres, down_thres),
  487. TP_STRUCT__entry(
  488. __string( name, name )
  489. __field( unsigned long, mbps )
  490. __field( unsigned long, freq )
  491. __field( unsigned long, up_thres )
  492. __field( unsigned long, down_thres )
  493. ),
  494. TP_fast_assign(
  495. __assign_str(name, name);
  496. __entry->mbps = mbps;
  497. __entry->freq = freq;
  498. __entry->up_thres = up_thres;
  499. __entry->down_thres = down_thres;
  500. ),
  501. TP_printk("dev: %s, mbps = %lu, freq = %lu, up = %lu, down = %lu",
  502. __get_str(name),
  503. __entry->mbps,
  504. __entry->freq,
  505. __entry->up_thres,
  506. __entry->down_thres)
  507. );
  508. TRACE_EVENT(cache_hwmon_meas,
  509. TP_PROTO(const char *name, unsigned long high_mrps,
  510. unsigned long med_mrps, unsigned long low_mrps,
  511. unsigned int busy_percent, unsigned int us),
  512. TP_ARGS(name, high_mrps, med_mrps, low_mrps, busy_percent, us),
  513. TP_STRUCT__entry(
  514. __string(name, name)
  515. __field(unsigned long, high_mrps)
  516. __field(unsigned long, med_mrps)
  517. __field(unsigned long, low_mrps)
  518. __field(unsigned long, total_mrps)
  519. __field(unsigned int, busy_percent)
  520. __field(unsigned int, us)
  521. ),
  522. TP_fast_assign(
  523. __assign_str(name, name);
  524. __entry->high_mrps = high_mrps;
  525. __entry->med_mrps = med_mrps;
  526. __entry->low_mrps = low_mrps;
  527. __entry->total_mrps = high_mrps + med_mrps + low_mrps;
  528. __entry->busy_percent = busy_percent;
  529. __entry->us = us;
  530. ),
  531. TP_printk("dev=%s H=%lu M=%lu L=%lu T=%lu busy_pct=%u period=%u",
  532. __get_str(name), __entry->high_mrps, __entry->med_mrps,
  533. __entry->low_mrps, __entry->total_mrps,
  534. __entry->busy_percent, __entry->us)
  535. );
  536. TRACE_EVENT(cache_hwmon_update,
  537. TP_PROTO(const char *name, unsigned long freq_mhz),
  538. TP_ARGS(name, freq_mhz),
  539. TP_STRUCT__entry(
  540. __string(name, name)
  541. __field(unsigned long, freq)
  542. ),
  543. TP_fast_assign(
  544. __assign_str(name, name);
  545. __entry->freq = freq_mhz;
  546. ),
  547. TP_printk("dev=%s freq=%lu", __get_str(name), __entry->freq)
  548. );
  549. TRACE_EVENT(memlat_dev_meas,
  550. TP_PROTO(const char *name, unsigned int dev_id, unsigned long inst,
  551. unsigned long mem, unsigned long freq, unsigned int stall,
  552. unsigned int ratio),
  553. TP_ARGS(name, dev_id, inst, mem, freq, stall, ratio),
  554. TP_STRUCT__entry(
  555. __string(name, name)
  556. __field(unsigned int, dev_id)
  557. __field(unsigned long, inst)
  558. __field(unsigned long, mem)
  559. __field(unsigned long, freq)
  560. __field(unsigned int, stall)
  561. __field(unsigned int, ratio)
  562. ),
  563. TP_fast_assign(
  564. __assign_str(name, name);
  565. __entry->dev_id = dev_id;
  566. __entry->inst = inst;
  567. __entry->mem = mem;
  568. __entry->freq = freq;
  569. __entry->stall = stall;
  570. __entry->ratio = ratio;
  571. ),
  572. TP_printk("dev: %s, id=%u, inst=%lu, mem=%lu, freq=%lu, stall=%u, ratio=%u",
  573. __get_str(name),
  574. __entry->dev_id,
  575. __entry->inst,
  576. __entry->mem,
  577. __entry->freq,
  578. __entry->stall,
  579. __entry->ratio)
  580. );
  581. TRACE_EVENT(memlat_dev_update,
  582. TP_PROTO(const char *name, unsigned int dev_id, unsigned long inst,
  583. unsigned long mem, unsigned long freq, unsigned long vote),
  584. TP_ARGS(name, dev_id, inst, mem, freq, vote),
  585. TP_STRUCT__entry(
  586. __string(name, name)
  587. __field(unsigned int, dev_id)
  588. __field(unsigned long, inst)
  589. __field(unsigned long, mem)
  590. __field(unsigned long, freq)
  591. __field(unsigned long, vote)
  592. ),
  593. TP_fast_assign(
  594. __assign_str(name, name);
  595. __entry->dev_id = dev_id;
  596. __entry->inst = inst;
  597. __entry->mem = mem;
  598. __entry->freq = freq;
  599. __entry->vote = vote;
  600. ),
  601. TP_printk("dev: %s, id=%u, inst=%lu, mem=%lu, freq=%lu, vote=%lu",
  602. __get_str(name),
  603. __entry->dev_id,
  604. __entry->inst,
  605. __entry->mem,
  606. __entry->freq,
  607. __entry->vote)
  608. );
  609. TRACE_EVENT(sugov_util_update,
  610. TP_PROTO(int cpu,
  611. unsigned long util, unsigned long avg_cap,
  612. unsigned long max_cap, unsigned long nl, unsigned long pl,
  613. unsigned int flags),
  614. TP_ARGS(cpu, util, avg_cap, max_cap, nl, pl, flags),
  615. TP_STRUCT__entry(
  616. __field( int, cpu)
  617. __field( unsigned long, util)
  618. __field( unsigned long, avg_cap)
  619. __field( unsigned long, max_cap)
  620. __field( unsigned long, nl)
  621. __field( unsigned long, pl)
  622. __field( unsigned int, flags)
  623. ),
  624. TP_fast_assign(
  625. __entry->cpu = cpu;
  626. __entry->util = util;
  627. __entry->avg_cap = avg_cap;
  628. __entry->max_cap = max_cap;
  629. __entry->nl = nl;
  630. __entry->pl = pl;
  631. __entry->flags = flags;
  632. ),
  633. TP_printk("cpu=%d util=%lu avg_cap=%lu max_cap=%lu nl=%lu pl=%lu flags=0x%x",
  634. __entry->cpu, __entry->util, __entry->avg_cap,
  635. __entry->max_cap, __entry->nl,
  636. __entry->pl, __entry->flags)
  637. );
  638. TRACE_EVENT(sugov_next_freq,
  639. TP_PROTO(unsigned int cpu, unsigned long util, unsigned long max,
  640. unsigned int freq),
  641. TP_ARGS(cpu, util, max, freq),
  642. TP_STRUCT__entry(
  643. __field( unsigned int, cpu)
  644. __field( unsigned long, util)
  645. __field( unsigned long, max)
  646. __field( unsigned int, freq)
  647. ),
  648. TP_fast_assign(
  649. __entry->cpu = cpu;
  650. __entry->util = util;
  651. __entry->max = max;
  652. __entry->freq = freq;
  653. ),
  654. TP_printk("cpu=%u util=%lu max=%lu freq=%u",
  655. __entry->cpu,
  656. __entry->util,
  657. __entry->max,
  658. __entry->freq)
  659. );
  660. #endif /* _TRACE_POWER_H */
  661. /* This part must be outside protection */
  662. #include <trace/define_trace.h>