\hypertarget{TMR_8h}{
\section{TMR.h File Reference}
\label{TMR_8h}\index{TMR.h@{TMR.h}}
}
Provides a set of timing macros. 

{\tt \#include \char`\"{}impl/TMR.xx-xxx-xxx.h\char`\"{}}\par


Include dependency graph for TMR.h:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=79pt]{TMR_8h__incl}
\end{center}
\end{figure}


This graph shows which files directly or indirectly include this file:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=68pt]{TMR_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Classes}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__TMR__usecs__nsecs}{\_\-TMR\_\-usecs\_\-nsecs}
\begin{CompactList}\small\item\em Structure to hold the time in terms of two integers, one giving the number of micro-seconds, the other the number of milliseconds. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{TMR_8h_c010388d43ebd21be825b333fa73fb1c}{
typedef struct \hyperlink{struct__TMR__usecs__nsecs}{\_\-TMR\_\-usecs\_\-nsecs} \hyperlink{TMR_8h_c010388d43ebd21be825b333fa73fb1c}{TMR\_\-usecs\_\-nsecs}}
\label{TMR_8h_c010388d43ebd21be825b333fa73fb1c}

\begin{CompactList}\small\item\em Typedef for struct {\em \hyperlink{struct__TMR__usecs__nsecs}{\_\-TMR\_\-usecs\_\-nsecs}\/}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{TMR_8h_afc5103f8562fcf43603aad48aff95cf}{TMR\_\-initialize} (void)
\begin{CompactList}\small\item\em Initializes the TMR facility. \item\end{CompactList}\item 
\hyperlink{TMR_8xx-x86-gcc_8h_92b3fb94130d0b46fc2eb9dc7e3613e6}{TMR\_\-tick} \hyperlink{TMR_8h_bd7c0bbaf2229152882fd1e39f63488e}{TMR\_\-nsecs\_\-to\_\-ticks} (int nanoseconds)
\begin{CompactList}\small\item\em Convert a number of nanoseconds to PTUs. \item\end{CompactList}\item 
unsigned int \hyperlink{TMR_8h_9b4988b816b11598b4a31911aa0c4674}{TMR\_\-ticks\_\-to\_\-nsecs} (\hyperlink{TMR_8xx-x86-gcc_8h_92b3fb94130d0b46fc2eb9dc7e3613e6}{TMR\_\-tick} ticks)
\begin{CompactList}\small\item\em Convert a number of ticks to nanoseconds. \item\end{CompactList}\item 
\hyperlink{struct__TMR__usecs__nsecs}{TMR\_\-usecs\_\-nsecs} \hyperlink{TMR_8h_0c948a71c49fe2020e6b261cf7b08963}{TMR\_\-ticks\_\-to\_\-usecs\_\-nsecs} (\hyperlink{TMR_8xx-x86-gcc_8h_92b3fb94130d0b46fc2eb9dc7e3613e6}{TMR\_\-tick} ticks)
\begin{CompactList}\small\item\em Convert a number of ticks useconds.nanoseconds. \item\end{CompactList}\item 
unsigned int \hyperlink{TMR_8h_4ee5c6088158aaee739224dd6226b9b4}{TMR\_\-frequency} (void)
\begin{CompactList}\small\item\em Get the frequency of the processor timer. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Provides a set of timing macros. 

\begin{Desc}
\item[Author:]JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}


\footnotesize\begin{verbatim}
    CVS $Id: TMR.h,v 1.3 2005/10/13 22:00:55 russell Exp $
\end{verbatim}
\normalsize


\begin{Desc}
\item[ABSTRACT]This implements a facility to time accurately short duration events. The implementation is platform dependent, seeking to use the highest resolution clock that is available. The facility provides a uniform and consistent compile time interface. Note that this is not the same as a uniform and consistent run time interface. In particular the timer units may vary platform to platform. This difference is taken out by a typedef of the TMR units (TMR\_\-ticks). The resolution is also platform dependent, so a function to convert process timer units to NSECS is provided.\end{Desc}
\begin{Desc}
\item[]Finally, to keep the overhead low, consistent with timing short duration events, certain compromises where made. In general, do not use this facility to time events $>$ 200 secs. The normal system clocks should be used instead.\end{Desc}
\begin{Desc}
\item[EXAMPLE]

\begin{Code}\begin{verbatim}    TMR_tick     beg;
    TMR_tick     end;
    TMR_tick elapsed;

    beg     = TMR_GET();
    .
    eventToTime ();
    .
    end     = TMR_GET();
    elapsed = end - beg;

    printf ("Begin   Time: " TMR_FORMAT "tickss\n", beg);
    printf ("End     Time: " TMR_FORMAT "ticks\n", end);
    printf ("Elasped Time: " TMR_FORMAT "tickss\n", elapsed);
    printf ("Elasped Time: " TMR_FORMAT "ticks\n",
                             TMR_TO_NSECS (elapsed);
\end{verbatim}
\end{Code}

 \end{Desc}


\subsection{Function Documentation}
\hypertarget{TMR_8h_4ee5c6088158aaee739224dd6226b9b4}{
\index{TMR.h@{TMR.h}!TMR_frequency@{TMR\_\-frequency}}
\index{TMR_frequency@{TMR\_\-frequency}!TMR.h@{TMR.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int TMR\_\-frequency (void)}}
\label{TMR_8h_4ee5c6088158aaee739224dd6226b9b4}


Get the frequency of the processor timer. 

\begin{Desc}
\item[Returns:]The frequency, in Hertz, to the processor timer \end{Desc}
\hypertarget{TMR_8h_afc5103f8562fcf43603aad48aff95cf}{
\index{TMR.h@{TMR.h}!TMR_initialize@{TMR\_\-initialize}}
\index{TMR_initialize@{TMR\_\-initialize}!TMR.h@{TMR.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int TMR\_\-initialize (void)}}
\label{TMR_8h_afc5103f8562fcf43603aad48aff95cf}


Initializes the TMR facility. 

This is a one time only call to initialize internal data structures. This routine should be called as part of the library initialization sequence. \hypertarget{TMR_8h_bd7c0bbaf2229152882fd1e39f63488e}{
\index{TMR.h@{TMR.h}!TMR_nsecs_to_ticks@{TMR\_\-nsecs\_\-to\_\-ticks}}
\index{TMR_nsecs_to_ticks@{TMR\_\-nsecs\_\-to\_\-ticks}!TMR.h@{TMR.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf TMR\_\-tick} TMR\_\-nsecs\_\-to\_\-ticks (int {\em nanoseconds})}}
\label{TMR_8h_bd7c0bbaf2229152882fd1e39f63488e}


Convert a number of nanoseconds to PTUs. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em nanoseconds}]The number of nanoseconds to convert to PTUs \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The number of equivalent PTUs \end{Desc}
\hypertarget{TMR_8h_9b4988b816b11598b4a31911aa0c4674}{
\index{TMR.h@{TMR.h}!TMR_ticks_to_nsecs@{TMR\_\-ticks\_\-to\_\-nsecs}}
\index{TMR_ticks_to_nsecs@{TMR\_\-ticks\_\-to\_\-nsecs}!TMR.h@{TMR.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int TMR\_\-ticks\_\-to\_\-nsecs ({\bf TMR\_\-tick} {\em ticks})}}
\label{TMR_8h_9b4988b816b11598b4a31911aa0c4674}


Convert a number of ticks to nanoseconds. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ticks}]The number of ticks to convert to nanoseconds \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The number of equivalent nanoseconds \end{Desc}
\hypertarget{TMR_8h_0c948a71c49fe2020e6b261cf7b08963}{
\index{TMR.h@{TMR.h}!TMR_ticks_to_usecs_nsecs@{TMR\_\-ticks\_\-to\_\-usecs\_\-nsecs}}
\index{TMR_ticks_to_usecs_nsecs@{TMR\_\-ticks\_\-to\_\-usecs\_\-nsecs}!TMR.h@{TMR.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf TMR\_\-usecs\_\-nsecs} TMR\_\-ticks\_\-to\_\-usecs\_\-nsecs ({\bf TMR\_\-tick} {\em ticks})}}
\label{TMR_8h_0c948a71c49fe2020e6b261cf7b08963}


Convert a number of ticks useconds.nanoseconds. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ticks}]The number of ticks to convert \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The number of equivalent useconds, nanoseconds \end{Desc}
