mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 05:55:02 +03:00
Prefix private members with "m_".
This commit is contained in:
parent
ff5ae511b1
commit
c62365b419
@ -5,7 +5,7 @@ double Timer::elapsed_time()
|
|||||||
{
|
{
|
||||||
time_t now;
|
time_t now;
|
||||||
time(&now);
|
time(&now);
|
||||||
return difftime(now, start_time);
|
return difftime(now, m_start_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
double Timer::get_elapsed_time()
|
double Timer::get_elapsed_time()
|
||||||
@ -19,13 +19,13 @@ void Timer::start(const char* msg)
|
|||||||
if (msg) TRACE_ERR( msg << std::endl);
|
if (msg) TRACE_ERR( msg << std::endl);
|
||||||
|
|
||||||
// Return immediately if the timer is already running
|
// Return immediately if the timer is already running
|
||||||
if (running) return;
|
if (m_is_running) return;
|
||||||
|
|
||||||
// Change timer status to running
|
// Change timer status to running
|
||||||
running = true;
|
m_is_running = true;
|
||||||
|
|
||||||
// Set the start time;
|
// Set the start time;
|
||||||
time(&start_time);
|
time(&m_start_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@ -69,5 +69,5 @@ void Timer::check(const char* msg)
|
|||||||
if (msg) TRACE_ERR( msg << " : ");
|
if (msg) TRACE_ERR( msg << " : ");
|
||||||
|
|
||||||
// TRACE_ERR( "[" << std::setiosflags(std::ios::fixed) << std::setprecision(2) << (running ? elapsed_time() : 0) << "] seconds\n");
|
// TRACE_ERR( "[" << std::setiosflags(std::ios::fixed) << std::setprecision(2) << (running ? elapsed_time() : 0) << "] seconds\n");
|
||||||
TRACE_ERR( "[" << (running ? elapsed_time() : 0) << "] seconds\n");
|
TRACE_ERR( "[" << (m_is_running ? elapsed_time() : 0) << "] seconds\n");
|
||||||
}
|
}
|
||||||
|
10
mert/Timer.h
10
mert/Timer.h
@ -15,8 +15,8 @@ class Timer
|
|||||||
friend std::ostream& operator<<(std::ostream& os, Timer& t);
|
friend std::ostream& operator<<(std::ostream& os, Timer& t);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool running;
|
bool m_is_running;
|
||||||
time_t start_time;
|
time_t m_start_time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the total time that the timer has been in the "running"
|
* Return the total time that the timer has been in the "running"
|
||||||
@ -29,10 +29,10 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* 'running' is initially false. A timer needs to be explicitly started
|
* 'm_is_running' is initially false. A timer needs to be explicitly started
|
||||||
* using 'start' or 'restart'.
|
* using 'start' or 'restart'.
|
||||||
*/
|
*/
|
||||||
Timer() : running(false), start_time(0) { }
|
Timer() : m_is_running(false), m_start_time(0) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a timer. If it is already running, let it continue running.
|
* Start a timer. If it is already running, let it continue running.
|
||||||
@ -60,7 +60,7 @@ public:
|
|||||||
inline std::ostream& operator<<(std::ostream& os, Timer& t)
|
inline std::ostream& operator<<(std::ostream& os, Timer& t)
|
||||||
{
|
{
|
||||||
//os << std::setprecision(2) << std::setiosflags(std::ios::fixed) << (t.running ? t.elapsed_time() : 0);
|
//os << std::setprecision(2) << std::setiosflags(std::ios::fixed) << (t.running ? t.elapsed_time() : 0);
|
||||||
os << (t.running ? t.elapsed_time() : 0);
|
os << (t.m_is_running ? t.elapsed_time() : 0);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user