\hypertarget{classeo_timer_stat}{}\doxysection{eo\+Timer\+Stat Class Reference}
\label{classeo_timer_stat}\index{eoTimerStat@{eoTimerStat}}


Registers a group of statistics, each statistic corresponding to user, system and wallclock times distribution.  




{\ttfamily \#include $<$eo\+Timer.\+h$>$}



Inheritance diagram for eo\+Timer\+Stat\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=190pt]{classeo_timer_stat__inherit__graph}
\end{center}
\end{figure}


Collaboration diagram for eo\+Timer\+Stat\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=190pt]{classeo_timer_stat__coll__graph}
\end{center}
\end{figure}
\doxysubsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \mbox{\hyperlink{structeo_timer_stat_1_1_stat}{Stat}}
\begin{DoxyCompactList}\small\item\em Statistic related to a key (name). \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classeo_timer_stat_ae73280f1833b0a8651180ea50cad6aa4}\label{classeo_timer_stat_ae73280f1833b0a8651180ea50cad6aa4}} 
\mbox{\hyperlink{classeo_timer_stat_ae73280f1833b0a8651180ea50cad6aa4}{eo\+Timer\+Stat}} ()
\begin{DoxyCompactList}\small\item\em Initializes a timer stat object. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classeo_timer_stat_afeb4005bfdd63b991b7b718913fae239}{unpack}} (const \mbox{\hyperlink{classeoserial_1_1_object}{eoserial\+::\+Object}} $\ast$obj)
\begin{DoxyCompactList}\small\item\em Loads class fields from a J\+S\+ON object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classeoserial_1_1_object}{eoserial\+::\+Object}} $\ast$ \mbox{\hyperlink{classeo_timer_stat_a738d73c9f410614b480d647c4c842279}{pack}} (void) const
\begin{DoxyCompactList}\small\item\em Serializes the object to J\+S\+ON format. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classeo_timer_stat_aa2333db481e4b56687cfe39d0c1de083}\label{classeo_timer_stat_aa2333db481e4b56687cfe39d0c1de083}} 
void \mbox{\hyperlink{classeo_timer_stat_aa2333db481e4b56687cfe39d0c1de083}{force\+Do\+Measure}} ()
\begin{DoxyCompactList}\small\item\em Forces the measures to be retrieved. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classeo_timer_stat_a2344cb888b67cab3f61ef22ff3cc8473}{start}} (const std\+::string \&key)
\begin{DoxyCompactList}\small\item\em Starts a new measure for the given key. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classeo_timer_stat_a49bd0fb10af6e115fe1c505702bafc98}{stop}} (const std\+::string \&key)
\begin{DoxyCompactList}\small\item\em Stops the mesure for the given key and saves the elapsed times. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classeo_timer_stat_a743413fdaa405e3d0e2352cb77f077cb}\label{classeo_timer_stat_a743413fdaa405e3d0e2352cb77f077cb}} 
std\+::map$<$ std\+::string, \mbox{\hyperlink{structeo_timer_stat_1_1_stat}{Stat}} $>$ \& \mbox{\hyperlink{classeo_timer_stat_a743413fdaa405e3d0e2352cb77f077cb}{stats}} ()
\begin{DoxyCompactList}\small\item\em Getter for the statistics map. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classeo_timer_stat_a5b3412622d4a03bd6c67a4ff998ad02c}\label{classeo_timer_stat_a5b3412622d4a03bd6c67a4ff998ad02c}} 
void \mbox{\hyperlink{classeo_timer_stat_a5b3412622d4a03bd6c67a4ff998ad02c}{clear}} ()
\begin{DoxyCompactList}\small\item\em Empties the statistics map. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classeo_timer_stat_af854218e843aeda2a7edeb88ac6577ee}\label{classeo_timer_stat_af854218e843aeda2a7edeb88ac6577ee}} 
std\+::map$<$ std\+::string, \mbox{\hyperlink{structeo_timer_stat_1_1_stat}{Stat}} $>$ {\bfseries \+\_\+stats}
\item 
\mbox{\Hypertarget{classeo_timer_stat_a7f70e26b045dd341904d35b027758ae0}\label{classeo_timer_stat_a7f70e26b045dd341904d35b027758ae0}} 
std\+::map$<$ std\+::string, \mbox{\hyperlink{classeo_timer}{eo\+Timer}} $>$ {\bfseries \+\_\+timers}
\item 
\mbox{\Hypertarget{classeo_timer_stat_a95624d7138c7599a6f606fcb599eb2e6}\label{classeo_timer_stat_a95624d7138c7599a6f606fcb599eb2e6}} 
bool {\bfseries \+\_\+force\+Do\+Measure}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Registers a group of statistics, each statistic corresponding to user, system and wallclock times distribution. 

This class helps the user to measure time in different parts of an application. A name is associated to a statistic, on each call to \mbox{\hyperlink{classeo_timer_stat_a2344cb888b67cab3f61ef22ff3cc8473}{start()}} and \mbox{\hyperlink{classeo_timer_stat_a49bd0fb10af6e115fe1c505702bafc98}{stop()}} for this name, a new number is added to the statistic, for each of the three measured times.

The statistics are only registered if the option \char`\"{}-\/-\/parallelized-\/do-\/measure\char`\"{} is set to true, which can be checked thanks to global object eo\+::parallel.

This shows how the \mbox{\hyperlink{classeo_timer_stat}{eo\+Timer\+Stat}} can be used \+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{classeo_timer_stat}{eoTimerStat}} \mbox{\hyperlink{namespaceeo_1_1mpi_a4901bcdfc2aaf35b70c4fe172bc04a49}{timerStat}};}
\DoxyCodeLine{\mbox{\hyperlink{namespaceeo_1_1mpi_a4901bcdfc2aaf35b70c4fe172bc04a49}{timerStat}}.\mbox{\hyperlink{classeo_timer_stat_a2344cb888b67cab3f61ef22ff3cc8473}{start}}(\textcolor{stringliteral}{"first\_point"});}
\DoxyCodeLine{\textcolor{keywordflow}{for}( \textcolor{keywordtype}{int} i = 0; i < 1000; ++i )}
\DoxyCodeLine{\{}
\DoxyCodeLine{  \mbox{\hyperlink{namespaceeo_1_1mpi_a4901bcdfc2aaf35b70c4fe172bc04a49}{timerStat}}.\mbox{\hyperlink{classeo_timer_stat_a2344cb888b67cab3f61ef22ff3cc8473}{start}}(\textcolor{stringliteral}{"single\_computation"});}
\DoxyCodeLine{  single\_computation( i );}
\DoxyCodeLine{  \mbox{\hyperlink{namespaceeo_1_1mpi_a4901bcdfc2aaf35b70c4fe172bc04a49}{timerStat}}.\mbox{\hyperlink{classeo_timer_stat_a49bd0fb10af6e115fe1c505702bafc98}{stop}}(\textcolor{stringliteral}{"single\_computation"});}
\DoxyCodeLine{\}}
\DoxyCodeLine{\textcolor{comment}{// After this loop, timerStat contains a statistic of key "single\_computation" which contains 1000 measures for}}
\DoxyCodeLine{\textcolor{comment}{// each type of time.}}
\DoxyCodeLine{\mbox{\hyperlink{namespaceeo_1_1mpi_a4901bcdfc2aaf35b70c4fe172bc04a49}{timerStat}}.\mbox{\hyperlink{classeo_timer_stat_a49bd0fb10af6e115fe1c505702bafc98}{stop}}(\textcolor{stringliteral}{"first\_point"});}
\DoxyCodeLine{\textcolor{comment}{// After this line, timerStat contains another statistic of key "first\_point" which counted the duration of the}}
\DoxyCodeLine{\textcolor{comment}{// whole loop.}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int} singleComputationUsertimeMean = 0;}
\DoxyCodeLine{\textcolor{keywordflow}{for}( \textcolor{keywordtype}{int} i = 0; i < 1000; ++i )}
\DoxyCodeLine{\{}
\DoxyCodeLine{     singleComputationUsertimeMean += \mbox{\hyperlink{namespaceeo_1_1mpi_a4901bcdfc2aaf35b70c4fe172bc04a49}{timerStat}}.\mbox{\hyperlink{classeo_timer_stat_a743413fdaa405e3d0e2352cb77f077cb}{stats}}()[\textcolor{stringliteral}{"single\_computation"}].utime[i];}
\DoxyCodeLine{\}}
\DoxyCodeLine{std::cout << \textcolor{stringliteral}{"Mean of user time spent in single computation: "} << singleComputationUsertimeMean / 1000. << std::endl;}
\end{DoxyCode}


When using M\+PI, these statistics can be readily be serialized, so as to be sent over a network, for instance.

Implementation details\+: this \mbox{\hyperlink{classeo_timer_stat}{eo\+Timer\+Stat}} is in fact a map of strings (key) / \mbox{\hyperlink{structeo_timer_stat_1_1_stat}{Stat}} (value). \mbox{\hyperlink{structeo_timer_stat_1_1_stat}{Stat}} is an internal structure directly defined in the class, which contains three vectors modeling the distributions of the different types of elapsed times. Another map of strings (key) / \mbox{\hyperlink{classeo_timer}{eo\+Timer}} (value) allows to effectively retrieve the different times. The struct \mbox{\hyperlink{structeo_timer_stat_1_1_stat}{Stat}} will be exposed to client, which will use its members ; however, the client doesn\textquotesingle{}t have anything to do directly with the timer, that\textquotesingle{}s why the two maps are splitted. 

\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classeo_timer_stat_a738d73c9f410614b480d647c4c842279}\label{classeo_timer_stat_a738d73c9f410614b480d647c4c842279}} 
\index{eoTimerStat@{eoTimerStat}!pack@{pack}}
\index{pack@{pack}!eoTimerStat@{eoTimerStat}}
\doxysubsubsection{\texorpdfstring{pack()}{pack()}}
{\footnotesize\ttfamily \mbox{\hyperlink{classeoserial_1_1_object}{eoserial\+::\+Object}}$\ast$ eo\+Timer\+Stat\+::pack (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}



Serializes the object to J\+S\+ON format. 

\begin{DoxyReturn}{Returns}
A J\+S\+ON object created with new. 
\end{DoxyReturn}


Implements \mbox{\hyperlink{classeoserial_1_1_printable_aad91bc7e395362d2d3818fd41b267121}{eoserial\+::\+Printable}}.

\mbox{\Hypertarget{classeo_timer_stat_a2344cb888b67cab3f61ef22ff3cc8473}\label{classeo_timer_stat_a2344cb888b67cab3f61ef22ff3cc8473}} 
\index{eoTimerStat@{eoTimerStat}!start@{start}}
\index{start@{start}!eoTimerStat@{eoTimerStat}}
\doxysubsubsection{\texorpdfstring{start()}{start()}}
{\footnotesize\ttfamily void eo\+Timer\+Stat\+::start (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{key }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Starts a new measure for the given key. 

This is only performed if parallel.\+do\+Measure() is true, which is equivalent to the fact that parser found \char`\"{}-\/-\/parallel-\/do-\/measure=1\char`\"{} in command line args.


\begin{DoxyParams}{Parameters}
{\em key} & The key of the statistic. \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classeo_timer_stat_a49bd0fb10af6e115fe1c505702bafc98}\label{classeo_timer_stat_a49bd0fb10af6e115fe1c505702bafc98}} 
\index{eoTimerStat@{eoTimerStat}!stop@{stop}}
\index{stop@{stop}!eoTimerStat@{eoTimerStat}}
\doxysubsubsection{\texorpdfstring{stop()}{stop()}}
{\footnotesize\ttfamily void eo\+Timer\+Stat\+::stop (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{key }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Stops the mesure for the given key and saves the elapsed times. 

Must follow a call of start with the same key.

This is only performed if parallel.\+do\+Measure() is true, which is equivalent to the fact that parser found \char`\"{}-\/-\/parallel-\/do-\/measure=1\char`\"{} in command line args.


\begin{DoxyParams}{Parameters}
{\em key} & The key of the statistic. \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classeo_timer_stat_afeb4005bfdd63b991b7b718913fae239}\label{classeo_timer_stat_afeb4005bfdd63b991b7b718913fae239}} 
\index{eoTimerStat@{eoTimerStat}!unpack@{unpack}}
\index{unpack@{unpack}!eoTimerStat@{eoTimerStat}}
\doxysubsubsection{\texorpdfstring{unpack()}{unpack()}}
{\footnotesize\ttfamily void eo\+Timer\+Stat\+::unpack (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classeoserial_1_1_object}{eoserial\+::\+Object}} $\ast$}]{json }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}



Loads class fields from a J\+S\+ON object. 


\begin{DoxyParams}{Parameters}
{\em json} & A J\+S\+ON object. Programmer doesn\textquotesingle{}t have to delete it, it is automatically done. \\
\hline
\end{DoxyParams}


Implements \mbox{\hyperlink{classeoserial_1_1_persistent_a366ffa79c94271940f6fbe9233141112}{eoserial\+::\+Persistent}}.



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
eo/src/utils/eo\+Timer.\+h\end{DoxyCompactItemize}
