task.h 1.5 KB

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