-
Notifications
You must be signed in to change notification settings - Fork 3
/
trace.h
179 lines (159 loc) · 7.9 KB
/
trace.h
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*
* j2 - A simple concatenative programming language that can understand
* the structure of and dynamically link with compatible C binaries.
*
* Copyright (C) 2011 Jason Nyberg <[email protected]>
* Copyright (C) 2018 Jason Nyberg <[email protected]> (dual-licensed)
* (C) Copyright 2019 Hewlett Packard Enterprise Development LP.
*
* This file is part of j2.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either
*
* * the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at
* your option) any later version
*
* or
*
* * the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at
* your option) any later version
*
* or both in parallel, as here.
*
* j2 is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received copies of the GNU General Public License and
* the GNU Lesser General Public License along with this program. If
* not, see <http://www.gnu.org/licenses/>.
*/
#ifdef LTTNG
#undef TRACEPOINT_PROVIDER
#define TRACEPOINT_PROVIDER edict
#undef TRACEPOINT_INCLUDE
#define TRACEPOINT_INCLUDE "./trace.h"
#if !defined(TRACE_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define TRACE_H
#include <lttng/tracepoint.h>
TRACEPOINT_EVENT(edict,
start,
TP_ARGS(char *,file,char *,func,char *,msg,int,status),
TP_FIELDS(ctf_string(file,file)
ctf_string(func,func)
ctf_string(msg,msg)
ctf_integer(int,status,status)))
TRACEPOINT_EVENT(edict,
finish,
TP_ARGS(char *,file,char *,func,char *,msg,int,status),
TP_FIELDS(ctf_string(file,file)
ctf_string(func,func)
ctf_string(msg,msg)
ctf_integer(int,status,status)))
TRACEPOINT_EVENT(edict,
event,
TP_ARGS(char *,file,char *,func,char *,msg,int,status),
TP_FIELDS(ctf_string(file,file)
ctf_string(func,func)
ctf_string(msg,msg)
ctf_integer(int,status,status)))
TRACEPOINT_EVENT(edict,
event_len,
TP_ARGS(char *,file,char *,func,char *,msg,int,msglen,int,status),
TP_FIELDS(ctf_string(file,file)
ctf_string(func,func)
ctf_sequence_text(char,msg,msg,size_t,msglen)
ctf_integer(int,status,status)))
TRACEPOINT_EVENT(edict,
event_hex,
TP_ARGS(char *,file,char *,func,unsigned char *,data,int,len,int,status),
TP_FIELDS(ctf_string(file,file)
ctf_string(func,func)
ctf_sequence(unsigned char,data,data,size_t,len)
ctf_integer(int,status,status)))
TRACEPOINT_EVENT(edict,
error,
TP_ARGS(char *,file,char *,func,char *,msg,int,status),
TP_FIELDS(ctf_string(file,file)
ctf_string(func,func)
ctf_string(msg,msg)
ctf_integer(int,status,status)))
TRACEPOINT_EVENT(edict,
alloc,
TP_ARGS(char *,file,char *,func,char *,msg,void *,ptr,int,size),
TP_FIELDS(ctf_string(file,file)
ctf_string(func,func)
ctf_string(msg,msg)
ctf_integer_hex(void *,ptr,ptr)
ctf_integer(int,size,size)))
TRACEPOINT_EVENT(edict,
dealloc,
TP_ARGS(char *,file,char *,func,char *,msg,void *,ptr),
TP_FIELDS(ctf_string(file,file)
ctf_string(func,func)
ctf_string(msg,msg)
ctf_integer_hex(void *,ptr,ptr)))
TRACEPOINT_EVENT(edict,
lookup,
TP_ARGS(char *,file,char *,func,void *,ltv,char *,name,int,len,int,insert),
TP_FIELDS(ctf_string(file,file)
ctf_string(func,func)
ctf_integer_hex(void *,ltv,ltv)
ctf_sequence_text(char,name,name,size_t,len)
ctf_integer(int,insert,insert)))
TRACEPOINT_EVENT(edict,
opcode,
TP_ARGS(char *,file,char *,func,int,state),
TP_FIELDS(ctf_string(file,file)
ctf_string(func,func)
ctf_integer(int,state,state)))
TRACEPOINT_EVENT(edict,
opext,
TP_ARGS(char *,file,char *,func,char *,opcode,int,len,int,flags,int,state),
TP_FIELDS(ctf_string(file,file)
ctf_string(func,func)
ctf_sequence_text(char,opcode,opcode,size_t,len)
ctf_integer(int,flags,flags)
ctf_integer(int,state,state)))
TRACEPOINT_LOGLEVEL(edict,start, TRACE_DEBUG)
TRACEPOINT_LOGLEVEL(edict,finish, TRACE_DEBUG)
TRACEPOINT_LOGLEVEL(edict,event, TRACE_DEBUG_LINE)
TRACEPOINT_LOGLEVEL(edict,event_len,TRACE_DEBUG_LINE)
TRACEPOINT_LOGLEVEL(edict,event_hex,TRACE_DEBUG_LINE)
TRACEPOINT_LOGLEVEL(edict,error, TRACE_ERR)
TRACEPOINT_LOGLEVEL(edict,alloc, TRACE_DEBUG_LINE)
TRACEPOINT_LOGLEVEL(edict,dealloc, TRACE_DEBUG)
TRACEPOINT_LOGLEVEL(edict,lookup, TRACE_DEBUG_LINE)
TRACEPOINT_LOGLEVEL(edict,opcode, TRACE_DEBUG_LINE)
TRACEPOINT_LOGLEVEL(edict,opext, TRACE_DEBUG_LINE)
#endif /* TRACE_H */
#include <lttng/tracepoint-event.h>
#define TSTART(status,msg) tracepoint(edict,start, (char *) __FILE__,(char *) __FUNCTION__,msg,status)
#define TFINISH(status,msg) tracepoint(edict,finish, (char *) __FILE__,(char *) __FUNCTION__,msg,status)
#define TEVENT(status,msg) tracepoint(edict,event, (char *) __FILE__,(char *) __FUNCTION__,msg,status)
#define TEVLEN(status,msg,msglen) tracepoint(edict,event_len, (char *) __FILE__,(char *) __FUNCTION__,msg,msglen,status)
#define TEVHEX(status,data,len) tracepoint(edict,event_hex, (char *) __FILE__,(char *) __FUNCTION__,(unsigned char *) data,len,status)
#define TERROR(status,msg) tracepoint(edict,error, (char *) __FILE__,(char *) __FUNCTION__,msg,status)
#define TALLOC(ptr,size,msg) tracepoint(edict,alloc, (char *) __FILE__,(char *) __FUNCTION__,msg,ptr,size)
#define TDEALLOC(ptr,msg) tracepoint(edict,dealloc, (char *) __FILE__,(char *) __FUNCTION__,msg,ptr)
#define TLOOKUP(ltv,name,len,insert) tracepoint(edict,lookup, (char *) __FILE__,(char *) __FUNCTION__,(void *) ltv,(char *) name,len,insert)
#define TOPCODE(state) tracepoint(edict,opcode, (char *) __FILE__,(char *) __FUNCTION__,state)
#define TOPEXT(ext,len,flags,state) tracepoint(edict,opext, (char *) __FILE__,(char *) __FUNCTION__,(char *) ext,len,flags,state)
#else /* LTTNG */
#define NOTHING_TO_DO while(0) {}
#define TSTART(status,msg) NOTHING_TO_DO
#define TFINISH(status,msg) NOTHING_TO_DO
#define TEVENT(status,msg) NOTHING_TO_DO
#define TEVLEN(status,msg,msglen) NOTHING_TO_DO
#define TEVHEX(status,data,len) NOTHING_TO_DO
#define TERROR(status,msg) NOTHING_TO_DO
#define TALLOC(ptr,size,msg) NOTHING_TO_DO
#define TDEALLOC(ptr,msg) NOTHING_TO_DO
#define TLOOKUP(ltv,name,len,insert) NOTHING_TO_DO
#define TOPCODE(state) NOTHING_TO_DO
#define TOPEXT(ext,len,flags,state) NOTHING_TO_DO
#endif /* LTTNG */