\hypertarget{PTS_8h}{
\section{PTS.h File Reference}
\label{PTS_8h}\index{PTS.h@{PTS.h}}
}
Processor Timer Services. 

{\tt \#include \char`\"{}IPBS/PTS\_\-comdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}IPBS/impl/PTS.h.xx-xxx-xxx\char`\"{}}\par


Include dependency graph for PTS.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=139pt]{PTS_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=149pt]{PTS_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{PTS_8h_a0}{PTS\_\-initialize} (void)
\begin{CompactList}\small\item\em Initializes the PTS facility. \item\end{CompactList}\item 
unsigned int \hyperlink{PTS_8h_a1}{PTS\_\-nsecs\_\-to\_\-ptus} (unsigned int nanoseconds)
\begin{CompactList}\small\item\em Convert a number of nanoseconds to PTUs. \item\end{CompactList}\item 
unsigned int \hyperlink{PTS_8h_a2}{PTS\_\-ptus\_\-to\_\-nsecs} (unsigned int ptus)
\begin{CompactList}\small\item\em Convert a number of ptus to nanoseconds. \item\end{CompactList}\item 
unsigned int \hyperlink{PTS_8h_a3}{PTS\_\-frequency} (void)
\begin{CompactList}\small\item\em Get the frequency of the PTS clock. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Processor Timer Services. 

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


\footnotesize\begin{verbatim}     CVS $Id: PTS.h,v 1.1.1.1 2006/02/10 21:45:35 saxton Exp $
\end{verbatim}
\normalsize


These utilities allow one to deal with the highest resolution clock available on the target platform. The utilities which deal with the clock all take times in the units of the processor clock. These routines allow one to convert these units to and from physical units.

Two parallel sets of routines and macros are provided; one deals with what is called short range processor times and the other with extended range processor times. In general the short range processor times can be represented in 32 bits integer and the extended range processor time can be represented in 64 bits. However, the exact representation is platform dependent. While on many platforms the representation is a 32 or 64 bit unsigned integers, on others it is not. This means the operations on these values most be performed using the routines and macros that PTS provides. As an example, one cannot simple subtract two extended times on LINUX platforms because the representation is not a flat 64 bit integer, it is the wacko seconds and nanoseconds structure.

Because of the this the user of the PTS facility should use PTS\_\-times and PTS\_\-timex to declare variables holding short and extended range processor times.

Nanoseconds has been chosen as the physical unit to deal in. The only limitation that this imposes is on the range, limiting these times, at least in 32 bit representations to the 2-4 second range.

The suite of typedefs and macros is



\footnotesize\begin{verbatim}     - PTS_times
     - PTS_GETS()
     - PTS_PTUS_TO_NSECS(_ptus)
     - PTS_NSECS_TO_PTUS(_nsecs)
     - PTS_DELTAS(_beg, _end)
     - PTS_DELTAS_TO_NSECS(_beg, _end)

     - PTS_timex
     - PTS_GETX()
     - PTS_PTUX_TO_NSECS(_ptus)
     - PTS_NSECX_TO_PTUX(_nsecx)     
     - PTS_DELTAX(_beg, _end)
     - PTS_DELTAX_TO_NSECS(_beg, _end)
\end{verbatim}
\normalsize


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


Get the frequency of the PTS clock. 

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


Initializes the PTS 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{PTS_8h_a1}{
\index{PTS.h@{PTS.h}!PTS_nsecs_to_ptus@{PTS\_\-nsecs\_\-to\_\-ptus}}
\index{PTS_nsecs_to_ptus@{PTS\_\-nsecs\_\-to\_\-ptus}!PTS.h@{PTS.h}}
\subsubsection[PTS\_\-nsecs\_\-to\_\-ptus]{\setlength{\rightskip}{0pt plus 5cm}unsigned int PTS\_\-nsecs\_\-to\_\-ptus (unsigned int {\em nanoseconds})}}
\label{PTS_8h_a1}


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{PTS_8h_a2}{
\index{PTS.h@{PTS.h}!PTS_ptus_to_nsecs@{PTS\_\-ptus\_\-to\_\-nsecs}}
\index{PTS_ptus_to_nsecs@{PTS\_\-ptus\_\-to\_\-nsecs}!PTS.h@{PTS.h}}
\subsubsection[PTS\_\-ptus\_\-to\_\-nsecs]{\setlength{\rightskip}{0pt plus 5cm}unsigned int PTS\_\-ptus\_\-to\_\-nsecs (unsigned int {\em ptus})}}
\label{PTS_8h_a2}


Convert a number of ptus to nanoseconds. 

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