1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 * Trace data dumping primitives.
37 #include "pipe/p_compiler.h"
48 void trace_dump_init(void);
51 * Low level dumping controls.
53 * Opening the trace file and checking if that is opened.
55 boolean trace_dump_trace_begin(void);
56 boolean trace_dump_trace_enabled(void);
57 void trace_dump_trace_end(void);
60 * Lock and unlock the call mutex.
62 * It used by the none locked version of dumping control
63 * and begin/end call dump functions.
65 * Begin takes the lock while end unlocks it. Use the _locked
66 * version to avoid locking/unlocking it.
68 void trace_dump_call_lock(void);
69 void trace_dump_call_unlock(void);
72 * High level dumping control.
74 void trace_dumping_start_locked(void);
75 void trace_dumping_stop_locked(void);
76 boolean trace_dumping_enabled_locked(void);
77 void trace_dumping_start(void);
78 void trace_dumping_stop(void);
79 boolean trace_dumping_enabled(void);
81 void trace_dump_call_begin_locked(const char *klass, const char *method);
82 void trace_dump_call_end_locked(void);
83 void trace_dump_call_begin(const char *klass, const char *method);
84 void trace_dump_call_end(void);
86 void trace_dump_arg_begin(const char *name);
87 void trace_dump_arg_end(void);
88 void trace_dump_ret_begin(void);
89 void trace_dump_ret_end(void);
90 void trace_dump_bool(int value);
91 void trace_dump_int(long long int value);
92 void trace_dump_uint(long long unsigned value);
93 void trace_dump_float(double value);
94 void trace_dump_bytes(const void *data, size_t size);
95 void trace_dump_string(const char *str);
96 void trace_dump_enum(const char *value);
97 void trace_dump_array_begin(void);
98 void trace_dump_array_end(void);
99 void trace_dump_elem_begin(void);
100 void trace_dump_elem_end(void);
101 void trace_dump_struct_begin(const char *name);
102 void trace_dump_struct_end(void);
103 void trace_dump_member_begin(const char *name);
104 void trace_dump_member_end(void);
105 void trace_dump_null(void);
106 void trace_dump_ptr(const void *value);
107 /* will turn a wrapped object into the real one and dump ptr */
108 void trace_dump_buffer_ptr(struct pipe_buffer *_buffer);
109 void trace_dump_texture_ptr(struct pipe_texture *_texture);
110 void trace_dump_surface_ptr(struct pipe_surface *_surface);
111 void trace_dump_transfer_ptr(struct pipe_transfer *_transfer);
114 * Code saving macros.
117 #define trace_dump_arg(_type, _arg) \
119 trace_dump_arg_begin(#_arg); \
120 trace_dump_##_type(_arg); \
121 trace_dump_arg_end(); \
124 #define trace_dump_ret(_type, _arg) \
126 trace_dump_ret_begin(); \
127 trace_dump_##_type(_arg); \
128 trace_dump_ret_end(); \
131 #define trace_dump_array(_type, _obj, _size) \
134 trace_dump_array_begin(); \
135 for(idx = 0; idx < (_size); ++idx) { \
136 trace_dump_elem_begin(); \
137 trace_dump_##_type((_obj)[idx]); \
138 trace_dump_elem_end(); \
140 trace_dump_array_end(); \
143 #define trace_dump_struct_array(_type, _obj, _size) \
146 trace_dump_array_begin(); \
147 for(idx = 0; idx < (_size); ++idx) { \
148 trace_dump_elem_begin(); \
149 trace_dump_##_type(&(_obj)[idx]); \
150 trace_dump_elem_end(); \
152 trace_dump_array_end(); \
155 #define trace_dump_member(_type, _obj, _member) \
157 trace_dump_member_begin(#_member); \
158 trace_dump_##_type((_obj)->_member); \
159 trace_dump_member_end(); \
162 #define trace_dump_arg_array(_type, _arg, _size) \
164 trace_dump_arg_begin(#_arg); \
165 trace_dump_array(_type, _arg, _size); \
166 trace_dump_arg_end(); \
169 #define trace_dump_member_array(_type, _obj, _member) \
171 trace_dump_member_begin(#_member); \
172 trace_dump_array(_type, (_obj)->_member, sizeof((_obj)->_member)/sizeof((_obj)->_member[0])); \
173 trace_dump_member_end(); \
177 #endif /* TR_DUMP_H */