Refactor: remove once-used function, wrap lines.

This commit is contained in:
Ryan Curtin
2016-03-15 12:47:28 -07:00
parent 4551dd09d7
commit eac547a6c2
2 changed files with 6 additions and 10 deletions
+2 -7
View File
@@ -14,12 +14,6 @@
using namespace mlpack;
inline std::chrono::microseconds getTimeDuration(const std::chrono::high_resolution_clock::time_point start,
const std::chrono::high_resolution_clock::time_point end)
{
return std::chrono::duration_cast<std::chrono::microseconds>(end - start);
}
/**
* Start the given timer.
*/
@@ -166,5 +160,6 @@ void Timers::StopTimer(const std::string& timerName)
std::chrono::high_resolution_clock::time_point currTime = GetTime();
// Calculate the delta time.
timers[timerName] += getTimeDuration(timerStartTime[timerName], currTime);
timers[timerName] += std::chrono::duration_cast<std::chrono::microseconds>(
currTime - timerStartTime[timerName])
}
+4 -3
View File
@@ -110,18 +110,19 @@ class Timers
/**
* Returns state of the given timer.
*
*
* @param timerName The name of the timer in question.
*/
bool GetState(std::string timerName);
private:
//! A map of all the timers that are being tracked.
std::map<std::string, std::chrono::microseconds> timers;
//! A map that contains whether or not each timer is currently running.
std::map<std::string, bool> timerState;
//! A map for the starting values of the timers.
std::map<std::string, std::chrono::high_resolution_clock::time_point> timerStartTime;
std::map<std::string, std::chrono::high_resolution_clock::time_point>
timerStartTime;
std::chrono::high_resolution_clock::time_point GetTime();
};