\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`\"{}tmr.h.xx-xxx-xxx\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{tmr_8h_a0}{TMR\_\-initialize} (void)
\begin{CompactList}\small\item\em Initializes the TMR facility.\item\end{CompactList}\item 
TMR\_\-tick \hyperlink{tmr_8h_a1}{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_a2}{TMR\_\-ticks\_\-to\_\-nsecs} (TMR\_\-tick ticks)
\begin{CompactList}\small\item\em Convert a number of ticks to nanoseconds.\item\end{CompactList}\item 
unsigned int \hyperlink{tmr_8h_a3}{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: ]\par
JJRussell - \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu}\end{Desc}
$\backslash$b\-ABSTRACT\par
 --------\par
 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.

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.

$\backslash$b\-EXAMPLE\par
 -------\par
 

\footnotesize\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}\normalsize 




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


Get the frequency of the processor timer.

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


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_a1}{
\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[TMR\_\-nsecs\_\-to\_\-ticks]{\setlength{\rightskip}{0pt plus 5cm}int TMR\_\-nsecs\_\-to\_\-ticks (int {\em nanoseconds})}}
\label{tmr_8h_a1}


Convert a number of nanoseconds to PTUs.

\begin{Desc}
\item[Parameters: ]\par
\begin{description}
\item[{\em 
nanoseconds}]The number of nanoseconds to convert to PTUs \end{description}
\end{Desc}
\begin{Desc}
\item[Returns: ]\par
The number of equivalent PTUs \end{Desc}
\hypertarget{tmr_8h_a2}{
\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[TMR\_\-ticks\_\-to\_\-nsecs]{\setlength{\rightskip}{0pt plus 5cm}unsigned int TMR\_\-ticks\_\-to\_\-nsecs (TMR\_\-tick {\em ticks})}}
\label{tmr_8h_a2}


Convert a number of ticks to nanoseconds.

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