\section{Timers Class Reference}
\label{classmlpack_1_1Timers}\index{Timers@{Timers}}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Timers} ()
\begin{DoxyCompactList}\small\item\em Default to disabled. \end{DoxyCompactList}\item 
std\+::atomic$<$ bool $>$ \& \textbf{ Enabled} ()
\begin{DoxyCompactList}\small\item\em Modify whether or not timing is enabled. \end{DoxyCompactList}\item 
bool \textbf{ Enabled} () const
\begin{DoxyCompactList}\small\item\em Get whether or not timing is enabled. \end{DoxyCompactList}\item 
std\+::map$<$ std\+::string, std\+::chrono\+::microseconds $>$ \textbf{ Get\+All\+Timers} ()
\begin{DoxyCompactList}\small\item\em Returns a copy of all the timers used via this interface. \end{DoxyCompactList}\item 
bool \textbf{ Get\+State} (const std\+::string \&timer\+Name, const std\+::thread\+::id \&thread\+Id=std\+::thread\+::id())
\begin{DoxyCompactList}\small\item\em Returns state of the given timer. \end{DoxyCompactList}\item 
std\+::chrono\+::microseconds \textbf{ Get\+Timer} (const std\+::string \&timer\+Name)
\begin{DoxyCompactList}\small\item\em Returns a copy of the timer specified. \end{DoxyCompactList}\item 
void \textbf{ Print\+Timer} (const std\+::string \&timer\+Name)
\begin{DoxyCompactList}\small\item\em Prints the specified timer. \end{DoxyCompactList}\item 
void \textbf{ Reset} ()
\begin{DoxyCompactList}\small\item\em Reset the timers. \end{DoxyCompactList}\item 
void \textbf{ Start\+Timer} (const std\+::string \&timer\+Name, const std\+::thread\+::id \&thread\+Id=std\+::thread\+::id())
\begin{DoxyCompactList}\small\item\em  $\ast$ Initializes a timer, available like a normal value specified on  $\ast$ the command line. \end{DoxyCompactList}\item 
void \textbf{ Stop\+All\+Timers} ()
\begin{DoxyCompactList}\small\item\em Stop all timers. \end{DoxyCompactList}\item 
void \textbf{ Stop\+Timer} (const std\+::string \&timer\+Name, const std\+::thread\+::id \&thread\+Id=std\+::thread\+::id())
\begin{DoxyCompactList}\small\item\em  $\ast$ Halts the timer, and replaces its value with the delta time from its start. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}


Definition at line 97 of file timers.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1Timers_add1af1e23f16430f39b982c0e8babe3f}} 
\index{mlpack\+::\+Timers@{mlpack\+::\+Timers}!Timers@{Timers}}
\index{Timers@{Timers}!mlpack\+::\+Timers@{mlpack\+::\+Timers}}
\subsubsection{Timers()}
{\footnotesize\ttfamily \textbf{ Timers} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Default to disabled. 



Definition at line 101 of file timers.\+hpp.



\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1Timers_aa3cc415a3ec6ca7701bbe063fb2d0bd7}} 
\index{mlpack\+::\+Timers@{mlpack\+::\+Timers}!Enabled@{Enabled}}
\index{Enabled@{Enabled}!mlpack\+::\+Timers@{mlpack\+::\+Timers}}
\subsubsection{Enabled()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily std\+::atomic$<$bool$>$\& Enabled (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify whether or not timing is enabled. 



Definition at line 166 of file timers.\+hpp.

\mbox{\label{classmlpack_1_1Timers_a93235b4e93d1b61b95fba2db144145f6}} 
\index{mlpack\+::\+Timers@{mlpack\+::\+Timers}!Enabled@{Enabled}}
\index{Enabled@{Enabled}!mlpack\+::\+Timers@{mlpack\+::\+Timers}}
\subsubsection{Enabled()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily bool Enabled (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get whether or not timing is enabled. 



Definition at line 168 of file timers.\+hpp.

\mbox{\label{classmlpack_1_1Timers_a9d077721f6811724906de9eb5d50857d}} 
\index{mlpack\+::\+Timers@{mlpack\+::\+Timers}!Get\+All\+Timers@{Get\+All\+Timers}}
\index{Get\+All\+Timers@{Get\+All\+Timers}!mlpack\+::\+Timers@{mlpack\+::\+Timers}}
\subsubsection{Get\+All\+Timers()}
{\footnotesize\ttfamily std\+::map$<$std\+::string, std\+::chrono\+::microseconds$>$ Get\+All\+Timers (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a copy of all the timers used via this interface. 



Referenced by mlpack\+::bindings\+::cli\+::\+End\+Program().

\mbox{\label{classmlpack_1_1Timers_abee29197294057d68793ee6cbd6eb64e}} 
\index{mlpack\+::\+Timers@{mlpack\+::\+Timers}!Get\+State@{Get\+State}}
\index{Get\+State@{Get\+State}!mlpack\+::\+Timers@{mlpack\+::\+Timers}}
\subsubsection{Get\+State()}
{\footnotesize\ttfamily bool Get\+State (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{timer\+Name,  }\item[{const std\+::thread\+::id \&}]{thread\+Id = {\ttfamily std\+:\+:thread\+:\+:id()} }\end{DoxyParamCaption})}



Returns state of the given timer. 


\begin{DoxyParams}{Parameters}
{\em timer\+Name} & The name of the timer in question. \\
\hline
{\em thread\+Id} & Id of the thread accessing the timer. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1Timers_aebb641bd9122477aa9a61e72b373e8cf}} 
\index{mlpack\+::\+Timers@{mlpack\+::\+Timers}!Get\+Timer@{Get\+Timer}}
\index{Get\+Timer@{Get\+Timer}!mlpack\+::\+Timers@{mlpack\+::\+Timers}}
\subsubsection{Get\+Timer()}
{\footnotesize\ttfamily std\+::chrono\+::microseconds Get\+Timer (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{timer\+Name }\end{DoxyParamCaption})}



Returns a copy of the timer specified. 

This contains the sum of the timing results for timers that have been stopped with this name.


\begin{DoxyParams}{Parameters}
{\em timer\+Name} & The name of the timer in question. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1Timers_add57a3f90480a934a9791e95cf587784}} 
\index{mlpack\+::\+Timers@{mlpack\+::\+Timers}!Print\+Timer@{Print\+Timer}}
\index{Print\+Timer@{Print\+Timer}!mlpack\+::\+Timers@{mlpack\+::\+Timers}}
\subsubsection{Print\+Timer()}
{\footnotesize\ttfamily void Print\+Timer (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{timer\+Name }\end{DoxyParamCaption})}



Prints the specified timer. 

If it took longer than a minute to complete the timer will be displayed in days, hours, and minutes as well.


\begin{DoxyParams}{Parameters}
{\em timer\+Name} & The name of the timer in question. \\
\hline
\end{DoxyParams}


Referenced by mlpack\+::bindings\+::cli\+::\+End\+Program().

\mbox{\label{classmlpack_1_1Timers_a372de693ad40b3f42839c8ec6ac845f4}} 
\index{mlpack\+::\+Timers@{mlpack\+::\+Timers}!Reset@{Reset}}
\index{Reset@{Reset}!mlpack\+::\+Timers@{mlpack\+::\+Timers}}
\subsubsection{Reset()}
{\footnotesize\ttfamily void Reset (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Reset the timers. 

This stops all running timers and removes them. Whether or not timing is enabled will not be changed. 

Referenced by mlpack\+::util\+::\+Reset\+Timers().

\mbox{\label{classmlpack_1_1Timers_aecdbec86306efca51ab08ac2a42bbbf5}} 
\index{mlpack\+::\+Timers@{mlpack\+::\+Timers}!Start\+Timer@{Start\+Timer}}
\index{Start\+Timer@{Start\+Timer}!mlpack\+::\+Timers@{mlpack\+::\+Timers}}
\subsubsection{Start\+Timer()}
{\footnotesize\ttfamily void Start\+Timer (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{timer\+Name,  }\item[{const std\+::thread\+::id \&}]{thread\+Id = {\ttfamily std\+:\+:thread\+:\+:id()} }\end{DoxyParamCaption})}



 $\ast$ Initializes a timer, available like a normal value specified on  $\ast$ the command line. 

  \doxyref{Timers}{p.}{classmlpack_1_1Timers} are of type timeval. If a timer is started, then stopped, then re-\/started, then stopped, the final timer value will be the length of both runs of the timer.  $\ast$  $\ast$ 
\begin{DoxyParams}{Parameters}
{\em timer\+Name} & The name of the timer in question. \\
\hline
{\em thread\+Id} & Id of the thread accessing the timer.   \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1Timers_a48757b28836456b14aa2f1c31dacbd71}} 
\index{mlpack\+::\+Timers@{mlpack\+::\+Timers}!Stop\+All\+Timers@{Stop\+All\+Timers}}
\index{Stop\+All\+Timers@{Stop\+All\+Timers}!mlpack\+::\+Timers@{mlpack\+::\+Timers}}
\subsubsection{Stop\+All\+Timers()}
{\footnotesize\ttfamily void Stop\+All\+Timers (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Stop all timers. 



Referenced by mlpack\+::bindings\+::cli\+::\+End\+Program().

\mbox{\label{classmlpack_1_1Timers_a7a63f768cade147188d0198906624309}} 
\index{mlpack\+::\+Timers@{mlpack\+::\+Timers}!Stop\+Timer@{Stop\+Timer}}
\index{Stop\+Timer@{Stop\+Timer}!mlpack\+::\+Timers@{mlpack\+::\+Timers}}
\subsubsection{Stop\+Timer()}
{\footnotesize\ttfamily void Stop\+Timer (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{timer\+Name,  }\item[{const std\+::thread\+::id \&}]{thread\+Id = {\ttfamily std\+:\+:thread\+:\+:id()} }\end{DoxyParamCaption})}



 $\ast$ Halts the timer, and replaces its value with the delta time from its start. 

  $\ast$   $\ast$ 
\begin{DoxyParams}{Parameters}
{\em timer\+Name} & The name of the timer in question. \\
\hline
{\em thread\+Id} & Id of the thread accessing the timer.   \\
\hline
\end{DoxyParams}


The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/var/www/mlpack.\+ratml.\+org/mlpack.\+org/\+\_\+src/mlpack-\/3.\+3.\+1/src/mlpack/core/util/\textbf{ timers.\+hpp}\end{DoxyCompactItemize}
