\hypertarget{classnntrainer_1_1profile_1_1Profiler}{}\doxysection{nntrainer\+::profile\+::Profiler Class Reference}
\label{classnntrainer_1_1profile_1_1Profiler}\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}


\mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}} object.  




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

\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler_a840abfac81cfd20da9eabccd9bed6ef6}{Profiler}} ()
\begin{DoxyCompactList}\small\item\em Construct a new \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}} object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler_add31544ae384bb6572ec9cefed438bc9}{Profiler}} (const \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}} \&)=delete
\begin{DoxyCompactList}\small\item\em Deleted constructor. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_a81462b5fc17149f05e2a88dc6d82dd8a}\label{classnntrainer_1_1profile_1_1Profiler_a81462b5fc17149f05e2a88dc6d82dd8a}} 
\mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}} \& {\bfseries operator=} (const \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}} \&)=delete
\item 
void \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler_a041c62345fee7b0604f796c11948735f}{start}} (const int time\+\_\+item)
\begin{DoxyCompactList}\small\item\em start time profile \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler_a588e2d3debc628e707c98e579af5d306}{end}} (const int time\+\_\+item)
\begin{DoxyCompactList}\small\item\em end time profile and notify to the listeners \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler_ac5917986613cafc1e74dd4ff279565ba}{alloc}} (const void $\ast$ptr, size\+\_\+t size, const std\+::string \&str, const std\+::string \&policy=\char`\"{}\char`\"{}, bool swap=false)
\begin{DoxyCompactList}\small\item\em trace memory allocation \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler_a8e49bf15427fc57e8bfc0133f3f28824}{dealloc}} (const void $\ast$ptr, const std\+::string \&policy=\char`\"{}\char`\"{}, bool swap=false)
\begin{DoxyCompactList}\small\item\em trace memory de-\/allocation \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler_a169caa291e9e10c64b855fc264cf55e2}{annotate}} (const std\+::string \&str)
\begin{DoxyCompactList}\small\item\em add annotation on memory profile data \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler_a9b965c0143497bf1abfd1c5b6e33d24d}{subscribe}} (std\+::shared\+\_\+ptr$<$ \mbox{\hyperlink{classnntrainer_1_1profile_1_1ProfileListener}{Profile\+Listener}} $>$ listener, const std\+::set$<$ int $>$ \&time\+\_\+item=\{\})
\begin{DoxyCompactList}\small\item\em subscribe a listener to the profiler \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler_a980dbbf00dbdc7e7b538b38a15b55dad}{unsubscribe}} (std\+::shared\+\_\+ptr$<$ \mbox{\hyperlink{classnntrainer_1_1profile_1_1ProfileListener}{Profile\+Listener}} $>$ listener)
\begin{DoxyCompactList}\small\item\em unsubscribe a listener from the profiler \end{DoxyCompactList}\item 
int \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler_a9032518e7e2b6c451b7b4652c305b9a5}{register\+Time\+Item}} (const std\+::string \&name)
\begin{DoxyCompactList}\small\item\em register\+Event to record. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}} \& \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler_adfef40f829cb8e694e3a5aafd31ec226}{Global}} ()
\begin{DoxyCompactList}\small\item\em Get Global \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}}. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
\mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}} object. 



Definition at line 309 of file profiler.\+h.



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_a840abfac81cfd20da9eabccd9bed6ef6}\label{classnntrainer_1_1profile_1_1Profiler_a840abfac81cfd20da9eabccd9bed6ef6}} 
\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}!Profiler@{Profiler}}
\index{Profiler@{Profiler}!nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}
\doxysubsubsection{\texorpdfstring{Profiler()}{Profiler()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily nntrainer\+::profile\+::\+Profiler\+::\+Profiler (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Construct a new \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}} object. 



Definition at line 315 of file profiler.\+h.

\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_add31544ae384bb6572ec9cefed438bc9}\label{classnntrainer_1_1profile_1_1Profiler_add31544ae384bb6572ec9cefed438bc9}} 
\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}!Profiler@{Profiler}}
\index{Profiler@{Profiler}!nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}
\doxysubsubsection{\texorpdfstring{Profiler()}{Profiler()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily nntrainer\+::profile\+::\+Profiler\+::\+Profiler (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}} \&}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [delete]}}



Deleted constructor. 



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_ac5917986613cafc1e74dd4ff279565ba}\label{classnntrainer_1_1profile_1_1Profiler_ac5917986613cafc1e74dd4ff279565ba}} 
\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}!alloc@{alloc}}
\index{alloc@{alloc}!nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}
\doxysubsubsection{\texorpdfstring{alloc()}{alloc()}}
{\footnotesize\ttfamily void nntrainer\+::profile\+::\+Profiler\+::alloc (\begin{DoxyParamCaption}\item[{const void $\ast$}]{ptr,  }\item[{size\+\_\+t}]{size,  }\item[{const std\+::string \&}]{str,  }\item[{const std\+::string \&}]{policy = {\ttfamily \char`\"{}\char`\"{}},  }\item[{bool}]{swap = {\ttfamily false} }\end{DoxyParamCaption})}



trace memory allocation 


\begin{DoxyParams}{Parameters}
{\em ptr} & allocated memory pointer \\
\hline
{\em size} & amount of allocated memory \\
\hline
{\em str} & information string \\
\hline
\end{DoxyParams}


Definition at line 355 of file profiler.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_a169caa291e9e10c64b855fc264cf55e2}\label{classnntrainer_1_1profile_1_1Profiler_a169caa291e9e10c64b855fc264cf55e2}} 
\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}!annotate@{annotate}}
\index{annotate@{annotate}!nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}
\doxysubsubsection{\texorpdfstring{annotate()}{annotate()}}
{\footnotesize\ttfamily void nntrainer\+::profile\+::\+Profiler\+::annotate (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{str }\end{DoxyParamCaption})}



add annotation on memory profile data 


\begin{DoxyParams}{Parameters}
{\em str} & annotate message \\
\hline
\end{DoxyParams}


Definition at line 400 of file profiler.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_a8e49bf15427fc57e8bfc0133f3f28824}\label{classnntrainer_1_1profile_1_1Profiler_a8e49bf15427fc57e8bfc0133f3f28824}} 
\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}!dealloc@{dealloc}}
\index{dealloc@{dealloc}!nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}
\doxysubsubsection{\texorpdfstring{dealloc()}{dealloc()}}
{\footnotesize\ttfamily void nntrainer\+::profile\+::\+Profiler\+::dealloc (\begin{DoxyParamCaption}\item[{const void $\ast$}]{ptr,  }\item[{const std\+::string \&}]{policy = {\ttfamily \char`\"{}\char`\"{}},  }\item[{bool}]{swap = {\ttfamily false} }\end{DoxyParamCaption})}



trace memory de-\/allocation 


\begin{DoxyParams}{Parameters}
{\em ptr} & de-\/allocated memory pointer \\
\hline
\end{DoxyParams}


Definition at line 376 of file profiler.\+cpp.

Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1profile_1_1Profiler_a8e49bf15427fc57e8bfc0133f3f28824_cgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_a588e2d3debc628e707c98e579af5d306}\label{classnntrainer_1_1profile_1_1Profiler_a588e2d3debc628e707c98e579af5d306}} 
\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}!end@{end}}
\index{end@{end}!nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}
\doxysubsubsection{\texorpdfstring{end()}{end()}}
{\footnotesize\ttfamily void nntrainer\+::profile\+::\+Profiler\+::end (\begin{DoxyParamCaption}\item[{const int}]{time\+\_\+item }\end{DoxyParamCaption})}



end time profile and notify to the listeners 


\begin{DoxyParams}{Parameters}
{\em time\+\_\+item} & time item to be finished \\
\hline
\end{DoxyParams}
\begin{DoxyRefDesc}{Todo}
\item[\mbox{\hyperlink{todo__todo000142}{Todo}}]\+: consider race condition \end{DoxyRefDesc}


Definition at line 280 of file profiler.\+cpp.

Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=312pt]{classnntrainer_1_1profile_1_1Profiler_a588e2d3debc628e707c98e579af5d306_cgraph}
\end{center}
\end{figure}
Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=312pt]{classnntrainer_1_1profile_1_1Profiler_a588e2d3debc628e707c98e579af5d306_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_adfef40f829cb8e694e3a5aafd31ec226}\label{classnntrainer_1_1profile_1_1Profiler_adfef40f829cb8e694e3a5aafd31ec226}} 
\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}!Global@{Global}}
\index{Global@{Global}!nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}
\doxysubsubsection{\texorpdfstring{Global()}{Global()}}
{\footnotesize\ttfamily \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}} \& nntrainer\+::profile\+::\+Profiler\+::\+Global (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Get Global \mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}}. 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{classnntrainer_1_1profile_1_1Profiler}{Profiler}}\& 
\end{DoxyReturn}


Definition at line 257 of file profiler.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_a9032518e7e2b6c451b7b4652c305b9a5}\label{classnntrainer_1_1profile_1_1Profiler_a9032518e7e2b6c451b7b4652c305b9a5}} 
\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}!registerTimeItem@{registerTimeItem}}
\index{registerTimeItem@{registerTimeItem}!nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}
\doxysubsubsection{\texorpdfstring{registerTimeItem()}{registerTimeItem()}}
{\footnotesize\ttfamily int nntrainer\+::profile\+::\+Profiler\+::register\+Time\+Item (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{name }\end{DoxyParamCaption})}



register\+Event to record. 

\begin{DoxyNote}{Note}
Call to the function shouldn\textquotesingle{}t be inside a critical path
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
int return N\+E\+G\+A\+T\+I\+VE integer to distinguish from reserved events 
\end{DoxyReturn}


Definition at line 341 of file profiler.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_a041c62345fee7b0604f796c11948735f}\label{classnntrainer_1_1profile_1_1Profiler_a041c62345fee7b0604f796c11948735f}} 
\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}!start@{start}}
\index{start@{start}!nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}
\doxysubsubsection{\texorpdfstring{start()}{start()}}
{\footnotesize\ttfamily void nntrainer\+::profile\+::\+Profiler\+::start (\begin{DoxyParamCaption}\item[{const int}]{time\+\_\+item }\end{DoxyParamCaption})}



start time profile 


\begin{DoxyParams}{Parameters}
{\em time\+\_\+item} & time item to be recorded \\
\hline
\end{DoxyParams}


Definition at line 262 of file profiler.\+cpp.

Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classnntrainer_1_1profile_1_1Profiler_a041c62345fee7b0604f796c11948735f_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_a9b965c0143497bf1abfd1c5b6e33d24d}\label{classnntrainer_1_1profile_1_1Profiler_a9b965c0143497bf1abfd1c5b6e33d24d}} 
\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}!subscribe@{subscribe}}
\index{subscribe@{subscribe}!nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}
\doxysubsubsection{\texorpdfstring{subscribe()}{subscribe()}}
{\footnotesize\ttfamily void nntrainer\+::profile\+::\+Profiler\+::subscribe (\begin{DoxyParamCaption}\item[{std\+::shared\+\_\+ptr$<$ \mbox{\hyperlink{classnntrainer_1_1profile_1_1ProfileListener}{Profile\+Listener}} $>$}]{listener,  }\item[{const std\+::set$<$ int $>$ \&}]{time\+\_\+item = {\ttfamily \{\}} }\end{DoxyParamCaption})}



subscribe a listener to the profiler 


\begin{DoxyParams}{Parameters}
{\em listener} & listener to register, listener must call unsubscribe on destruction \\
\hline
{\em events} & event listeners are subscribing, if empty listener subscribes to all events \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em std\+::invalid\+\_\+argument} & if listener is already registered \\
\hline
\end{DoxyExceptions}


Definition at line 315 of file profiler.\+cpp.

\mbox{\Hypertarget{classnntrainer_1_1profile_1_1Profiler_a980dbbf00dbdc7e7b538b38a15b55dad}\label{classnntrainer_1_1profile_1_1Profiler_a980dbbf00dbdc7e7b538b38a15b55dad}} 
\index{nntrainer::profile::Profiler@{nntrainer::profile::Profiler}!unsubscribe@{unsubscribe}}
\index{unsubscribe@{unsubscribe}!nntrainer::profile::Profiler@{nntrainer::profile::Profiler}}
\doxysubsubsection{\texorpdfstring{unsubscribe()}{unsubscribe()}}
{\footnotesize\ttfamily void nntrainer\+::profile\+::\+Profiler\+::unsubscribe (\begin{DoxyParamCaption}\item[{std\+::shared\+\_\+ptr$<$ \mbox{\hyperlink{classnntrainer_1_1profile_1_1ProfileListener}{Profile\+Listener}} $>$}]{listener }\end{DoxyParamCaption})}



unsubscribe a listener from the profiler 


\begin{DoxyParams}{Parameters}
{\em listener} & listener to unsubscribe \\
\hline
\end{DoxyParams}


Definition at line 330 of file profiler.\+cpp.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
utils/\mbox{\hyperlink{profiler_8h}{profiler.\+h}}\item 
utils/\mbox{\hyperlink{profiler_8cpp}{profiler.\+cpp}}\end{DoxyCompactItemize}
