Timer: no log output if verbosity parameter is 0

This commit is contained in:
Matthias Huck 2014-12-04 19:14:11 +00:00
parent 0f9e8aec91
commit ad243f3500

View File

@ -2,6 +2,7 @@
#include <iomanip>
#include "Util.h"
#include "Timer.h"
#include "StaticData.h"
#include "util/usage.hh"
@ -30,7 +31,7 @@ double Timer::get_elapsed_time() const
void Timer::start(const char* msg)
{
// Print an optional message, something like "Starting timer t";
if (msg) TRACE_ERR( msg << std::endl);
if (msg) VERBOSE(1, msg << std::endl);
// Return immediately if the timer is already running
if (running && !stopped) return;
@ -53,7 +54,7 @@ void Timer::start(const char* msg)
void Timer::stop(const char* msg)
{
// Print an optional message, something like "Stopping timer t";
if (msg) TRACE_ERR( msg << std::endl);
if (msg) VERBOSE(1, msg << std::endl);
// Return immediately if the timer is not running
if (stopped || !running) return;
@ -71,10 +72,10 @@ void Timer::stop(const char* msg)
void Timer::check(const char* msg)
{
// Print an optional message, something like "Checking timer t";
if (msg) TRACE_ERR( msg << " : ");
if (msg) VERBOSE(1, msg << " : ");
// TRACE_ERR( "[" << std::setiosflags(std::ios::fixed) << std::setprecision(2) << (running ? elapsed_time() : 0) << "] seconds\n");
TRACE_ERR( "[" << (running ? get_elapsed_time() : 0) << "] seconds\n");
// VERBOSE(1, "[" << std::setiosflags(std::ios::fixed) << std::setprecision(2) << (running ? elapsed_time() : 0) << "] seconds\n");
VERBOSE(1, "[" << (running ? get_elapsed_time() : 0) << "] seconds\n");
}
/***