[mlpack-git] master: Terminate the program timers. (ca5ba7c)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Wed Dec 2 15:40:20 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/abd5fdc7f7ce73f10e983fac3749505bd67871d6...924425c35ddbf8c7c8c830ee8a67595909ed380e

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

commit ca5ba7c17b888614ed5f2b107d40959723ac71a0
Author: Grzegorz Krajewski <krajekg at gmail.com>
Date:   Wed Dec 2 20:53:35 2015 +0100

    Terminate the program timers.
    
    CLI Destructor terminates the program timers even if function inside of program wasn't called.


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

ca5ba7c17b888614ed5f2b107d40959723ac71a0
 src/mlpack/core/util/cli.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/core/util/cli.cpp b/src/mlpack/core/util/cli.cpp
index 572f829..4813960 100644
--- a/src/mlpack/core/util/cli.cpp
+++ b/src/mlpack/core/util/cli.cpp
@@ -54,8 +54,15 @@ CLI::CLI(const CLI& other) : desc(other.desc),
 
 CLI::~CLI()
 {
-  // Terminate the program timer.
-  Timer::Stop("total_time");
+  // Terminate the program timers.
+  std::map<std::string, timeval>::iterator it;
+  for (it = timer.GetAllTimers().begin(); it != timer.GetAllTimers().end();
+       ++it)
+  {
+    std::string i = (*it).first;
+    if(timer.GetState(i) == 1)
+      Timer::Stop(i);
+  }
   
   // Did the user ask for verbose output?  If so we need to print everything.
   // But only if the user did not ask for help or info.



More information about the mlpack-git mailing list