00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PBRT_TIMER_H
00025 #define PBRT_TIMER_H
00026
00027 #include "pbrt.h"
00028 #if defined ( WIN32 )
00029 #include <windows.h>
00030 #else
00031 #include <sys/time.h>
00032 #endif
00033 #if (_MSC_VER >= 1400)
00034 #include <stdio.h>
00035 #define snprintf _snprintf
00036 #endif
00037
00038 class COREDLL Timer {
00039 public:
00040
00041 Timer();
00042 ~Timer();
00043
00044 void Start();
00045 void Stop();
00046 void Reset();
00047
00048 double Time();
00049 private:
00050
00051 double time0, elapsed;
00052 bool running;
00053 double GetTime();
00054 #if defined( IRIX ) || defined( IRIX64 )
00055
00056 int fd;
00057 unsigned long long counter64;
00058 unsigned int counter32;
00059 unsigned int cycleval;
00060
00061 typedef unsigned long long iotimer64_t;
00062 typedef unsigned int iotimer32_t;
00063 volatile iotimer64_t *iotimer_addr64;
00064 volatile iotimer32_t *iotimer_addr32;
00065
00066 void *unmapLocation;
00067 int unmapSize;
00068 #elif defined( WIN32 )
00069
00070 LARGE_INTEGER performance_counter, performance_frequency;
00071 double one_over_frequency;
00072 #else
00073
00074 struct timeval timeofday;
00075 #endif
00076 };
00077 #endif // PBRT_TIMER_H