afs.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /* AFS tracepoints
  2. *
  3. * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #undef TRACE_SYSTEM
  12. #define TRACE_SYSTEM afs
  13. #if !defined(_TRACE_AFS_H) || defined(TRACE_HEADER_MULTI_READ)
  14. #define _TRACE_AFS_H
  15. #include <linux/tracepoint.h>
  16. /*
  17. * Define enums for tracing information.
  18. */
  19. #ifndef __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
  20. #define __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
  21. enum afs_call_trace {
  22. afs_call_trace_alloc,
  23. afs_call_trace_free,
  24. afs_call_trace_put,
  25. afs_call_trace_wake,
  26. afs_call_trace_work,
  27. };
  28. #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
  29. /*
  30. * Declare tracing information enums and their string mappings for display.
  31. */
  32. #define afs_call_traces \
  33. EM(afs_call_trace_alloc, "ALLOC") \
  34. EM(afs_call_trace_free, "FREE ") \
  35. EM(afs_call_trace_put, "PUT ") \
  36. EM(afs_call_trace_wake, "WAKE ") \
  37. E_(afs_call_trace_work, "WORK ")
  38. /*
  39. * Export enum symbols via userspace.
  40. */
  41. #undef EM
  42. #undef E_
  43. #define EM(a, b) TRACE_DEFINE_ENUM(a);
  44. #define E_(a, b) TRACE_DEFINE_ENUM(a);
  45. afs_call_traces;
  46. /*
  47. * Now redefine the EM() and E_() macros to map the enums to the strings that
  48. * will be printed in the output.
  49. */
  50. #undef EM
  51. #undef E_
  52. #define EM(a, b) { a, b },
  53. #define E_(a, b) { a, b }
  54. TRACE_EVENT(afs_recv_data,
  55. TP_PROTO(struct afs_call *call, unsigned count, unsigned offset,
  56. bool want_more, int ret),
  57. TP_ARGS(call, count, offset, want_more, ret),
  58. TP_STRUCT__entry(
  59. __field(struct rxrpc_call *, rxcall )
  60. __field(struct afs_call *, call )
  61. __field(enum afs_call_state, state )
  62. __field(unsigned int, count )
  63. __field(unsigned int, offset )
  64. __field(unsigned short, unmarshall )
  65. __field(bool, want_more )
  66. __field(int, ret )
  67. ),
  68. TP_fast_assign(
  69. __entry->rxcall = call->rxcall;
  70. __entry->call = call;
  71. __entry->state = call->state;
  72. __entry->unmarshall = call->unmarshall;
  73. __entry->count = count;
  74. __entry->offset = offset;
  75. __entry->want_more = want_more;
  76. __entry->ret = ret;
  77. ),
  78. TP_printk("c=%p ac=%p s=%u u=%u %u/%u wm=%u ret=%d",
  79. __entry->rxcall,
  80. __entry->call,
  81. __entry->state, __entry->unmarshall,
  82. __entry->offset, __entry->count,
  83. __entry->want_more, __entry->ret)
  84. );
  85. TRACE_EVENT(afs_notify_call,
  86. TP_PROTO(struct rxrpc_call *rxcall, struct afs_call *call),
  87. TP_ARGS(rxcall, call),
  88. TP_STRUCT__entry(
  89. __field(struct rxrpc_call *, rxcall )
  90. __field(struct afs_call *, call )
  91. __field(enum afs_call_state, state )
  92. __field(unsigned short, unmarshall )
  93. ),
  94. TP_fast_assign(
  95. __entry->rxcall = rxcall;
  96. __entry->call = call;
  97. __entry->state = call->state;
  98. __entry->unmarshall = call->unmarshall;
  99. ),
  100. TP_printk("c=%p ac=%p s=%u u=%u",
  101. __entry->rxcall,
  102. __entry->call,
  103. __entry->state, __entry->unmarshall)
  104. );
  105. TRACE_EVENT(afs_cb_call,
  106. TP_PROTO(struct afs_call *call),
  107. TP_ARGS(call),
  108. TP_STRUCT__entry(
  109. __field(struct rxrpc_call *, rxcall )
  110. __field(struct afs_call *, call )
  111. __field(const char *, name )
  112. __field(u32, op )
  113. ),
  114. TP_fast_assign(
  115. __entry->rxcall = call->rxcall;
  116. __entry->call = call;
  117. __entry->name = call->type->name;
  118. __entry->op = call->operation_ID;
  119. ),
  120. TP_printk("c=%p ac=%p %s o=%u",
  121. __entry->rxcall,
  122. __entry->call,
  123. __entry->name,
  124. __entry->op)
  125. );
  126. TRACE_EVENT(afs_call,
  127. TP_PROTO(struct afs_call *call, enum afs_call_trace op,
  128. int usage, int outstanding, const void *where),
  129. TP_ARGS(call, op, usage, outstanding, where),
  130. TP_STRUCT__entry(
  131. __field(struct afs_call *, call )
  132. __field(int, op )
  133. __field(int, usage )
  134. __field(int, outstanding )
  135. __field(const void *, where )
  136. ),
  137. TP_fast_assign(
  138. __entry->call = call;
  139. __entry->op = op;
  140. __entry->usage = usage;
  141. __entry->outstanding = outstanding;
  142. __entry->where = where;
  143. ),
  144. TP_printk("c=%p %s u=%d o=%d sp=%pSR",
  145. __entry->call,
  146. __print_symbolic(__entry->op, afs_call_traces),
  147. __entry->usage,
  148. __entry->outstanding,
  149. __entry->where)
  150. );
  151. #endif /* _TRACE_AFS_H */
  152. /* This part must be outside protection */
  153. #include <trace/define_trace.h>