20 #ifndef TRACER_HPP_INCLUDED
21 #define TRACER_HPP_INCLUDED
23 #include <boost/noncopyable.hpp>
30 :
private boost::noncopyable
41 :
private boost::noncopyable
51 explicit ttracer(
const char*
const function__);
57 const char*
const function;
71 std::map<std::pair<int, std::string>,
int>
counters;
83 #define TRACER_ENTRY(interval) \
84 static ttracer tracer(__PRETTY_FUNCTION__); \
85 ttracer::tprint print((++tracer.run % interval) == 0 ? &tracer : nullptr)
87 #define TRACER_ENTRY(interval) \
88 static ttracer tracer(__FUNCTION__); \
89 ttracer::tprint print((++tracer.run % interval) == 0 ? &tracer : nullptr)
99 #define TRACER_COUNT(marker) \
101 ++tracer.counters[std::make_pair(__LINE__, marker)]; \
Helper structure for gathering the tracing statistics.
std::map< std::pair< int, std::string >, int > counters
The tracer counters.
int run
The total number of runs.
ttracer(const char *const function__)
Helper structure to print the tracing statistics.
tprint(const ttracer *const tracer__)
const ttracer *const tracer
The tracer, whose statistics to print.