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
|
/******************************************************************************
* include/xen/trace.h
*
* Xen Trace Buffer
*
* Copyright (C) 2003 by Intel Research Cambridge
*
* Author: Mark Williamson, mark.a.williamson@intel.com
* Date: January 2004
*
* Copyright (C) 2005 Bin Ren
*
* The trace buffer code is designed to allow debugging traces of Xen to be
* generated on UP / SMP machines. Each trace entry is timestamped so that
* it's possible to reconstruct a chronological record of trace events.
*
* Access to the trace buffers is via a dom0 hypervisor op and analysis of
* trace buffer contents can then be performed using a userland tool.
*/
#ifndef __XEN_TRACE_H__
#define __XEN_TRACE_H__
extern int tb_init_done;
#include <xen/config.h>
#include <public/sysctl.h>
#include <public/trace.h>
#include <asm/trace.h>
/* Used to initialise trace buffer functionality */
void init_trace_bufs(void);
/* used to retrieve the physical address of the trace buffers */
int tb_control(struct xen_sysctl_tbuf_op *tbc);
void __trace_var(u32 event, int cycles, int extra, unsigned char *extra_data);
static inline void trace_var(u32 event, int cycles, int extra,
unsigned char *extra_data)
{
if ( unlikely(tb_init_done) )
__trace_var(event, cycles, extra, extra_data);
}
/* Convenience macros for calling the trace function. */
#define TRACE_0D(_e) \
do { \
trace_var(_e, 1, 0, NULL); \
} while ( 0 )
#define TRACE_1D(_e,d1) \
do { \
if ( unlikely(tb_init_done) ) \
{ \
u32 _d[1]; \
_d[0] = d1; \
__trace_var(_e, 1, sizeof(*_d), (unsigned char *)_d); \
} \
} while ( 0 )
#define TRACE_2D(_e,d1,d2) \
do { \
if ( unlikely(tb_init_done) ) \
{ \
u32 _d[2]; \
_d[0] = d1; \
_d[1] = d2; \
__trace_var(_e, 1, sizeof(*_d)*2, (unsigned char *)_d); \
} \
} while ( 0 )
#define TRACE_3D(_e,d1,d2,d3) \
do { \
if ( unlikely(tb_init_done) ) \
{ \
u32 _d[3]; \
_d[0] = d1; \
_d[1] = d2; \
_d[2] = d3; \
__trace_var(_e, 1, sizeof(*_d)*3, (unsigned char *)_d); \
} \
} while ( 0 )
#define TRACE_4D(_e,d1,d2,d3,d4) \
do { \
if ( unlikely(tb_init_done) ) \
{ \
u32 _d[4]; \
_d[0] = d1; \
_d[1] = d2; \
_d[2] = d3; \
_d[3] = d4; \
__trace_var(_e, 1, sizeof(*_d)*4, (unsigned char *)_d); \
} \
} while ( 0 )
#define TRACE_5D(_e,d1,d2,d3,d4,d5) \
do { \
if ( unlikely(tb_init_done) ) \
{ \
u32 _d[5]; \
_d[0] = d1; \
_d[1] = d2; \
_d[2] = d3; \
_d[3] = d4; \
_d[4] = d5; \
__trace_var(_e, 1, sizeof(*_d)*5, (unsigned char *)_d); \
} \
} while ( 0 )
#endif /* __XEN_TRACE_H__ */
|