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


{\tt \#include $<$PBS/PTS\_\-comdefs.h$>$}\par
{\tt \#include $<$PBS/impl/PTS.h.xx-xxx-xxx$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{PTS_8h_90b551e96a8da4e369fdc8b126687b19}{PTS\_\-initialize} (void)
\begin{CompactList}\small\item\em Initializes the PTS facility. \item\end{CompactList}\item 
unsigned int \hyperlink{PTS_8h_5d175767b2169299279819c68e49916a}{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_b02d779fc4ed3610027645fa38964a91}{PTS\_\-ptus\_\-to\_\-nsecs} (unsigned int ptus)
\begin{CompactList}\small\item\em Convert a number of ptus to nanoseconds. \item\end{CompactList}\item 
\hypertarget{PTS_8h_9d2f6a8d84a51dd1e1b4c265ed09b8f3}{
unsigned long long int \textbf{PTS\_\-nsecx\_\-to\_\-ptux} (unsigned long long int nanoseconds)}
\label{PTS_8h_9d2f6a8d84a51dd1e1b4c265ed09b8f3}

\item 
\hypertarget{PTS_8h_b3335a1b5a74309a19c5c3d69fc9e1b9}{
unsigned long long int \textbf{PTS\_\-ptux\_\-to\_\-nsecx} (unsigned long long int ptus)}
\label{PTS_8h_b3335a1b5a74309a19c5c3d69fc9e1b9}

\item 
unsigned int \hyperlink{PTS_8h_3481a895cef93504ce8a48b46323da15}{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.6 2011/03/24 23:05:43 apw 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



\begin{Code}\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}
\end{Code}

 

\subsection{Function Documentation}
\hypertarget{PTS_8h_3481a895cef93504ce8a48b46323da15}{
\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_3481a895cef93504ce8a48b46323da15}


Get the frequency of the PTS clock. 

\begin{Desc}
\item[Returns:]The frequency, in Hertz, to the processor clock \end{Desc}


References \_\-PTS\_\-parameters::frequency.

Referenced by PBS\_\-initialize2(), and WUT\_\-frequency().\hypertarget{PTS_8h_90b551e96a8da4e369fdc8b126687b19}{
\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_90b551e96a8da4e369fdc8b126687b19}


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. 

References \_\-PTS\_\-parameters::frequency, and \_\-PTS\_\-parameters::nsecs\_\-per\_\-ptu.

Referenced by PBS\_\-initialize2().\hypertarget{PTS_8h_5d175767b2169299279819c68e49916a}{
\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_5d175767b2169299279819c68e49916a}


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}


References \_\-PTS\_\-parameters::frequency.\hypertarget{PTS_8h_b02d779fc4ed3610027645fa38964a91}{
\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_b02d779fc4ed3610027645fa38964a91}


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}


References \_\-PTS\_\-parameters::nsecs\_\-per\_\-ptu.