92 lines
4.1 KiB
TeX
92 lines
4.1 KiB
TeX
\subsection{VarLog}
|
|
This is a lillte helper class which can be used to keep a log of a
|
|
variable. A variables value is stored together with time information in a
|
|
list. Various functions allow to interact with this list and retrieve the
|
|
log. For the list the lld package is used again. Thus the only data
|
|
required by this module is the integer ID of the list.
|
|
|
|
The following functions are provided:
|
|
|
|
\begin{flushleft} \small
|
|
\begin{minipage}{\linewidth} \label{scrap1}
|
|
$\langle$logint {\footnotesize ?}$\rangle\equiv$
|
|
\vspace{-1ex}
|
|
\begin{list}{}{} \item
|
|
\mbox{}\verb@@\\
|
|
\mbox{}\verb@/*---------------------------- birth and death ----------------------------*/ @\\
|
|
\mbox{}\verb@ typedef struct __VarLog *pVarLog;@\\
|
|
\mbox{}\verb@@\\
|
|
\mbox{}\verb@ int VarlogInit(pVarLog *self);@\\
|
|
\mbox{}\verb@ int VarlogDelete(pVarLog self);@\\
|
|
\mbox{}\verb@/*----------------------------- operation -------------------------------*/@\\
|
|
\mbox{}\verb@ int VarlogClear(pVarLog self);@\\
|
|
\mbox{}\verb@ int VarlogAdd(pVarLog self, float fVal);@\\
|
|
\mbox{}\verb@/*------------------------------ data recovery -------------------------*/@\\
|
|
\mbox{}\verb@ int VarlogLength(pVarLog self, int *iLength);@\\
|
|
\mbox{}\verb@ int VarlogGetTime(pVarLog self, time_t *tTime);@\\
|
|
\mbox{}\verb@ int VarlogGetVal(pVarLog self, float *fValues);@\\
|
|
\mbox{}\verb@ int VarlogGetMean(pVarLog self, float *fMean, float *fStdDev);@\\
|
|
\mbox{}\verb@/*------------------------------ interpreter ---------------------------*/@\\
|
|
\mbox{}\verb@ int VarlogWrapper(pVarLog self,SConnection *pCon, @\\
|
|
\mbox{}\verb@ char *subcommand, char *sub2,char *pVarName);@\\
|
|
\mbox{}\verb@@$\diamond$
|
|
\end{list}
|
|
\vspace{-1ex}
|
|
\footnotesize\addtolength{\baselineskip}{-1ex}
|
|
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
|
\item Macro referenced in scrap ?.
|
|
\end{list}
|
|
\end{minipage}\\[4ex]
|
|
\end{flushleft}
|
|
All functions return 1 on success, 0 on failure if not mentioned otherwise.
|
|
|
|
\begin{description}
|
|
\item [ValogInit] creates a new varlog and prepares for data collection.
|
|
Only parameter is a pointer to an int which will be initialised to the list
|
|
ID to use.
|
|
\item [VarlogDelete] deletes a varlog and frees the list. Single parameter
|
|
is a pointer to an int holding the ID of the list to kill.
|
|
\item [VarlogClear] clears old logged data but keeps the varlog alive for
|
|
further data collection.
|
|
\item [VarlogAdd] adds the float value fVal to the log denoted by iList. The
|
|
time stamp will be generated automatically.
|
|
\item [VarlogLength] retrieves the length of the current log.
|
|
\item [VarlogGetTime] retrieves the array of time stamps as provided by the
|
|
system function time from the log.
|
|
\item [VarlogGetVal] retrieves the array of values from the log.
|
|
\item [VarlogGetMean] retrieves the mean value of the values from the log
|
|
denoted by iList and their standard deviation.
|
|
\item [VarlogWrapper] is a function which may be invoked from an object
|
|
wrapper function in order to interpret and handle the var logs subcommands.
|
|
Parameters are: the varlog list, a switch variable which will be set to 1
|
|
if logging is enabled and to 0 if not, a connection object to which data
|
|
will be written and finally the subcommand to evaluate.
|
|
\end{description}
|
|
|
|
\begin{flushleft} \small
|
|
\begin{minipage}{\linewidth} \label{scrap2}
|
|
\verb@"varlog.h"@ {\footnotesize ? }$\equiv$
|
|
\vspace{-1ex}
|
|
\begin{list}{}{} \item
|
|
\mbox{}\verb@@\\
|
|
\mbox{}\verb@/*--------------------------------------------------------------------------@\\
|
|
\mbox{}\verb@ V A R L O G@\\
|
|
\mbox{}\verb@ @\\
|
|
\mbox{}\verb@ A module which keeps a log of a variable.@\\
|
|
\mbox{}\verb@@\\
|
|
\mbox{}\verb@ Mark Koennecke, September 1997@\\
|
|
\mbox{}\verb@@\\
|
|
\mbox{}\verb@ copyright: see implementation file@\\
|
|
\mbox{}\verb@ @\\
|
|
\mbox{}\verb@----------------------------------------------------------------------------*/@\\
|
|
\mbox{}\verb@#ifndef SICSVARLOG@\\
|
|
\mbox{}\verb@#define SICSVARLOG@\\
|
|
\mbox{}\verb@#include <time.h>@\\
|
|
\mbox{}\verb@@$\langle$logint {\footnotesize ?}$\rangle$\verb@@\\
|
|
\mbox{}\verb@#endif@\\
|
|
\mbox{}\verb@@$\diamond$
|
|
\end{list}
|
|
\vspace{-2ex}
|
|
\end{minipage}\\[4ex]
|
|
\end{flushleft}
|