34 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY 35 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "perf" 37 #define PERF_LOG_ALWAYS(level, cat, x) \ 38 el::base::Writer(level, __FILE__, __LINE__, ELPP_FUNC, el::base::DispatchAction::FileOnlyLog).construct(cat) << x 39 #define PERF_LOG(level, cat, x) \ 41 if (ELPP->vRegistry()->allowed(level, cat)) PERF_LOG_ALWAYS(level, cat, x); \ 48 #if defined(__x86_64__) 50 __asm__
volatile(
"rdtsc" :
"=a"(lo),
"=d"(hi));
66 if (
t1 -
t0 > 1*1000000000)
break;
71 return tpns256 ? tpns256 : 1;
81 #if defined(__x86_64__) 82 return 256 * ticks / ticks_per_ns;
94 static __thread std::vector<LoggingPerformanceTimer*> *performance_timers = NULL;
117 const bool log =
ELPP->vRegistry()->allowed(level, cat.c_str());
118 if (!performance_timers)
122 performance_timers =
new std::vector<LoggingPerformanceTimer*>();
123 performance_timers->reserve(16);
132 size_t size = 0;
for (
const auto *tmp: *performance_timers)
if (!tmp->paused) ++size;
138 performance_timers->push_back(
this);
150 performance_timers->pop_back();
151 const bool log =
ELPP->vRegistry()->allowed(level, cat.c_str());
155 snprintf(s,
sizeof(s),
"%8llu ", (
unsigned long long)(
ticks_to_ns(
ticks) / (1000000000 / unit)));
156 size_t size = 0;
for (
const auto *tmp: *performance_timers)
if (!tmp->paused || tmp==
this) ++size;
159 if (performance_timers->empty())
161 delete performance_timers;
162 performance_timers = NULL;
Information representing errors in application but application will keep running. ...
Informational events most useful for developers to debug application.
Severe error information that will presumably abort application.
Level
Represents enumeration for severity level used to determine level of logging.
static const char * convertToString(Level level)
Converts level to associated const char*.
unsigned __int64 uint64_t
const base::type::char_t * unit
Useful when application has potentially harmful situtaions.
Mainly useful to represent current progress of application.
#define PERF_LOG_ALWAYS(level, cat, x)
Information that can be useful to back-trace certain events - mostly useful than debug logs...