modem_cldma_events.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*
  2. * If TRACE_SYSTEM is defined, that will be the directory created
  3. * in the ftrace directory under /sys/kernel/debug/tracing/events/<system>
  4. *
  5. * The define_trace.h below will also look for a file name of
  6. * TRACE_SYSTEM.h where TRACE_SYSTEM is what is defined here.
  7. * In this case, it would look for sample.h
  8. *
  9. * If the header name will be different than the system name
  10. * (as in this case), then you can override the header name that
  11. * define_trace.h will look up by defining TRACE_INCLUDE_FILE
  12. *
  13. * This file is called trace-events-sample.h but we want the system
  14. * to be called "sample". Therefore we must define the name of this
  15. * file:
  16. *
  17. * #define TRACE_INCLUDE_FILE trace-events-sample
  18. *
  19. * As we do an the bottom of this file.
  20. *
  21. * Notice that TRACE_SYSTEM should be defined outside of #if
  22. * protection, just like TRACE_INCLUDE_FILE.
  23. */
  24. #undef TRACE_SYSTEM
  25. #define TRACE_SYSTEM ccci
  26. /*
  27. * Notice that this file is not protected like a normal header.
  28. * We also must allow for rereading of this file. The
  29. *
  30. * || defined(TRACE_HEADER_MULTI_READ)
  31. *
  32. * serves this purpose.
  33. */
  34. #if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ)
  35. #define _TRACE_EVENT_SAMPLE_H
  36. /*
  37. * All trace headers should include tracepoint.h, until we finally
  38. * make it into a standard header.
  39. */
  40. #include <linux/tracepoint.h>
  41. /*
  42. * The TRACE_EVENT macro is broken up into 5 parts.
  43. *
  44. * name: name of the trace point. This is also how to enable the tracepoint.
  45. * A function called trace_foo_bar() will be created.
  46. *
  47. * proto: the prototype of the function trace_foo_bar()
  48. * Here it is trace_foo_bar(char *foo, int bar).
  49. *
  50. * args: must match the arguments in the prototype.
  51. * Here it is simply "foo, bar".
  52. *
  53. * struct: This defines the way the data will be stored in the ring buffer.
  54. * There are currently two types of elements. __field and __array.
  55. * a __field is broken up into (type, name). Where type can be any
  56. * type but an array.
  57. * For an array. there are three fields. (type, name, size). The
  58. * type of elements in the array, the name of the field and the size
  59. * of the array.
  60. *
  61. * __array( char, foo, 10) is the same as saying char foo[10].
  62. *
  63. * fast_assign: This is a C like function that is used to store the items
  64. * into the ring buffer.
  65. *
  66. * printk: This is a way to print out the data in pretty print. This is
  67. * useful if the system crashes and you are logging via a serial line,
  68. * the data can be printed to the console using this "printk" method.
  69. *
  70. * Note, that for both the assign and the printk, __entry is the handler
  71. * to the data structure in the ring buffer, and is defined by the
  72. * TP_STRUCT__entry.
  73. */
  74. TRACE_EVENT(cldma_irq,
  75. TP_PROTO(unsigned int irq_type, unsigned int queue_mask),
  76. TP_ARGS(irq_type, queue_mask), TP_STRUCT__entry(__field(unsigned int, irq_type)
  77. __field(unsigned int, queue_mask)
  78. ), TP_fast_assign(__entry->irq_type = irq_type; __entry->queue_mask = queue_mask;
  79. ), TP_printk("%s 0x%u", ((__entry->irq_type == 0) ? "TX" : "RX"), __entry->queue_mask)
  80. );
  81. TRACE_EVENT(cldma_rx,
  82. TP_PROTO(int queue_no, int ccci_ch, unsigned long long req_alloc_time, unsigned long long port_recv_time,
  83. unsigned long long skb_alloc_time, unsigned long long rx_cost_time, unsigned long long rx_bytes),
  84. TP_ARGS(queue_no, ccci_ch, req_alloc_time, port_recv_time, skb_alloc_time, rx_cost_time, rx_bytes),
  85. TP_STRUCT__entry(__field(int, queue_no)
  86. __field(int, ccci_ch)
  87. __field(unsigned long long, req_alloc_time)
  88. __field(unsigned long long, port_recv_time)
  89. __field(unsigned long long, skb_alloc_time)
  90. __field(unsigned long long, rx_cost_time)
  91. __field(unsigned long long, rx_bytes)
  92. ),
  93. TP_fast_assign(__entry->queue_no = queue_no;
  94. __entry->ccci_ch = ccci_ch;
  95. __entry->req_alloc_time = req_alloc_time;
  96. __entry->port_recv_time = port_recv_time;
  97. __entry->skb_alloc_time = skb_alloc_time;
  98. __entry->rx_cost_time = rx_cost_time; __entry->rx_bytes = rx_bytes;
  99. ),
  100. TP_printk("q%d ch%d %llu %llu %llu %llu %llu", __entry->queue_no, __entry->ccci_ch,
  101. __entry->req_alloc_time, __entry->port_recv_time, __entry->skb_alloc_time,
  102. __entry->rx_cost_time, __entry->rx_bytes)
  103. );
  104. TRACE_EVENT(cldma_rx_done,
  105. TP_PROTO(int queue_no, unsigned long long rx_interal, unsigned long long total_time,
  106. unsigned int total_count, unsigned long long rx_bytes, unsigned long long sample_time,
  107. unsigned long long sample_rxbytes), TP_ARGS(queue_no, rx_interal, total_time, total_count,
  108. rx_bytes, sample_time, sample_rxbytes),
  109. TP_STRUCT__entry(__field(int, queue_no)
  110. __field(unsigned long long, rx_interal)
  111. __field(unsigned long long, total_time)
  112. __field(unsigned int, total_count)
  113. __field(unsigned long long, rx_bytes)
  114. __field(unsigned long long, sample_time)
  115. __field(unsigned long long, sample_rxbytes)
  116. ),
  117. TP_fast_assign(__entry->queue_no = queue_no;
  118. __entry->rx_interal = rx_interal;
  119. __entry->total_time = total_time;
  120. __entry->total_count = total_count;
  121. __entry->rx_bytes = rx_bytes;
  122. __entry->sample_time = sample_time; __entry->sample_rxbytes = sample_rxbytes;
  123. ),
  124. TP_printk("q%d %llu %llu %u %llu %llu %llu", __entry->queue_no, __entry->rx_interal,
  125. __entry->total_time, __entry->total_count, __entry->rx_bytes,
  126. __entry->sample_time, __entry->sample_rxbytes)
  127. );
  128. TRACE_EVENT(cldma_tx,
  129. TP_PROTO(int queue_no, int ccci_ch, unsigned int free_slot, unsigned long long tx_interal,
  130. unsigned long long tx_cost_time, unsigned long long tx_bytes, unsigned long long sample_time,
  131. unsigned long long sample_txbytes), TP_ARGS(queue_no, ccci_ch, free_slot, tx_interal, tx_cost_time,
  132. tx_bytes, sample_time, sample_txbytes),
  133. TP_STRUCT__entry(__field(int, queue_no)
  134. __field(int, ccci_ch)
  135. __field(unsigned int, free_slot)
  136. __field(unsigned long long, tx_interal)
  137. __field(unsigned long long, tx_cost_time)
  138. __field(unsigned long long, tx_bytes)
  139. __field(unsigned long long, sample_time)
  140. __field(unsigned long long, sample_txbytes)
  141. ),
  142. TP_fast_assign(__entry->queue_no = queue_no;
  143. __entry->ccci_ch = ccci_ch;
  144. __entry->free_slot = free_slot;
  145. __entry->tx_interal = tx_interal;
  146. __entry->tx_cost_time = tx_cost_time;
  147. __entry->tx_bytes = tx_bytes;
  148. __entry->sample_time = sample_time; __entry->sample_txbytes = sample_txbytes;
  149. ),
  150. TP_printk("q%u ch%d %u %llu %llu %llu %llu %llu", __entry->queue_no,
  151. __entry->ccci_ch, __entry->free_slot, __entry->tx_interal,
  152. __entry->tx_cost_time, __entry->tx_bytes, __entry->sample_time, __entry->sample_txbytes)
  153. );
  154. TRACE_EVENT(cldma_tx_done,
  155. TP_PROTO(int queue_no, unsigned long long tx_interal, unsigned long long total_time,
  156. unsigned int total_count), TP_ARGS(queue_no, tx_interal, total_time, total_count),
  157. TP_STRUCT__entry(__field(int, queue_no)
  158. __field(unsigned long long, tx_interal)
  159. __field(unsigned long long, total_time)
  160. __field(unsigned int, total_count)
  161. ),
  162. TP_fast_assign(__entry->queue_no = queue_no;
  163. __entry->total_time = tx_interal;
  164. __entry->total_time = total_time; __entry->total_count = total_count;
  165. ),
  166. TP_printk("q%d %llu %llu %u", __entry->queue_no, __entry->tx_interal, __entry->total_time,
  167. __entry->total_count)
  168. );
  169. TRACE_EVENT(cldma_error,
  170. TP_PROTO(int queue_no, unsigned int ccci_ch, unsigned int error_no, unsigned int line_no),
  171. TP_ARGS(queue_no, ccci_ch, error_no, line_no), TP_STRUCT__entry(__field(int, queue_no)
  172. __field(int, ccci_ch)
  173. __field(unsigned int, error_no)
  174. __field(unsigned int, line_no)
  175. ),
  176. TP_fast_assign(__entry->queue_no = queue_no;
  177. __entry->ccci_ch = ccci_ch; __entry->error_no = error_no; __entry->line_no = line_no;
  178. ),
  179. TP_printk("q%d ch=%d err=%u line_no=%u", __entry->queue_no, __entry->ccci_ch, __entry->error_no,
  180. __entry->line_no)
  181. );
  182. TRACE_EVENT(ccci_skb_rx,
  183. TP_PROTO(unsigned long long *dl_delay),
  184. TP_ARGS(dl_delay),
  185. TP_STRUCT__entry(
  186. __array(unsigned long long, dl_delay, 8)
  187. ),
  188. TP_fast_assign(
  189. memcpy(__entry->dl_delay, dl_delay, 8*sizeof(unsigned long long));
  190. ),
  191. TP_printk(" %llu %llu %llu %llu %llu %llu %llu %llu",
  192. __entry->dl_delay[0], __entry->dl_delay[1], __entry->dl_delay[2], __entry->dl_delay[3],
  193. __entry->dl_delay[4], __entry->dl_delay[5], __entry->dl_delay[6], __entry->dl_delay[7])
  194. );
  195. #endif
  196. /***** NOTICE! The #if protection ends here. *****/
  197. /*
  198. * There are several ways I could have done this. If I left out the
  199. * TRACE_INCLUDE_PATH, then it would default to the kernel source
  200. * include/trace/events directory.
  201. *
  202. * I could specify a path from the define_trace.h file back to this
  203. * file.
  204. *
  205. * #define TRACE_INCLUDE_PATH ../../samples/trace_events
  206. *
  207. * But the safest and easiest way to simply make it use the directory
  208. * that the file is in is to add in the Makefile:
  209. *
  210. * CFLAGS_trace-events-sample.o := -I$(src)
  211. *
  212. * This will make sure the current path is part of the include
  213. * structure for our file so that define_trace.h can find it.
  214. *
  215. * I could have made only the top level directory the include:
  216. *
  217. * CFLAGS_trace-events-sample.o := -I$(PWD)
  218. *
  219. * And then let the path to this directory be the TRACE_INCLUDE_PATH:
  220. *
  221. * #define TRACE_INCLUDE_PATH samples/trace_events
  222. *
  223. * But then if something defines "samples" or "trace_events" as a macro
  224. * then we could risk that being converted too, and give us an unexpected
  225. * result.
  226. */
  227. #undef TRACE_INCLUDE_PATH
  228. #undef TRACE_INCLUDE_FILE
  229. #define TRACE_INCLUDE_PATH .
  230. /*
  231. * TRACE_INCLUDE_FILE is not needed if the filename and TRACE_SYSTEM are equal
  232. */
  233. #define TRACE_INCLUDE_FILE modem_cldma_events
  234. #include <trace/define_trace.h>