\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`\"{}PBS/PTS.h\char`\"{}}\par


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


This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=40pt]{TMR_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\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*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{TMR_8h_a0}{
\#define \hyperlink{TMR_8h_a0}{TMR\_\-GET}()\ PTS\_\-GETS()}
\label{TMR_8h_a0}

\begin{CompactList}\small\item\em Macro to get the processor time. \item\end{CompactList}\item 
\#define \hyperlink{TMR_8h_a1}{TMR\_\-TO\_\-NSECS}(\_\-ticks)\ PTS\_\-PTUS\_\-TO\_\-NSECS(\_\-ticks)
\begin{CompactList}\small\item\em Convert a time processor time ticks to nanoseconds. \item\end{CompactList}\item 
\#define \hyperlink{TMR_8h_a2}{TMR\_\-DELTA}(\_\-beg, \_\-end)\ PTS\_\-DELTAS(\_\-beg, \_\-end)
\begin{CompactList}\small\item\em Subtracts two times in ticks, returning the result in ticks. \item\end{CompactList}\item 
\#define \hyperlink{TMR_8h_a3}{TMR\_\-DELTA\_\-IN\_\-NSECS}(\_\-beg, \_\-end)\ PTS\_\-DELTAS\_\-IN\_\-NSECS(\_\-beg, \_\-end)
\begin{CompactList}\small\item\em Subtracts two times in tickss, returning the result in nanoseconds. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{TMR_8h_a4}{
typedef unsigned int \hyperlink{TMR_8h_a4}{TMR\_\-tick}}
\label{TMR_8h_a4}

\begin{CompactList}\small\item\em The type of an elapsed unit of time. \item\end{CompactList}\item 
typedef \hyperlink{struct__TMR__usecs__nsecs}{\_\-TMR\_\-usecs\_\-nsecs} \hyperlink{TMR_8h_a5}{TMR\_\-usecs\_\-nsecs}
\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 
unsigned int \hyperlink{TMR_8h_a6}{TMR\_\-ticks\_\-to\_\-nsecs} (\hyperlink{TMR_8h_a4}{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_a7}{TMR\_\-ticks\_\-to\_\-usecs\_\-nsecs} (\hyperlink{TMR_8h_a4}{TMR\_\-tick} ticks)
\begin{CompactList}\small\item\em Convert a number of ticks useconds.nanoseconds. \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/05/02 15:39:39 russell Exp $

\end{verbatim}\normalsize


\begin{Desc}
\item[SYNPOSIS]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. However, TMR\_\-get always returns an unsigned int, independent of the actual resolution.\end{Desc}
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 $>$ 4 secs. The normal system clocks should be used instead.

\begin{Desc}
\item[USAGE]

\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: %8d ticks\n", beg);
    printf ("End     Time: %8d ticks\n", end);
    printf ("Elasped Time: %8d ticks\n", elapsed);
    printf ("Elasped Time: %8d"ticks\n", TMR_TO_NSECS (elapsed);
\end{verbatim}\normalsize
\end{Desc}


\subsection{Define Documentation}
\hypertarget{TMR_8h_a2}{
\index{TMR.h@{TMR.h}!TMR_DELTA@{TMR\_\-DELTA}}
\index{TMR_DELTA@{TMR\_\-DELTA}!TMR.h@{TMR.h}}
\subsubsection[TMR\_\-DELTA]{\setlength{\rightskip}{0pt plus 5cm}\#define TMR\_\-DELTA(\_\-beg, \_\-end)\ PTS\_\-DELTAS(\_\-beg, \_\-end)}}
\label{TMR_8h_a2}


Subtracts two times in ticks, returning the result in ticks. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-beg}]The beginning time in processor timer ticks \item[{\em \_\-end}]The ending time in processor timer ticks \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The difference is processor timer ticks\end{Desc}
For many processor's, this is just a subtraction.two 32 or 64 bit integer. However, on some platforms, the time is returned in a structure and the subtraction is not quite as trivial. If this were C++, one would have overloaded the '-' operator, \hypertarget{TMR_8h_a3}{
\index{TMR.h@{TMR.h}!TMR_DELTA_IN_NSECS@{TMR\_\-DELTA\_\-IN\_\-NSECS}}
\index{TMR_DELTA_IN_NSECS@{TMR\_\-DELTA\_\-IN\_\-NSECS}!TMR.h@{TMR.h}}
\subsubsection[TMR\_\-DELTA\_\-IN\_\-NSECS]{\setlength{\rightskip}{0pt plus 5cm}\#define TMR\_\-DELTA\_\-IN\_\-NSECS(\_\-beg, \_\-end)\ PTS\_\-DELTAS\_\-IN\_\-NSECS(\_\-beg, \_\-end)}}
\label{TMR_8h_a3}


Subtracts two times in tickss, returning the result in nanoseconds. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-beg}]The beginning time in processor timer ticks \item[{\em \_\-end}]The ending time in processor timer ticks \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The difference is nanoseconds \end{Desc}
\hypertarget{TMR_8h_a1}{
\index{TMR.h@{TMR.h}!TMR_TO_NSECS@{TMR\_\-TO\_\-NSECS}}
\index{TMR_TO_NSECS@{TMR\_\-TO\_\-NSECS}!TMR.h@{TMR.h}}
\subsubsection[TMR\_\-TO\_\-NSECS]{\setlength{\rightskip}{0pt plus 5cm}\#define TMR\_\-TO\_\-NSECS(\_\-ticks)\ PTS\_\-PTUS\_\-TO\_\-NSECS(\_\-ticks)}}
\label{TMR_8h_a1}


Convert a time processor time ticks to nanoseconds. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-ticks}]The value to convert \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The converted value \end{Desc}


\subsection{Typedef Documentation}
\hypertarget{TMR_8h_a5}{
\index{TMR.h@{TMR.h}!TMR_usecs_nsecs@{TMR\_\-usecs\_\-nsecs}}
\index{TMR_usecs_nsecs@{TMR\_\-usecs\_\-nsecs}!TMR.h@{TMR.h}}
\subsubsection[TMR\_\-usecs\_\-nsecs]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__TMR__usecs__nsecs}{TMR\_\-usecs\_\-nsecs}}}
\label{TMR_8h_a5}


Typedef for struct {\em \hyperlink{struct__TMR__usecs__nsecs}{\_\-TMR\_\-usecs\_\-nsecs}\/}. 

\begin{Desc}
\item[Usage]This should be used for display purposes only. \end{Desc}


\subsection{Function Documentation}
\hypertarget{TMR_8h_a6}{
\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 (\hyperlink{TMR_8h_a4}{TMR\_\-tick} {\em ticks})}}
\label{TMR_8h_a6}


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_a7}{
\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[TMR\_\-ticks\_\-to\_\-usecs\_\-nsecs]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__TMR__usecs__nsecs}{TMR\_\-usecs\_\-nsecs} TMR\_\-ticks\_\-to\_\-usecs\_\-nsecs (\hyperlink{TMR_8h_a4}{TMR\_\-tick} {\em ticks})}}
\label{TMR_8h_a7}


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}
