5 #ifndef OPENCV_TRACE_HPP
6 #define OPENCV_TRACE_HPP
8 #include <opencv2/core/cvdef.h>
18 #define CV_TRACE_FUNCTION()
20 #define CV_TRACE_FUNCTION_SKIP_NESTED()
24 #define CV_TRACE_REGION(name_as_static_string_literal)
27 #define CV_TRACE_REGION_NEXT(name_as_static_string_literal)
30 #define CV_TRACE_ARG(arg_id)
33 #define CV_TRACE_ARG_VALUE(arg_id, arg_name, value)
36 #define CV_TRACE_NS cv::utils::trace
38 #if !defined(OPENCV_DISABLE_TRACE) && defined(__EMSCRIPTEN__)
39 #define OPENCV_DISABLE_TRACE 1
44 #ifndef __OPENCV_TRACE
45 # if defined __OPENCV_BUILD && !defined __OPENCV_TESTS && !defined __OPENCV_APPS
46 # define __OPENCV_TRACE 1
48 # define __OPENCV_TRACE 0
52 #ifndef CV_TRACE_FILENAME
53 # define CV_TRACE_FILENAME __FILE__
56 #ifndef CV__TRACE_FUNCTION
58 # define CV__TRACE_FUNCTION __FUNCSIG__
59 # elif defined __GNUC__
60 # define CV__TRACE_FUNCTION __PRETTY_FUNCTION__
62 # define CV__TRACE_FUNCTION "<unknown>"
70 struct LocationExtraData;
71 struct LocationStaticStorage
73 LocationExtraData** ppExtra;
80 Region(
const LocationStaticStorage& location);
93 bool isActive()
const {
return pImpl != NULL; }
97 Region(
const Region&);
98 Region& operator= (
const Region&);
102 enum RegionLocationFlag {
103 REGION_FLAG_FUNCTION = (1 << 0),
104 REGION_FLAG_APP_CODE = (1 << 1),
105 REGION_FLAG_SKIP_NESTED = (1 << 2),
107 REGION_FLAG_IMPL_IPP = (1 << 16),
108 REGION_FLAG_IMPL_OPENCL = (2 << 16),
109 REGION_FLAG_IMPL_OPENVX = (3 << 16),
111 REGION_FLAG_IMPL_MASK = (15 << 16),
113 REGION_FLAG_REGION_FORCE = (1 << 30),
114 REGION_FLAG_REGION_NEXT = (1 << 31),
116 ENUM_REGION_FLAG_FORCE_INT = INT_MAX
139 #define CV__TRACE_LOCATION_VARNAME(loc_id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_trace_location_, loc_id), __LINE__)
140 #define CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_trace_location_extra_, loc_id) , __LINE__)
142 #define CV__TRACE_DEFINE_LOCATION_(loc_id, name, flags) \
143 static CV_TRACE_NS::details::Region::LocationExtraData* CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id) = 0; \
144 static const CV_TRACE_NS::details::Region::LocationStaticStorage \
145 CV__TRACE_LOCATION_VARNAME(loc_id) = { &(CV__TRACE_LOCATION_EXTRA_VARNAME(loc_id)), name, CV_TRACE_FILENAME, __LINE__, flags};
147 #define CV__TRACE_DEFINE_LOCATION_FN(name, flags) CV__TRACE_DEFINE_LOCATION_(fn, name, ((flags) | CV_TRACE_NS::details::REGION_FLAG_FUNCTION))
150 #define CV__TRACE_OPENCV_FUNCTION() \
151 CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, 0); \
152 const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
154 #define CV__TRACE_OPENCV_FUNCTION_NAME(name) \
155 CV__TRACE_DEFINE_LOCATION_FN(name, 0); \
156 const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
158 #define CV__TRACE_APP_FUNCTION() \
159 CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
160 const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
162 #define CV__TRACE_APP_FUNCTION_NAME(name) \
163 CV__TRACE_DEFINE_LOCATION_FN(name, CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
164 const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
167 #define CV__TRACE_OPENCV_FUNCTION_SKIP_NESTED() \
168 CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED); \
169 const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
171 #define CV__TRACE_OPENCV_FUNCTION_NAME_SKIP_NESTED(name) \
172 CV__TRACE_DEFINE_LOCATION_FN(name, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED); \
173 const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
175 #define CV__TRACE_APP_FUNCTION_SKIP_NESTED() \
176 CV__TRACE_DEFINE_LOCATION_FN(CV__TRACE_FUNCTION, CV_TRACE_NS::details::REGION_FLAG_SKIP_NESTED | CV_TRACE_NS::details::REGION_FLAG_APP_CODE); \
177 const CV_TRACE_NS::details::Region __region_fn(CV__TRACE_LOCATION_VARNAME(fn));
180 #define CV__TRACE_REGION_(name_as_static_string_literal, flags) \
181 CV__TRACE_DEFINE_LOCATION_(region, name_as_static_string_literal, flags); \
182 CV_TRACE_NS::details::Region CVAUX_CONCAT(__region_, __LINE__)(CV__TRACE_LOCATION_VARNAME(region));
184 #define CV__TRACE_REGION(name_as_static_string_literal) CV__TRACE_REGION_(name_as_static_string_literal, 0)
185 #define CV__TRACE_REGION_NEXT(name_as_static_string_literal) CV__TRACE_REGION_(name_as_static_string_literal, CV_TRACE_NS::details::REGION_FLAG_REGION_NEXT)
187 #define CV__TRACE_ARG_VARNAME(arg_id) CVAUX_CONCAT(__cv_trace_arg_ ## arg_id, __LINE__)
188 #define CV__TRACE_ARG_EXTRA_VARNAME(arg_id) CVAUX_CONCAT(__cv_trace_arg_extra_ ## arg_id, __LINE__)
190 #define CV__TRACE_DEFINE_ARG_(arg_id, name, flags) \
191 static CV_TRACE_NS::details::TraceArg::ExtraData* CV__TRACE_ARG_EXTRA_VARNAME(arg_id) = 0; \
192 static const CV_TRACE_NS::details::TraceArg \
193 CV__TRACE_ARG_VARNAME(arg_id) = { &(CV__TRACE_ARG_EXTRA_VARNAME(arg_id)), name, flags };
195 #define CV__TRACE_ARG_VALUE(arg_id, arg_name, value) \
196 CV__TRACE_DEFINE_ARG_(arg_id, arg_name, 0); \
197 CV_TRACE_NS::details::traceArg((CV__TRACE_ARG_VARNAME(arg_id)), value);
199 #define CV__TRACE_ARG(arg_id) CV_TRACE_ARG_VALUE(arg_id, #arg_id, (arg_id))
203 #ifndef OPENCV_DISABLE_TRACE
204 #undef CV_TRACE_FUNCTION
205 #undef CV_TRACE_FUNCTION_SKIP_NESTED
207 #define CV_TRACE_FUNCTION CV__TRACE_OPENCV_FUNCTION
208 #define CV_TRACE_FUNCTION_SKIP_NESTED CV__TRACE_OPENCV_FUNCTION_SKIP_NESTED
210 #define CV_TRACE_FUNCTION CV__TRACE_APP_FUNCTION
211 #define CV_TRACE_FUNCTION_SKIP_NESTED CV__TRACE_APP_FUNCTION_SKIP_NESTED
214 #undef CV_TRACE_REGION
215 #define CV_TRACE_REGION CV__TRACE_REGION
217 #undef CV_TRACE_REGION_NEXT
218 #define CV_TRACE_REGION_NEXT CV__TRACE_REGION_NEXT
220 #undef CV_TRACE_ARG_VALUE
221 #define CV_TRACE_ARG_VALUE(arg_id, arg_name, value) \
222 if (__region_fn.isActive()) \
224 CV__TRACE_ARG_VALUE(arg_id, arg_name, value); \
228 #define CV_TRACE_ARG CV__TRACE_ARG
232 #ifdef OPENCV_TRACE_VERBOSE
233 #define CV_TRACE_FUNCTION_VERBOSE CV_TRACE_FUNCTION
234 #define CV_TRACE_REGION_VERBOSE CV_TRACE_REGION
235 #define CV_TRACE_REGION_NEXT_VERBOSE CV_TRACE_REGION_NEXT
236 #define CV_TRACE_ARG_VALUE_VERBOSE CV_TRACE_ARG_VALUE
237 #define CV_TRACE_ARG_VERBOSE CV_TRACE_ARG
239 #define CV_TRACE_FUNCTION_VERBOSE(...)
240 #define CV_TRACE_REGION_VERBOSE(...)
241 #define CV_TRACE_REGION_NEXT_VERBOSE(...)
242 #define CV_TRACE_ARG_VALUE_VERBOSE(...)
243 #define CV_TRACE_ARG_VERBOSE(...)
InputArrayOfArrays Size InputOutputArray InputOutputArray OutputArrayOfArrays OutputArrayOfArrays OutputArray OutputArray OutputArray int flags
Definition: calib3d.hpp:1617
static double trace(const Matx< _Tp, m, n > &a)
int CvScalar value
Definition: core_c.h:720
const char const char ** filename
Definition: core_c.h:2630
int64_t int64
Definition: interface.h:61
#define CV_EXPORTS
Definition: cvdef.h:435
#define CV_DbgAssert(expr)
Definition: base.hpp:375
CV_EXPORTS_W void line(InputOutputArray img, Point pt1, Point pt2, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
Draws a line segment connecting two points.
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441