utils.cpp
Go to the documentation of this file.
00001 
00002 #include <stdlib.h>
00003 #include <sys/time.h>
00004 #include <sys/types.h>
00005 #include <sys/resource.h>
00006 #include <time.h>
00007 
00008 #include <pm_fourier/utils.h>
00009 
00010 void setRandom(){
00011 
00012   time_t t;
00013 
00014   time(&t);
00015   srand(t);
00016 
00017 }
00018 
00019 void getTime(struct rusage *t)
00020 {
00021   getrusage(RUSAGE_SELF,t);
00022 }
00023 
00027 double getTime(struct rusage one, struct rusage two)
00028 {
00029   const unsigned long as = one.ru_utime.tv_sec;
00030   const unsigned long bs = two.ru_utime.tv_sec;
00031   const unsigned long aus = one.ru_utime.tv_usec;
00032   const unsigned long bus = two.ru_utime.tv_usec;
00033 
00034   return (double)((double)bs-(double)as) + 
00035     (double)((double)bus-(double)aus) / 1000000.0;
00036 }
00037 
00038 


place_matcher_fourier
Author(s): Gaël Ecorchard , Karel Košnar , Vojtěch Vonásek
autogenerated on Sat Jun 8 2019 19:53:01