cgroup.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM cgroup
  3. #if !defined(_TRACE_CGROUP_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_CGROUP_H
  5. #include <linux/cgroup.h>
  6. #include <linux/tracepoint.h>
  7. DECLARE_EVENT_CLASS(cgroup_root,
  8. TP_PROTO(struct cgroup_root *root),
  9. TP_ARGS(root),
  10. TP_STRUCT__entry(
  11. __field( int, root )
  12. __field( u16, ss_mask )
  13. __string( name, root->name )
  14. ),
  15. TP_fast_assign(
  16. __entry->root = root->hierarchy_id;
  17. __entry->ss_mask = root->subsys_mask;
  18. __assign_str(name, root->name);
  19. ),
  20. TP_printk("root=%d ss_mask=%#x name=%s",
  21. __entry->root, __entry->ss_mask, __get_str(name))
  22. );
  23. DEFINE_EVENT(cgroup_root, cgroup_setup_root,
  24. TP_PROTO(struct cgroup_root *root),
  25. TP_ARGS(root)
  26. );
  27. DEFINE_EVENT(cgroup_root, cgroup_destroy_root,
  28. TP_PROTO(struct cgroup_root *root),
  29. TP_ARGS(root)
  30. );
  31. DEFINE_EVENT(cgroup_root, cgroup_remount,
  32. TP_PROTO(struct cgroup_root *root),
  33. TP_ARGS(root)
  34. );
  35. DECLARE_EVENT_CLASS(cgroup,
  36. TP_PROTO(struct cgroup *cgrp),
  37. TP_ARGS(cgrp),
  38. TP_STRUCT__entry(
  39. __field( int, root )
  40. __field( int, id )
  41. __field( int, level )
  42. __dynamic_array(char, path,
  43. cgroup_path(cgrp, NULL, 0) + 1)
  44. ),
  45. TP_fast_assign(
  46. __entry->root = cgrp->root->hierarchy_id;
  47. __entry->id = cgrp->id;
  48. __entry->level = cgrp->level;
  49. cgroup_path(cgrp, __get_dynamic_array(path),
  50. __get_dynamic_array_len(path));
  51. ),
  52. TP_printk("root=%d id=%d level=%d path=%s",
  53. __entry->root, __entry->id, __entry->level, __get_str(path))
  54. );
  55. DEFINE_EVENT(cgroup, cgroup_mkdir,
  56. TP_PROTO(struct cgroup *cgroup),
  57. TP_ARGS(cgroup)
  58. );
  59. DEFINE_EVENT(cgroup, cgroup_rmdir,
  60. TP_PROTO(struct cgroup *cgroup),
  61. TP_ARGS(cgroup)
  62. );
  63. DEFINE_EVENT(cgroup, cgroup_release,
  64. TP_PROTO(struct cgroup *cgroup),
  65. TP_ARGS(cgroup)
  66. );
  67. DEFINE_EVENT(cgroup, cgroup_rename,
  68. TP_PROTO(struct cgroup *cgroup),
  69. TP_ARGS(cgroup)
  70. );
  71. DECLARE_EVENT_CLASS(cgroup_migrate,
  72. TP_PROTO(struct cgroup *dst_cgrp, struct task_struct *task, bool threadgroup),
  73. TP_ARGS(dst_cgrp, task, threadgroup),
  74. TP_STRUCT__entry(
  75. __field( int, dst_root )
  76. __field( int, dst_id )
  77. __field( int, dst_level )
  78. __dynamic_array(char, dst_path,
  79. cgroup_path(dst_cgrp, NULL, 0) + 1)
  80. __field( int, pid )
  81. __string( comm, task->comm )
  82. ),
  83. TP_fast_assign(
  84. __entry->dst_root = dst_cgrp->root->hierarchy_id;
  85. __entry->dst_id = dst_cgrp->id;
  86. __entry->dst_level = dst_cgrp->level;
  87. cgroup_path(dst_cgrp, __get_dynamic_array(dst_path),
  88. __get_dynamic_array_len(dst_path));
  89. __entry->pid = task->pid;
  90. __assign_str(comm, task->comm);
  91. ),
  92. TP_printk("dst_root=%d dst_id=%d dst_level=%d dst_path=%s pid=%d comm=%s",
  93. __entry->dst_root, __entry->dst_id, __entry->dst_level,
  94. __get_str(dst_path), __entry->pid, __get_str(comm))
  95. );
  96. DEFINE_EVENT(cgroup_migrate, cgroup_attach_task,
  97. TP_PROTO(struct cgroup *dst_cgrp, struct task_struct *task, bool threadgroup),
  98. TP_ARGS(dst_cgrp, task, threadgroup)
  99. );
  100. DEFINE_EVENT(cgroup_migrate, cgroup_transfer_tasks,
  101. TP_PROTO(struct cgroup *dst_cgrp, struct task_struct *task, bool threadgroup),
  102. TP_ARGS(dst_cgrp, task, threadgroup)
  103. );
  104. #endif /* _TRACE_CGROUP_H */
  105. /* This part must be outside protection */
  106. #include <trace/define_trace.h>