hpp-util 6.0.0
Debugging tools for the HPP project.
Loading...
Searching...
No Matches
Macros for logging

Macros

#define hppDout(channel, data)
 Write data to channel when HPP_DEBUG is defined.
 
#define hppDoutFatal(channel, data)
 Write data to channel and exit the program.
 
#define HPP_DEFINE_TIMECOUNTER(name)    ::hpp::debug::TimeCounter _##name##_timecounter_(#name)
 Define a new TimeCounter.
 
#define HPP_SCOPE_TIMECOUNTER(name)
 Compute the time spent in the current scope.
 
#define HPP_START_TIMECOUNTER(name)   _##name##_timecounter_.start()
 Start a watch.
 
#define HPP_STOP_TIMECOUNTER(name)   _##name##_timecounter_.stop()
 Stop a watch and save elapsed time.
 
#define HPP_DISPLAY_LAST_TIMECOUNTER(name)
 Print last elapsed time to the logs.
 
#define HPP_DISPLAY_TIMECOUNTER(name)
 Print min, max and mean time of the time measurements.
 
#define HPP_RESET_TIMECOUNTER(name)   _##name##_timecounter_.reset();
 Reset a TimeCounter.
 
#define HPP_STREAM_TIMECOUNTER(os, name)   os << _##name##_timecounter_
 Stream (operator<<) to the output stream.
 

Detailed Description

Macro Definition Documentation

◆ HPP_DEFINE_TIMECOUNTER

#define HPP_DEFINE_TIMECOUNTER (   name)     ::hpp::debug::TimeCounter _##name##_timecounter_(#name)

Define a new TimeCounter.

◆ HPP_DISPLAY_LAST_TIMECOUNTER

#define HPP_DISPLAY_LAST_TIMECOUNTER (   name)
Value:
do { \
using namespace hpp; \
using namespace ::hpp::debug; \
std::stringstream __ss; \
__ss << #name << " last: " << _##name##_timecounter_.last() << iendl; \
} while (0)
void write(char const *file, int line, char const *function, const std::string &data)
Definition debug.cc:160
Channel benchmark
Benchmark information.
Definition debug.hh:228
Definition debug.hh:45
Definition assertion.hh:45
Class to ease exception creation.
Definition exception-factory.hh:73

Print last elapsed time to the logs.

◆ HPP_DISPLAY_TIMECOUNTER

#define HPP_DISPLAY_TIMECOUNTER (   name)
Value:
do { \
using namespace hpp; \
using namespace ::hpp::debug; \
std::stringstream __ss; \
__ss << _##name##_timecounter_ << iendl; \
} while (0)

Print min, max and mean time of the time measurements.

◆ HPP_RESET_TIMECOUNTER

#define HPP_RESET_TIMECOUNTER (   name)    _##name##_timecounter_.reset();

Reset a TimeCounter.

◆ HPP_SCOPE_TIMECOUNTER

#define HPP_SCOPE_TIMECOUNTER (   name)
Value:
::hpp::debug::TimeCounter::Scope _##name##_scopetimecounter_( \
_##name##_timecounter_)
Definition timer.hh:97

Compute the time spent in the current scope.

◆ HPP_START_TIMECOUNTER

#define HPP_START_TIMECOUNTER (   name)    _##name##_timecounter_.start()

Start a watch.

◆ HPP_STOP_TIMECOUNTER

#define HPP_STOP_TIMECOUNTER (   name)    _##name##_timecounter_.stop()

Stop a watch and save elapsed time.

◆ HPP_STREAM_TIMECOUNTER

#define HPP_STREAM_TIMECOUNTER (   os,
  name 
)    os << _##name##_timecounter_

Stream (operator<<) to the output stream.

◆ hppDout

#define hppDout (   channel,
  data 
)
Value:
do { \
using namespace hpp; \
using namespace ::hpp::debug; \
if (isChannelEnabled(verbosityLevel::channel)) { \
std::stringstream __ss; \
__ss << data << iendl; \
logging.channel.write(__FILE__, __LINE__, __PRETTY_FUNCTION__, __ss); \
} \
} while (0)

Write data to channel when HPP_DEBUG is defined.

Parameters
channelone of error, warning, notice, info or benchmark.
dataa statement that can be << to a std::stringstream.

◆ hppDoutFatal

#define hppDoutFatal (   channel,
  data 
)
Value:
do { \
using namespace hpp; \
using namespace ::hpp::debug; \
std::stringstream __ss; \
__ss << data << iendl; \
logging.channel.write(__FILE__, __LINE__, __PRETTY_FUNCTION__, __ss); \
::std::exit(EXIT_FAILURE); \
} while (1)

Write data to channel and exit the program.

Parameters
channelone of error, warning, notice, info or benchmark.
dataa statement that can be << to a std::stringstream.