[mlpack-git] master: Refactor: remove once-used function, wrap lines. (eac547a)

gitdub at mlpack.org gitdub at mlpack.org
Tue Mar 15 15:47:28 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/386138b3172e0485aced365cb31e4f5b13c3bd7d...086a75de129a97ff575c555630084c583b8ae15c

>---------------------------------------------------------------

commit eac547a6c25a959b780cfd78cd8bee2ae03d08d1
Author: Ryan Curtin <ryan at ratml.org>
Date:   Mon Mar 14 13:43:56 2016 -0700

    Refactor: remove once-used function, wrap lines.


>---------------------------------------------------------------

eac547a6c25a959b780cfd78cd8bee2ae03d08d1
 src/mlpack/core/util/timers.cpp | 9 ++-------
 src/mlpack/core/util/timers.hpp | 3 ++-
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/mlpack/core/util/timers.cpp b/src/mlpack/core/util/timers.cpp
index 25a8fc4..fa0fd60 100644
--- a/src/mlpack/core/util/timers.cpp
+++ b/src/mlpack/core/util/timers.cpp
@@ -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])
 }
diff --git a/src/mlpack/core/util/timers.hpp b/src/mlpack/core/util/timers.hpp
index 205549c..2f1c2bf 100644
--- a/src/mlpack/core/util/timers.hpp
+++ b/src/mlpack/core/util/timers.hpp
@@ -121,7 +121,8 @@ class 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();
 };




More information about the mlpack-git mailing list