test/globus_utp_private.h

00001 /*
00002  * Copyright 1999-2006 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 /**********************************************************************
00018 globus_utp_private.h
00019 
00020 Private declarations for the Unnamed Timing Package (UTP).
00021 **********************************************************************/
00022 
00023 #ifndef GLOBUS_UTP_PRIVATE_INCLUDE
00024 #define GLOBUS_UTP_PRIVATE_INCLUDE
00025 
00026 #include "globus_utp.h"
00027 
00028 /**********************************************************************
00029 Machine-dependent definitions.
00030 **********************************************************************/
00031 
00032 /*
00033 Supported machine types are as follows:
00034 
00035 UNIX : generic Unix; assumes BSD 4.3-compatible gettimeofday(2) and
00036         "struct timeval" from <sys/time.h>.  I have not yet seen a modern
00037         Unix worksation which doesn't have this.
00038 
00039 RS6000 : IBM RS6000 running AIX 3.2 or higher.  Relies on the gettimer()
00040         routine, which is supposed to be a standard (yet the IBM "info"
00041         pages say it may change!).  Clock frequency is supposed to be
00042         256 nanosec.
00043 */
00044 
00045 /*
00046 Check that at least one supported machine type macro was defined.
00047 */
00048 
00049 #define UNIX
00050 #if !defined(UNIX) && !defined(RS6000) && !defined(SOLHR) && \
00051         !defined(SPARCSUNOS41) && !defined(PARAGON)
00052 #error "No machine type was defined."
00053 #endif
00054 
00055 
00056 /*
00057 globus_utp_TimeValue_t is a machine-dependent type representing a time, at the
00058 highest resolution available.
00059 */
00060 
00061 #if defined(UNIX) || defined(SPARCSUNOS41)
00062 
00063 #include <sys/time.h>
00064 
00065 #if 0
00066 #ifdef BSDGETTIMEOFDAY
00067 extern int
00068 BSDgettimeofday(struct timeval *tvp, struct timezone *tzp);
00069 #else
00070 extern int
00071 gettimeofday(struct timeval *tvp, struct timezone *tzp);
00072 #endif
00073 #endif
00074 
00075 typedef struct timeval globus_utp_TimeValue_t;
00076 
00077 #endif /* #ifdef UNIX */
00078 
00079 
00080 #ifdef RS6000
00081 
00082 /*
00083 See also comments on RS6000 version of globus_utp_readTime() in globus_utp_main.c.
00084 */
00085 
00086 #include <sys/time.h>
00087 
00088 typedef struct timestruc_t globus_utp_TimeValue_t;
00089 
00090 #endif  /* #ifdef RS6000 */
00091 
00092 
00093 #ifdef SOLHR
00094 
00095 #include <sys/time.h>
00096 
00097 typedef hrtime_t globus_utp_TimeValue_t;
00098 
00099 #endif
00100 
00101 
00102 #ifdef PARAGON
00103 
00104 #include <nx.h>
00105 
00106 typedef double globus_utp_TimeValue_t;
00107 
00108 #endif
00109 
00110 
00111 /**********************************************************************
00112 Machine-independent definitions.
00113 **********************************************************************/
00114 
00115 /*
00116 globus_utp_TimerState represents the current state of a timer.  A timer which is
00117 either "stopped" or "running" is implicitly enabled.
00118 */
00119 
00120 typedef enum _globus_utp_TimerState {
00121         GLOBUS_UTP_TIMER_STOPPED,
00122         GLOBUS_UTP_TIMER_RUNNING,
00123         GLOBUS_UTP_TIMER_DISABLED
00124 } globus_utp_TimerState;
00125 
00126 
00127 /*
00128 globus_utp_Timer_t contains all data associated with a timer.
00129 */
00130 
00131 typedef struct _globus_utp_Timer_t {
00132         globus_utp_TimerState state;
00133         globus_utp_TimeValue_t startTime;/* If running, when did it start? */
00134                                         /* Total time accumulated. */
00135         globus_utp_TimeValue_t accumulatedTime;
00136         unsigned long numEvents;        /* Number of timed events
00137                                            accumulated into the timer. */
00138         char *name;                     /* Human-readable name. */
00139 } globus_utp_Timer_t;
00140 
00141 
00142 /*
00143 Attributes (key/value pairs) are stored in a linked-list structure.
00144 */
00145 
00146 struct _globus_utp_Attribute_t;         /* Forward declaration. */
00147 
00148 typedef struct _globus_utp_Attribute_t {
00149         char *key;
00150         char *value;
00151         struct _globus_utp_Attribute_t *next;
00152 } globus_utp_Attribute_t;
00153 
00154 
00155 /*
00156 Masks to select fields of the globus_utp_init "mode" parameter.
00157 */
00158 
00159 #define GLOBUS_UTP_MODE_SHARING_FIELD 0x1
00160 
00161 
00162 /**********************************************************************
00163 Private but global functions, to be used only internally by the UTP
00164 package.
00165 **********************************************************************/
00166 
00167 /*
00168 Read current clock time, in a machine-dependent way; store result in *tv.
00169 */
00170 
00171 extern void
00172 globus_utp_readTime(globus_utp_TimeValue_t *tv);
00173 
00174 /*
00175 Place elapsed time between *start and *end into *diff (machine-dependent).
00176 It is permissible for start and/or end to be identical to diff.
00177 */
00178 
00179 extern void
00180 globus_utp_timeDifference(globus_utp_TimeValue_t *diff, const globus_utp_TimeValue_t *start,
00181                    const globus_utp_TimeValue_t *end);
00182 
00183 /*
00184 Accumulate *newElapsed time into *oldElapsed (machine-dependent).
00185 */
00186 
00187 extern void
00188 globus_utp_timeAdd(globus_utp_TimeValue_t *oldElapsed,
00189             const globus_utp_TimeValue_t *newElapsed);
00190 
00191 /*
00192 Set *tv to time zero (machine-dependent).
00193 */
00194 
00195 extern void
00196 globus_utp_timeZero(globus_utp_TimeValue_t *tv);
00197 
00198 
00199 /*
00200 Convert *tv to its double-precision floating-point representation; store it
00201 in *time, store number of significant digits after the decimal place in
00202 *precision.  Machine-dependent.
00203 */
00204 
00205 extern void
00206 globus_utp_timeToDouble(double *time, int *precision, const globus_utp_TimeValue_t *tv);
00207 
00208 
00209 /*
00210 Convert *tv to its floating-point string representation, with seconds as
00211 the units; store result in timeString.  Machine-dependent.
00212 */
00213 
00214 extern void
00215 globus_utp_timeToString(char timeString[], const globus_utp_TimeValue_t *tv);
00216 
00217 
00218 /*
00219 Emit the warning message messageStr in some appropriate way.  messageStr is
00220 a printf()-format output specfier string; the "..." represents data to be
00221 printed using the specifier.
00222 */
00223 
00224 extern void
00225 globus_utp_warn(const char *messageStr, ...);
00226 
00227 
00228 /**********************************************************************
00229 Private but global variables, to be used only internally by the UTP
00230 package.
00231 **********************************************************************/
00232 
00233 extern char *globus_utp_outFilename;            /* Name of output dump file. */
00234 extern unsigned globus_utp_numTimers;           /* Number of timers in use. */
00235 extern globus_utp_Timer_t *globus_utp_timers;           /* Array for the timers. */
00236 extern globus_utp_Attribute_t *globus_utp_attributes;   /* Key/value pairs (comments). */
00237 
00238 
00239 #endif /* #ifndef GLOBUS_UTP_PRIVATE_INCLUDE */
00240 

Generated on 25 Nov 2015 for globus_xio by  doxygen 1.4.7