0001
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM cgroup
0004
0005 #if !defined(_TRACE_CGROUP_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define _TRACE_CGROUP_H
0007
0008 #include <linux/cgroup.h>
0009 #include <linux/tracepoint.h>
0010
0011 DECLARE_EVENT_CLASS(cgroup_root,
0012
0013 TP_PROTO(struct cgroup_root *root),
0014
0015 TP_ARGS(root),
0016
0017 TP_STRUCT__entry(
0018 __field( int, root )
0019 __field( u16, ss_mask )
0020 __string( name, root->name )
0021 ),
0022
0023 TP_fast_assign(
0024 __entry->root = root->hierarchy_id;
0025 __entry->ss_mask = root->subsys_mask;
0026 __assign_str(name, root->name);
0027 ),
0028
0029 TP_printk("root=%d ss_mask=%#x name=%s",
0030 __entry->root, __entry->ss_mask, __get_str(name))
0031 );
0032
0033 DEFINE_EVENT(cgroup_root, cgroup_setup_root,
0034
0035 TP_PROTO(struct cgroup_root *root),
0036
0037 TP_ARGS(root)
0038 );
0039
0040 DEFINE_EVENT(cgroup_root, cgroup_destroy_root,
0041
0042 TP_PROTO(struct cgroup_root *root),
0043
0044 TP_ARGS(root)
0045 );
0046
0047 DEFINE_EVENT(cgroup_root, cgroup_remount,
0048
0049 TP_PROTO(struct cgroup_root *root),
0050
0051 TP_ARGS(root)
0052 );
0053
0054 DECLARE_EVENT_CLASS(cgroup,
0055
0056 TP_PROTO(struct cgroup *cgrp, const char *path),
0057
0058 TP_ARGS(cgrp, path),
0059
0060 TP_STRUCT__entry(
0061 __field( int, root )
0062 __field( int, level )
0063 __field( u64, id )
0064 __string( path, path )
0065 ),
0066
0067 TP_fast_assign(
0068 __entry->root = cgrp->root->hierarchy_id;
0069 __entry->id = cgroup_id(cgrp);
0070 __entry->level = cgrp->level;
0071 __assign_str(path, path);
0072 ),
0073
0074 TP_printk("root=%d id=%llu level=%d path=%s",
0075 __entry->root, __entry->id, __entry->level, __get_str(path))
0076 );
0077
0078 DEFINE_EVENT(cgroup, cgroup_mkdir,
0079
0080 TP_PROTO(struct cgroup *cgrp, const char *path),
0081
0082 TP_ARGS(cgrp, path)
0083 );
0084
0085 DEFINE_EVENT(cgroup, cgroup_rmdir,
0086
0087 TP_PROTO(struct cgroup *cgrp, const char *path),
0088
0089 TP_ARGS(cgrp, path)
0090 );
0091
0092 DEFINE_EVENT(cgroup, cgroup_release,
0093
0094 TP_PROTO(struct cgroup *cgrp, const char *path),
0095
0096 TP_ARGS(cgrp, path)
0097 );
0098
0099 DEFINE_EVENT(cgroup, cgroup_rename,
0100
0101 TP_PROTO(struct cgroup *cgrp, const char *path),
0102
0103 TP_ARGS(cgrp, path)
0104 );
0105
0106 DEFINE_EVENT(cgroup, cgroup_freeze,
0107
0108 TP_PROTO(struct cgroup *cgrp, const char *path),
0109
0110 TP_ARGS(cgrp, path)
0111 );
0112
0113 DEFINE_EVENT(cgroup, cgroup_unfreeze,
0114
0115 TP_PROTO(struct cgroup *cgrp, const char *path),
0116
0117 TP_ARGS(cgrp, path)
0118 );
0119
0120 DECLARE_EVENT_CLASS(cgroup_migrate,
0121
0122 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
0123 struct task_struct *task, bool threadgroup),
0124
0125 TP_ARGS(dst_cgrp, path, task, threadgroup),
0126
0127 TP_STRUCT__entry(
0128 __field( int, dst_root )
0129 __field( int, dst_level )
0130 __field( u64, dst_id )
0131 __field( int, pid )
0132 __string( dst_path, path )
0133 __string( comm, task->comm )
0134 ),
0135
0136 TP_fast_assign(
0137 __entry->dst_root = dst_cgrp->root->hierarchy_id;
0138 __entry->dst_id = cgroup_id(dst_cgrp);
0139 __entry->dst_level = dst_cgrp->level;
0140 __assign_str(dst_path, path);
0141 __entry->pid = task->pid;
0142 __assign_str(comm, task->comm);
0143 ),
0144
0145 TP_printk("dst_root=%d dst_id=%llu dst_level=%d dst_path=%s pid=%d comm=%s",
0146 __entry->dst_root, __entry->dst_id, __entry->dst_level,
0147 __get_str(dst_path), __entry->pid, __get_str(comm))
0148 );
0149
0150 DEFINE_EVENT(cgroup_migrate, cgroup_attach_task,
0151
0152 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
0153 struct task_struct *task, bool threadgroup),
0154
0155 TP_ARGS(dst_cgrp, path, task, threadgroup)
0156 );
0157
0158 DEFINE_EVENT(cgroup_migrate, cgroup_transfer_tasks,
0159
0160 TP_PROTO(struct cgroup *dst_cgrp, const char *path,
0161 struct task_struct *task, bool threadgroup),
0162
0163 TP_ARGS(dst_cgrp, path, task, threadgroup)
0164 );
0165
0166 DECLARE_EVENT_CLASS(cgroup_event,
0167
0168 TP_PROTO(struct cgroup *cgrp, const char *path, int val),
0169
0170 TP_ARGS(cgrp, path, val),
0171
0172 TP_STRUCT__entry(
0173 __field( int, root )
0174 __field( int, level )
0175 __field( u64, id )
0176 __string( path, path )
0177 __field( int, val )
0178 ),
0179
0180 TP_fast_assign(
0181 __entry->root = cgrp->root->hierarchy_id;
0182 __entry->id = cgroup_id(cgrp);
0183 __entry->level = cgrp->level;
0184 __assign_str(path, path);
0185 __entry->val = val;
0186 ),
0187
0188 TP_printk("root=%d id=%llu level=%d path=%s val=%d",
0189 __entry->root, __entry->id, __entry->level, __get_str(path),
0190 __entry->val)
0191 );
0192
0193 DEFINE_EVENT(cgroup_event, cgroup_notify_populated,
0194
0195 TP_PROTO(struct cgroup *cgrp, const char *path, int val),
0196
0197 TP_ARGS(cgrp, path, val)
0198 );
0199
0200 DEFINE_EVENT(cgroup_event, cgroup_notify_frozen,
0201
0202 TP_PROTO(struct cgroup *cgrp, const char *path, int val),
0203
0204 TP_ARGS(cgrp, path, val)
0205 );
0206
0207 #endif
0208
0209
0210 #include <trace/define_trace.h>