Commit | Line | Data |
---|---|---|
c337ddc2 MD |
1 | #undef TRACE_SYSTEM |
2 | #define TRACE_SYSTEM lttng_statedump | |
3 | ||
4 | #if !defined(_TRACE_LTTNG_STATEDUMP_H) || defined(TRACE_HEADER_MULTI_READ) | |
5 | #define _TRACE_LTTNG_STATEDUMP_H | |
6 | ||
7 | #include <linux/tracepoint.h> | |
90fffd13 | 8 | #include <linux/nsproxy.h> |
73e8ba37 | 9 | #include <linux/pid_namespace.h> |
c337ddc2 MD |
10 | |
11 | TRACE_EVENT(lttng_statedump_start, | |
12 | TP_PROTO(struct lttng_session *session), | |
13 | TP_ARGS(session), | |
14 | TP_STRUCT__entry( | |
15 | ), | |
16 | TP_fast_assign( | |
17 | ), | |
18 | TP_printk("") | |
19 | ) | |
20 | ||
21 | TRACE_EVENT(lttng_statedump_end, | |
22 | TP_PROTO(struct lttng_session *session), | |
23 | TP_ARGS(session), | |
24 | TP_STRUCT__entry( | |
25 | ), | |
26 | TP_fast_assign( | |
27 | ), | |
28 | TP_printk("") | |
29 | ) | |
30 | ||
31 | TRACE_EVENT(lttng_statedump_process_state, | |
32 | TP_PROTO(struct lttng_session *session, | |
33 | struct task_struct *p, | |
73e8ba37 JD |
34 | int type, int mode, int submode, int status, |
35 | struct pid_namespace *pid_ns), | |
36 | TP_ARGS(session, p, type, mode, submode, status, pid_ns), | |
c337ddc2 MD |
37 | TP_STRUCT__entry( |
38 | __field(pid_t, tid) | |
39 | __field(pid_t, vtid) | |
40 | __field(pid_t, pid) | |
41 | __field(pid_t, vpid) | |
42 | __field(pid_t, ppid) | |
43 | __field(pid_t, vppid) | |
44 | __array_text(char, name, TASK_COMM_LEN) | |
45 | __field(int, type) | |
46 | __field(int, mode) | |
47 | __field(int, submode) | |
48 | __field(int, status) | |
73e8ba37 | 49 | __field(int, ns_level) |
c337ddc2 MD |
50 | ), |
51 | TP_fast_assign( | |
52 | tp_assign(tid, p->pid) | |
73e8ba37 | 53 | tp_assign(vtid, pid_ns ? task_pid_nr_ns(p, pid_ns) : 0) |
c337ddc2 | 54 | tp_assign(pid, p->tgid) |
73e8ba37 | 55 | tp_assign(vpid, pid_ns ? task_tgid_nr_ns(p, pid_ns) : 0) |
c337ddc2 MD |
56 | tp_assign(ppid, |
57 | ({ | |
58 | pid_t ret; | |
59 | ||
60 | rcu_read_lock(); | |
61 | ret = task_tgid_nr(p->real_parent); | |
62 | rcu_read_unlock(); | |
63 | ret; | |
64 | })) | |
65 | tp_assign(vppid, | |
66 | ({ | |
67 | struct task_struct *parent; | |
90fffd13 | 68 | pid_t ret = 0; |
c337ddc2 MD |
69 | |
70 | rcu_read_lock(); | |
90fffd13 | 71 | parent = rcu_dereference(p->real_parent); |
73e8ba37 | 72 | ret = task_tgid_nr_ns(parent, pid_ns); |
c337ddc2 MD |
73 | rcu_read_unlock(); |
74 | ret; | |
75 | })) | |
76 | tp_memcpy(name, p->comm, TASK_COMM_LEN) | |
77 | tp_assign(type, type) | |
78 | tp_assign(mode, mode) | |
79 | tp_assign(submode, submode) | |
80 | tp_assign(status, status) | |
73e8ba37 | 81 | tp_assign(ns_level, pid_ns ? pid_ns->level : 0) |
c337ddc2 MD |
82 | ), |
83 | TP_printk("") | |
84 | ) | |
85 | ||
86 | TRACE_EVENT(lttng_statedump_file_descriptor, | |
87 | TP_PROTO(struct lttng_session *session, | |
88 | struct task_struct *p, int fd, const char *filename), | |
89 | TP_ARGS(session, p, fd, filename), | |
90 | TP_STRUCT__entry( | |
91 | __field(pid_t, pid) | |
92 | __field(int, fd) | |
93 | __string(filename, filename) | |
94 | ), | |
95 | TP_fast_assign( | |
96 | tp_assign(pid, p->tgid) | |
9edf633a | 97 | tp_assign(fd, fd) |
c337ddc2 MD |
98 | tp_strcpy(filename, filename) |
99 | ), | |
100 | TP_printk("") | |
101 | ) | |
102 | ||
103 | TRACE_EVENT(lttng_statedump_vm_map, | |
104 | TP_PROTO(struct lttng_session *session, | |
105 | struct task_struct *p, struct vm_area_struct *map, | |
106 | unsigned long inode), | |
107 | TP_ARGS(session, p, map, inode), | |
108 | TP_STRUCT__entry( | |
109 | __field(pid_t, pid) | |
110 | __field_hex(unsigned long, start) | |
111 | __field_hex(unsigned long, end) | |
112 | __field_hex(unsigned long, flags) | |
113 | __field(unsigned long, inode) | |
114 | __field(unsigned long, pgoff) | |
115 | ), | |
116 | TP_fast_assign( | |
117 | tp_assign(pid, p->tgid) | |
118 | tp_assign(start, map->vm_start) | |
119 | tp_assign(end, map->vm_end) | |
120 | tp_assign(flags, map->vm_flags) | |
121 | tp_assign(inode, inode) | |
122 | tp_assign(pgoff, map->vm_pgoff << PAGE_SHIFT) | |
123 | ), | |
124 | TP_printk("") | |
125 | ) | |
126 | ||
127 | TRACE_EVENT(lttng_statedump_network_interface, | |
128 | TP_PROTO(struct lttng_session *session, | |
129 | struct net_device *dev, struct in_ifaddr *ifa), | |
130 | TP_ARGS(session, dev, ifa), | |
131 | TP_STRUCT__entry( | |
132 | __string(name, dev->name) | |
133 | __field_network_hex(uint32_t, address_ipv4) | |
134 | ), | |
135 | TP_fast_assign( | |
136 | tp_strcpy(name, dev->name) | |
137 | tp_assign(address_ipv4, ifa ? ifa->ifa_address : 0U) | |
138 | ), | |
139 | TP_printk("") | |
140 | ) | |
141 | ||
142 | /* Called with desc->lock held */ | |
143 | TRACE_EVENT(lttng_statedump_interrupt, | |
144 | TP_PROTO(struct lttng_session *session, | |
145 | unsigned int irq, const char *chip_name, | |
146 | struct irqaction *action), | |
147 | TP_ARGS(session, irq, chip_name, action), | |
148 | TP_STRUCT__entry( | |
149 | __field(unsigned int, irq) | |
150 | __string(name, chip_name) | |
151 | __string(action, action->name) | |
152 | ), | |
153 | TP_fast_assign( | |
154 | tp_assign(irq, irq) | |
155 | tp_strcpy(name, chip_name) | |
156 | tp_strcpy(action, action->name) | |
157 | ), | |
158 | TP_printk("") | |
159 | ) | |
160 | ||
161 | #endif /* _TRACE_LTTNG_STATEDUMP_H */ | |
162 | ||
163 | /* This part must be outside protection */ | |
164 | #include "../../../probes/define_trace.h" |