Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

time.C

Go to the documentation of this file.
00001 
00007 #include <config.h>
00008 #include <sys/time.h>
00009 #include <util/qcdio.h>
00010 #include <util/data_types.h>
00011 
00012 #undef ZERO_ONLY
00013 #if TARGET == BGL
00014 #define ZERO_ONLY
00015 #endif
00016 #if TARGET == BGP
00017 #define ZERO_ONLY
00018 #endif
00019 
00020 #ifdef UNIFORM_SEED_TESTING
00021 const int if_print = 0;
00022 #else
00023 const int if_print = 1;
00024 #endif
00025 
00026 CPS_START_NAMESPACE
00027 
00031 Float dclock(void){
00032         struct timeval tp;
00033         gettimeofday(&tp, NULL);
00034         return((Float) tp.tv_sec + (Float) tp.tv_usec * 1e-6);
00035 }
00036 
00046 Float print_flops(unsigned long long nflops, struct timeval *start, struct timeval *end){
00047         int sec = end->tv_sec - start->tv_sec; 
00048         int usec = end->tv_usec - start->tv_usec; 
00049         Float time = sec + 1.e-6*usec;
00050         if(!UniqueID() && if_print)
00051         printf("%e flops /%e seconds = %e MFlops\n",(Float)nflops,time,(Float)nflops/(time*1.e6));
00052         return nflops/time;
00053 }
00054 
00066 Float print_flops(char *cname, char *fname, unsigned long long nflops, struct timeval *start, struct timeval *end){
00067     if(!UniqueID() && if_print)
00068         printf("%s:%s: ",cname,fname);
00069         return print_flops(nflops,start,end);
00070 }
00071 
00079 Float print_time(const char *cname, const char *fname, Float time){
00080   if (!UniqueID() && if_print)
00081         printf("%s::%s: %e seconds\n",cname,fname,time);
00082         return time;
00083 }
00084 
00085 Float print_flops(unsigned long long nflops, Float time){
00086     if(!UniqueID() && if_print)
00087         printf("%e flops /%e seconds = %e MFlops\n",(Float)nflops,time,(Float)nflops/(time*1.e6));
00088         return nflops/time;
00089 }
00090 
00102 Float print_flops(char *cname, char *fname, unsigned long long nflops, Float time){
00103     if(!UniqueID() && if_print)
00104         printf("Node 0: %s:%s: ",cname,fname);
00105     return print_flops(nflops,time);
00106 }
00107 
00108 CPS_END_NAMESPACE

Generated on Sat Oct 10 14:11:38 2009 for Columbia Physics System by  doxygen 1.3.9.1