Reset timers every time a binding is started.

This commit is contained in:
Ryan Curtin
2017-09-08 10:05:21 -04:00
parent 7be0c797ad
commit d5fa9f1062
2 changed files with 12 additions and 2 deletions
@@ -108,6 +108,15 @@ inline void DisableBacktrace()
Log::Fatal.backtrace = false;
}
/**
* Reset the status of all timers.
*/
inline void ResetTimers()
{
// Just get a new object---removes all old timers.
CLI::GetSingleton().timer = Timers();
}
} // namespace util
} // namespace mlpack
+3 -2
View File
@@ -72,7 +72,7 @@ void PrintPYX(const ProgramDoc& programInfo,
cout << "cimport arma_numpy" << endl;
cout << "from cli cimport CLI" << endl;
cout << "from cli cimport SetParam, SetParamWithInfo" << endl;
cout << "from cli cimport EnableVerbose, DisableBacktrace"
cout << "from cli cimport EnableVerbose, DisableBacktrace, ResetTimers"
<< endl;
cout << "from cli cimport MoveFromPtr, MoveToPtr" << endl;
cout << "from matrix_utils import to_matrix, to_matrix_with_info" << endl;
@@ -169,7 +169,8 @@ void PrintPYX(const ProgramDoc& programInfo,
<< "returned." << endl;
cout << " \"\"\"" << endl;
// Disable backtraces.
// Reset any timers and disable backtraces.
cout << " ResetTimers()" << endl;
cout << " DisableBacktrace()" << endl;
// Restore the parameters.