src/Profile/TulipTimers.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  * This program was prepared by PSI. 
00007  * All rights in the program are reserved by PSI.
00008  * Neither PSI nor the author(s)
00009  * makes any warranty, express or implied, or assumes any liability or
00010  * responsibility for the use of this software
00011  *
00012  * Visit http://www.acl.lanl.gov/POOMS for more details
00013  *
00014  ***************************************************************************/
00015 
00016 /*********************************************************************/
00017 /*                  pC++/Sage++  Copyright (C) 1994                  */
00018 /*  Indiana University  University of Oregon  University of Rennes   */
00019 /*********************************************************************/
00020 
00021 /*
00022  * pcxx_timer.h: timer definitions and macros
00023  *
00024  * (c) 1994 Jerry Manic Saftware
00025  *
00026  * Version 3.0
00027  */
00028 
00029 /* Written by Bernd Mohr & Pete Beckman */
00030 /* Last overhauled Jun 1994             */
00031 
00032 /* Things are setup, so that the different machines are recognized   */
00033 /* automatically, if this file is compiled with a decent compiler.   */
00034 /* EXCEPTION: There is no way in a C program of distinguishing       */
00035 /*            between a Sun and a Meiko, and a Rs6000 and a SP1.     */
00036 /*            The user of this package has to set __MEIKO__ or       */
00037 /*            __SP1__ respectively.                                  */
00038 /* NOTE: This package was primarily written for parallel machines.   */
00039 /*       However, it runs also on basically every UNIX workstation,  */
00040 /*       but it makes no use of special high resolution timers on    */
00041 /*       these machines (as these are VERY unportable).              */
00042 
00043 #ifndef __PCXX_TIMERS_H__
00044 #define __PCXX_TIMERS_H__
00045 
00046 
00047 // Hack. For now, we've disabled PCXX_EVENT
00048 #     define PCXX_EVENT(c, e, p)
00049 #       define PCXX_WTIMER_CLEAR    60199
00050 #       define PCXX_WTIMER_START    60100
00051 #       define PCXX_WTIMER_STOP     60200
00052 #       define PCXX_UTIMER_CLEAR    60399
00053 #       define PCXX_UTIMER_START    60300
00054 #       define PCXX_UTIMER_STOP     60400
00055 
00056 #ifdef  __cplusplus
00057 #  define LANG "C"
00058 #else
00059 #  define LANG
00060 #endif /* __cplusplus */
00061 
00062 /*********************************************************************/
00063 /* long pcxx_GetUSecL:    get microseconds as long (for tracing)     */
00064 /* double pcxx_GetUSecD:  get microseconds as double (for profiling) */
00065 /* double tulip_WallClock                                             */
00066 /*********************************************************************/
00067 
00068 #ifdef __PARAGON__
00069 /* -- clock resolution 100ns -- */
00070    extern LANG double pcxxT_dclock ();
00071    extern LANG double pcxxT_start;
00072 #  define pcxx_GetUSecL()  ((pcxxT_dclock() - pcxxT_start) * 0.1)
00073 #  define pcxx_GetUSecD()  (pcxxT_dclock() * 0.1)
00074 #  define tulip_WallClock() (pcxxT_dclock() * 1.0e-7)
00075 #else
00076 #ifdef __ksr__
00077 #  include <ksr/ksr_timers.h>
00078 #  define pcxx_GetUSecL()  x_all_timer()
00079 #  define pcxx_GetUSecD()  (all_seconds() * 1.0e6)
00080 #  define tulip_WallClock() (all_seconds())
00081 #  define tulip_UserClock() (user_seconds())
00082 #else
00083 #if ( defined(_SEQUENT_) || defined(sequent) )
00084 /* -- clock resolution 1us -- */
00085 #  include <usclkc.h>
00086 #  define pcxx_GetUSecL()  GETUSCLK()
00087 #  define pcxx_GetUSecD()  ((double) GETUSCLK())
00088 #  define tulip_WallClock() ((double) GETUSCLK() * 1.0e-6)
00089 #else
00090 #ifdef butterfly
00091    extern LANG long getusecclock ();
00092 #  define pcxx_GetUSecL()  getusecclock()
00093 #  define pcxx_GetUSecD()  ((double) getusecclock())
00094 #  define tulip_WallClock() ((double) getusecclock() * 1.0e-6)
00095 #else
00096 /* added SP1_T instead of SP1 by elj 3/26/97 -- tb0time not available on SP2 */
00097 #ifdef __SP1_T__
00098 /* -- clock resolution 1ms -- */
00099    extern LANG double pcxxT_time;
00100    extern LANG double pcxxT_start;
00101    extern LANG void tb0time(double*);
00102 #  define pcxx_GetUSecL()  (tb0time(&pcxxT_time),(pcxxT_time-pcxxT_start)*1.0e3)
00103 #  define pcxx_GetUSecD()  (tb0time(&pcxxT_time),pcxxT_time*1.0e3)
00104 #  define tulip_WallClock() (tb0time(&pcxxT_time),pcxxT_time*1.0e-3)
00105 #else
00106 #ifdef __MEIKO__
00107 #  define pcxx_GetUSecL()
00108 #  define pcxx_GetUSecD()
00109 #  define tulip_WallClock()
00110 #else
00111 #ifdef __T3D__
00112 /* -- clock speed 150MHz -- */
00113 #  include <time.h>
00114 #  define pcxx_GetUSecL()  (rtclock() / 150)
00115 #  define pcxx_GetUSecD()  ((double) rtclock() * 0.6666666667e-2)
00116 #  define tulip_WallClock() ((double) rtclock() * 0.6666666667e-8)
00117 #  define tulip_UserClock() ((double) cpused() * 0.6666666667e-8)
00118 #  define tulip_InitClocks()
00119 #else
00120 #ifdef _CRAYT3E
00121 /* -- clock speed 300MHz -- */
00122 #  include <time.h>
00123 #  define pcxx_GetUSecL()  (rtclock() / 300)
00124 #  define pcxx_GetUSecD()  ((double) rtclock() * 0.3333333333e-2)
00125 #  define tulip_WallClock() ((double) rtclock() * 0.3333333333e-8)
00126 #  define tulip_UserClock() ((double) cpused() * 0.3333333333e-8)
00127 #  define tulip_InitClocks()
00128 #else
00129    extern LANG unsigned long int pcxxT_GetClock ();
00130 #  define pcxx_GetUSecL()  pcxxT_GetClock()
00131 #  define pcxx_GetUSecD()  ((double) pcxxT_GetClock())
00132 #  define tulip_WallClock() ((double) pcxxT_GetClock() * 1.0e-6)
00133 #endif
00134 #endif
00135 #endif
00136 #endif
00137 #endif
00138 #endif
00139 #endif
00140 #endif
00141 
00142 /*******************************************************************/
00143 /* Declarations for the rest of the Timers and Clocks Package      */
00144 /*******************************************************************/
00145 #if ( !defined(__T3D__) && !defined(_CRAYT3E) )
00146 extern LANG void tulip_InitClocks ();
00147 #endif
00148 #if ( !defined(__ksr__) && !defined(__T3D__) && !defined(_CRAYT3E) )
00149 extern LANG double tulip_UserClock();
00150 #endif
00151 extern LANG int tulip_UserTimerClear(int);
00152 extern LANG int tulip_UserTimerStart(int);
00153 extern LANG int tulip_UserTimerStop(int);
00154 extern LANG double tulip_UserTimerElapsed(int);
00155 extern LANG int tulip_WallTimerClear(int);
00156 extern LANG int tulip_WallTimerStart(int);
00157 extern LANG int tulip_WallTimerStop(int);
00158 extern LANG double tulip_WallTimerElapsed(int);
00159 
00160 #endif  /* __PCXX_TIMERS_H__ */
00161 
00162 /***************************************************************************
00163  * $RCSfile: addheaderfooter,v $   $Author: adelmann $
00164  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:17 $
00165  * IPPL_VERSION_ID: $Id: addheaderfooter,v 1.1.1.1 2003/01/23 07:40:17 adelmann Exp $ 
00166  ***************************************************************************/
00167 

Generated on Mon Jan 16 13:23:55 2006 for IPPL by  doxygen 1.4.6