tracepoint event instrumentation: use system headers
[lttng-modules.git] / instrumentation / events / lttng-module / lttng-statedump.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM lttng_statedump
3
4 #if !defined(LTTNG_TRACE_LTTNG_STATEDUMP_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_LTTNG_STATEDUMP_H
6
7 #include <probes/lttng-tracepoint-event.h>
8 #include <linux/nsproxy.h>
9 #include <linux/pid_namespace.h>
10 #include <linux/types.h>
11 #include <linux/version.h>
12
13
14 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
15 #define lttng_proc_inum ns.inum
16 #else
17 #define lttng_proc_inum proc_inum
18 #endif
19
20 LTTNG_TRACEPOINT_EVENT(lttng_statedump_start,
21 TP_PROTO(struct lttng_session *session),
22 TP_ARGS(session),
23 TP_FIELDS()
24 )
25
26 LTTNG_TRACEPOINT_EVENT(lttng_statedump_end,
27 TP_PROTO(struct lttng_session *session),
28 TP_ARGS(session),
29 TP_FIELDS()
30 )
31
32 LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_state,
33 TP_PROTO(struct lttng_session *session,
34 struct task_struct *p,
35 int type, int mode, int submode, int status,
36 struct pid_namespace *pid_ns),
37 TP_ARGS(session, p, type, mode, submode, status, pid_ns),
38 TP_FIELDS(
39 ctf_integer(pid_t, tid, p->pid)
40 ctf_integer(pid_t, vtid, pid_ns ? task_pid_nr_ns(p, pid_ns) : 0)
41 ctf_integer(pid_t, pid, p->tgid)
42 ctf_integer(pid_t, vpid, pid_ns ? task_tgid_nr_ns(p, pid_ns) : 0)
43 ctf_integer(pid_t, ppid,
44 ({
45 pid_t ret;
46
47 rcu_read_lock();
48 ret = task_tgid_nr(p->real_parent);
49 rcu_read_unlock();
50 ret;
51 }))
52 ctf_integer(pid_t, vppid,
53 ({
54 struct task_struct *parent;
55 pid_t ret = 0;
56
57 if (pid_ns) {
58 rcu_read_lock();
59 parent = rcu_dereference(p->real_parent);
60 ret = task_tgid_nr_ns(parent, pid_ns);
61 rcu_read_unlock();
62 }
63 ret;
64 }))
65 ctf_array_text(char, name, p->comm, TASK_COMM_LEN)
66 ctf_integer(int, type, type)
67 ctf_integer(int, mode, mode)
68 ctf_integer(int, submode, submode)
69 ctf_integer(int, status, status)
70 ctf_integer(int, ns_level, pid_ns ? pid_ns->level : 0)
71 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
72 ctf_integer(unsigned int, ns_inum, pid_ns ? pid_ns->lttng_proc_inum : 0)
73 #endif
74 )
75 )
76
77 LTTNG_TRACEPOINT_EVENT(lttng_statedump_file_descriptor,
78 TP_PROTO(struct lttng_session *session,
79 struct task_struct *p, int fd, const char *filename,
80 unsigned int flags, fmode_t fmode),
81 TP_ARGS(session, p, fd, filename, flags, fmode),
82 TP_FIELDS(
83 ctf_integer(pid_t, pid, p->tgid)
84 ctf_integer(int, fd, fd)
85 ctf_integer_oct(unsigned int, flags, flags)
86 ctf_integer_hex(fmode_t, fmode, fmode)
87 ctf_string(filename, filename)
88 )
89 )
90
91 LTTNG_TRACEPOINT_EVENT(lttng_statedump_vm_map,
92 TP_PROTO(struct lttng_session *session,
93 struct task_struct *p, struct vm_area_struct *map,
94 unsigned long inode),
95 TP_ARGS(session, p, map, inode),
96 TP_FIELDS(
97 ctf_integer(pid_t, pid, p->tgid)
98 ctf_integer_hex(unsigned long, start, map->vm_start)
99 ctf_integer_hex(unsigned long, end, map->vm_end)
100 ctf_integer_hex(unsigned long, flags, map->vm_flags)
101 ctf_integer(unsigned long, inode, inode)
102 ctf_integer(unsigned long, pgoff, map->vm_pgoff << PAGE_SHIFT)
103 )
104 )
105
106 LTTNG_TRACEPOINT_EVENT(lttng_statedump_network_interface,
107 TP_PROTO(struct lttng_session *session,
108 struct net_device *dev, struct in_ifaddr *ifa),
109 TP_ARGS(session, dev, ifa),
110 TP_FIELDS(
111 ctf_string(name, dev->name)
112 ctf_integer_network_hex(uint32_t, address_ipv4,
113 ifa ? ifa->ifa_address : 0U)
114 )
115 )
116
117 LTTNG_TRACEPOINT_EVENT(lttng_statedump_block_device,
118 TP_PROTO(struct lttng_session *session,
119 dev_t dev, const char *diskname),
120 TP_ARGS(session, dev, diskname),
121 TP_FIELDS(
122 ctf_integer(dev_t, dev, dev)
123 ctf_string(diskname, diskname)
124 )
125 )
126
127 /* Called with desc->lock held */
128 LTTNG_TRACEPOINT_EVENT(lttng_statedump_interrupt,
129 TP_PROTO(struct lttng_session *session,
130 unsigned int irq, const char *chip_name,
131 struct irqaction *action),
132 TP_ARGS(session, irq, chip_name, action),
133 TP_FIELDS(
134 ctf_integer(unsigned int, irq, irq)
135 ctf_string(name, chip_name)
136 ctf_string(action, action->name ? : "")
137 )
138 )
139
140 #endif /* LTTNG_TRACE_LTTNG_STATEDUMP_H */
141
142 /* This part must be outside protection */
143 #include <probes/define_trace.h>
This page took 0.03777 seconds and 5 git commands to generate.