mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-18 21:29:18 +02:00
Cleaned-up timing code
This commit is contained in:
parent
e4eae1cdf9
commit
535f2737b1
2 changed files with 4 additions and 19 deletions
|
@ -96,12 +96,12 @@ void Cyc_check_bounds(void *data, const char *label, int len, int index)
|
|||
|
||||
#ifdef CYC_HIGH_RES_TIMERS
|
||||
/* High resolution timers */
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
long long hrt_get_current()
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL); /* TODO: longer-term consider using clock_gettime instead */
|
||||
long long jiffy = (tv.tv_sec)*1000000LL + tv.tv_usec;
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
long long jiffy = (now.tv_sec)*1000000LL + now.tv_nsec/1000; // nano->microseconds
|
||||
return jiffy;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,21 +26,6 @@
|
|||
make_double(box, 0.0);
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
long long jiffy = (now.tv_sec)*1000000LL + now.tv_nsec/1000; // nano->microseconds
|
||||
/* Future consideration:
|
||||
mp_int bn_tmp, bn_tmp2, bn_tmp3;
|
||||
mp_init(&bn_tmp);
|
||||
mp_init(&bn_tmp2);
|
||||
mp_init(&bn_tmp3);
|
||||
Cyc_int2bignum(tv.tv_sec, &bn_tmp);
|
||||
Cyc_int2bignum(1000000LL, &bn_tmp2);
|
||||
Cyc_int2bignum(tv.tv_usec, &bn_tmp3);
|
||||
alloc_bignum(data, box);
|
||||
mp_mul(&bn_tmp, &bn_tmp2, &bn_tmp);
|
||||
mp_add(&bn_tmp, &bn_tmp3, &bignum_value(box));
|
||||
mp_clear(&bn_tmp);
|
||||
mp_clear(&bn_tmp2);
|
||||
mp_clear(&bn_tmp3);
|
||||
*/
|
||||
double_value(&box) = jiffy;
|
||||
return_closcall1(data, k, &box); ")
|
||||
(define-c jiffies-per-second
|
||||
|
|
Loading…
Add table
Reference in a new issue