-
Notifications
You must be signed in to change notification settings - Fork 5
/
ev_user.c
144 lines (123 loc) · 3.46 KB
/
ev_user.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/**
* LTTng to GTKwave trace conversion
*
* Authors:
* Adrien Charruel <[email protected]>
*
* Copyright (C) 2013 Parrot S.A.
*/
#include "lttng2lxt.h"
#include "lttng.h"
#define MAX_USER_EVENTS 32
#define MAX_KERNEL_EVENTS 32
static struct ltt_trace user_trace_g;
static struct ltt_trace kernel_trace_g;
static struct ltt_trace user_traces[MAX_USER_EVENTS];
static struct ltt_trace kernel_traces[MAX_KERNEL_EVENTS];
static void user_event_start_process(const char *modname, int pass,
double clock, int cpu, void *args)
{
int num = (int)get_arg_i64(args, "event_start");
if (pass == 1) {
if (num < (int)(sizeof(user_traces) /
sizeof(user_traces[0])) && num >= 0)
init_trace(&user_traces[num],
TG_USER,
1 + 0.1 * num,
TRACE_SYM_F_BITS,
"user event %d",
num);
}
if (pass == 2) {
if (num < (int)(sizeof(user_traces) /
sizeof(user_traces[0])) && num >= 0)
emit_trace(&user_traces[num], (union ltt_value)LT_S0);
}
}
MODULE2(user, event_start);
static void user_event_stop_process(const char *modname, int pass,
double clock, int cpu, void *args)
{
int num = (int)get_arg_i64(args, "event_stop");
if (pass == 1) {
if (num < (int)(sizeof(user_traces) /
sizeof(user_traces[0])) && num >= 0)
init_trace(&user_traces[num],
TG_USER,
1 + 0.1 * num,
TRACE_SYM_F_BITS,
"user event %d",
num);
}
if (pass == 2) {
if (num < (int)(sizeof(user_traces) /
sizeof(user_traces[0])) && num >= 0)
emit_trace(&user_traces[num], (union ltt_value)LT_IDLE);
}
}
MODULE2(user, event_stop);
static void user_message_process(const char *modname, int pass,
double clock, int cpu, void *args)
{
const char *str = get_arg_str(args, "message");
if (pass == 1)
init_trace(&user_trace_g, TG_USER, 1,
TRACE_SYM_F_STRING, "user event");
if (pass == 2)
emit_trace(&user_trace_g, (union ltt_value)"%s", str);
}
MODULE2(user, message);
static void user_kevent_start_process(const char *modname, int pass,
double clock, int cpu, void *args)
{
int num = (int)get_arg_i64(args, "event_start");
if (pass == 1) {
if (num < (int)(sizeof(kernel_traces) /
sizeof(kernel_traces[0])) && num >= 0)
init_trace(&kernel_traces[num],
TG_USER,
0.1 * num,
TRACE_SYM_F_BITS,
"kernel event %d",
num);
}
if (pass == 2) {
if (num < (int)(sizeof(kernel_traces) /
sizeof(kernel_traces[0])) && num >= 0)
emit_trace(&kernel_traces[num], (union ltt_value)LT_S0);
}
}
MODULE(user_kevent_start);
static void user_kevent_stop_process(const char *modname, int pass,
double clock, int cpu, void *args)
{
int num = (int)get_arg_i64(args, "event_stop");
if (pass == 1) {
if (num < (int)(sizeof(kernel_traces) /
sizeof(kernel_traces[0])) && num >= 0)
init_trace(&kernel_traces[num],
TG_USER,
0.1 * num,
TRACE_SYM_F_BITS,
"kernel event %d",
num);
}
if (pass == 2) {
if (num < (int)(sizeof(kernel_traces) /
sizeof(kernel_traces[0])) && num >= 0)
emit_trace(&kernel_traces[num],
(union ltt_value)LT_IDLE);
}
}
MODULE(user_kevent_stop);
static void user_kmessage_process(const char *modname, int pass,
double clock, int cpu, void *args)
{
const char *str = get_arg_str(args, "message");
if (pass == 1)
init_trace(&kernel_trace_g, TG_USER, 0,
TRACE_SYM_F_STRING, "kernel event");
if (pass == 2)
emit_trace(&kernel_trace_g, (union ltt_value)"%s", str);
}
MODULE(user_kmessage);