EVSL  1.1.0
EigenValues Slicing Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
timing.c
Go to the documentation of this file.
1 #include <time.h>
2 #include <math.h>
3 #ifdef USE_MKL
4 #include <mkl.h>
5 #endif
6 
15 double evsl_timer() {
16 #ifdef USE_MKL
17  return dsecnd();
18 #else
19  /* POSIX C 1993 timer, requires -librt */
20  struct timespec t ;
21  clock_gettime (CLOCK_MONOTONIC /*CLOCK_PROCESS_CPUTIME_ID*/, &t) ;
22  return ((double) (t.tv_sec) + 1e-9 * (double) (t.tv_nsec));
23 #endif
24 }
25 
30 int time_seeder() {
31  double t1,t2;
32  int iseed, zero=0;
33  t1 = evsl_timer();
34  t1 = 1.e+09*frexp(t1, &zero);
35  t1 = modf(t1, &t2);
36  iseed = (int)(1.e+05*t1);
37  return (iseed);
38 }
39 
int time_seeder()
Uses the timer to generate a seed to be used for srand..
Definition: timing.c:30
double evsl_timer()
cheblan timer
Definition: timing.c:15