task.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM task
  3. #if !defined(_TRACE_TASK_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_TASK_H
  5. #include <linux/tracepoint.h>
  6. TRACE_EVENT(task_newtask,
  7. TP_PROTO(struct task_struct *task, unsigned long clone_flags),
  8. TP_ARGS(task, clone_flags),
  9. TP_STRUCT__entry(
  10. __field( pid_t, pid)
  11. __array( char, comm, TASK_COMM_LEN)
  12. __field( unsigned long, clone_flags)
  13. __field( short, oom_score_adj)
  14. ),
  15. TP_fast_assign(
  16. __entry->pid = task->pid;
  17. memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
  18. __entry->clone_flags = clone_flags;
  19. __entry->oom_score_adj = task->signal->oom_score_adj;
  20. ),
  21. TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%hd",
  22. __entry->pid, __entry->comm,
  23. __entry->clone_flags, __entry->oom_score_adj)
  24. );
  25. TRACE_EVENT(task_rename,
  26. TP_PROTO(struct task_struct *task, const char *comm),
  27. TP_ARGS(task, comm),
  28. TP_STRUCT__entry(
  29. __field( pid_t, pid)
  30. __array( char, oldcomm, TASK_COMM_LEN)
  31. __array( char, newcomm, TASK_COMM_LEN)
  32. __field( short, oom_score_adj)
  33. ),
  34. TP_fast_assign(
  35. __entry->pid = task->pid;
  36. memcpy(entry->oldcomm, task->comm, TASK_COMM_LEN);
  37. strlcpy(entry->newcomm, comm, TASK_COMM_LEN);
  38. __entry->oom_score_adj = task->signal->oom_score_adj;
  39. ),
  40. TP_printk("pid=%d oldcomm=%s newcomm=%s oom_score_adj=%hd",
  41. __entry->pid, __entry->oldcomm,
  42. __entry->newcomm, __entry->oom_score_adj)
  43. );
  44. #endif
  45. /* This part must be outside protection */
  46. #include <trace/define_trace.h>