Blender V2.61 - r43446

superlu_timer.c

Go to the documentation of this file.
00001 
00004 /* 
00005  * Purpose
00006  * ======= 
00007  *  Returns the time in seconds used by the process.
00008  *
00009  * Note: the timer function call is machine dependent. Use conditional
00010  *       compilation to choose the appropriate function.
00011  *
00012  */
00013 
00014 /* We want this flag, safer than putting in build system */
00015 #define NO_TIMER
00016 
00017 double  SuperLU_timer_ ();
00018 
00019 #ifdef SUN 
00020 /*
00021  *  It uses the system call gethrtime(3C), which is accurate to 
00022  *  nanoseconds. 
00023 */
00024 #include <sys/time.h>
00025  
00026 double SuperLU_timer_() {
00027     return ( (double)gethrtime() / 1e9 );
00028 }
00029 
00030 #else
00031 
00032 #ifndef NO_TIMER
00033 #include <sys/types.h>
00034 #include <sys/times.h>
00035 #include <time.h>
00036 #include <sys/time.h>
00037 #endif
00038 
00039 #ifndef CLK_TCK
00040 #define CLK_TCK 60
00041 #endif
00042 double SuperLU_timer_(void);
00043 
00044 double SuperLU_timer_(void)
00045 {
00046 #ifdef NO_TIMER
00047     /* no sys/times.h on WIN32 */
00048     double tmp;
00049     tmp = 0.0;
00050 #else
00051     struct tms use;
00052     double tmp;
00053     times(&use);
00054     tmp = use.tms_utime;
00055     tmp += use.tms_stime;
00056 #endif
00057     return (double)(tmp) / CLK_TCK;
00058 }
00059 
00060 #endif
00061