trace_format.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Setup the showing format of trace point.
  3. *
  4. * int
  5. * ftrace_format_##call(struct trace_seq *s)
  6. * {
  7. * struct ftrace_raw_##call field;
  8. * int ret;
  9. *
  10. * ret = trace_seq_printf(s, #type " " #item ";"
  11. * " size:%d; offset:%d;\n",
  12. * sizeof(field.type),
  13. * offsetof(struct ftrace_raw_##call,
  14. * item));
  15. *
  16. * }
  17. */
  18. #undef TRACE_STRUCT
  19. #define TRACE_STRUCT(args...) args
  20. #undef TRACE_FIELD
  21. #define TRACE_FIELD(type, item, assign) \
  22. ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
  23. "offset:%lu;\tsize:%lu;\n", \
  24. offsetof(typeof(field), item), \
  25. sizeof(field.item)); \
  26. if (!ret) \
  27. return 0;
  28. #undef TRACE_FIELD_SPECIAL
  29. #define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
  30. ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \
  31. "offset:%lu;\tsize:%lu;\n", \
  32. offsetof(typeof(field), item), \
  33. sizeof(field.item)); \
  34. if (!ret) \
  35. return 0;
  36. #undef TRACE_EVENT_FORMAT
  37. #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
  38. static int \
  39. ftrace_format_##call(struct trace_seq *s) \
  40. { \
  41. struct ftrace_raw_##call field; \
  42. int ret; \
  43. \
  44. tstruct; \
  45. \
  46. trace_seq_printf(s, "\nprint fmt: \"%s\"\n", tpfmt); \
  47. \
  48. return ret; \
  49. }