[mlpack-svn] r14954 - mlpack/trunk/src/mlpack/core/data

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Apr 24 17:58:11 EDT 2013


Author: rcurtin
Date: 2013-04-24 17:58:11 -0400 (Wed, 24 Apr 2013)
New Revision: 14954

Modified:
   mlpack/trunk/src/mlpack/core/data/load_impl.hpp
   mlpack/trunk/src/mlpack/core/data/save_impl.hpp
Log:
Stop timers if saving or loading fails.


Modified: mlpack/trunk/src/mlpack/core/data/load_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/data/load_impl.hpp	2013-04-24 21:56:29 UTC (rev 14953)
+++ mlpack/trunk/src/mlpack/core/data/load_impl.hpp	2013-04-24 21:58:11 UTC (rev 14954)
@@ -35,6 +35,7 @@
       Log::Warn << "Cannot determine type of file '" << filename << "'; "
           << "no extension is present.  Load failed." << std::endl;
 
+    Timer::Stop("loading_data");
     return false;
   }
 
@@ -55,6 +56,7 @@
       Log::Warn << "Cannot open file '" << filename << "'; load failed."
           << std::endl;
 
+    Timer::Stop("loading_data");
     return false;
   }
 
@@ -150,6 +152,7 @@
           << "Armadillo was compiled without HDF5 support.  Load failed."
           << std::endl;
 
+    Timer::Stop("loading_data");
     return false;
 #endif
   }
@@ -170,6 +173,7 @@
       Log::Warn << "Unable to detect type of '" << filename << "'; load failed."
           << " Incorrect extension?" << std::endl;
 
+    Timer::Stop("loading_data");
     return false;
   }
 
@@ -181,7 +185,7 @@
     Log::Info << "Loading '" << filename << "' as " << stringType << ".  "
         << std::flush;
 
-  bool success = matrix.load(stream, loadType);
+  const bool success = matrix.load(stream, loadType);
 
   if (!success)
   {

Modified: mlpack/trunk/src/mlpack/core/data/save_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/data/save_impl.hpp	2013-04-24 21:56:29 UTC (rev 14953)
+++ mlpack/trunk/src/mlpack/core/data/save_impl.hpp	2013-04-24 21:58:11 UTC (rev 14954)
@@ -51,6 +51,7 @@
       Log::Warn << "Cannot open file '" << filename << "' for writing; save "
           << "failed." << std::endl;
 
+    Timer::Stop("saving_data");
     return false;
   }
 
@@ -94,6 +95,7 @@
           << "Armadillo was compiled without HDF5 support.  Save failed."
           << std::endl;
 
+    Timer::Stop("saving_data");
     return false;
 #endif
   }
@@ -131,6 +133,7 @@
       else
         Log::Warn << "Save to '" << filename << "' failed." << std::endl;
 
+      Timer::Stop("saving_data");
       return false;
     }
   }
@@ -143,6 +146,7 @@
       else
         Log::Warn << "Save to '" << filename << "' failed." << std::endl;
 
+      Timer::Stop("saving_data");
       return false;
     }
   }




More information about the mlpack-svn mailing list