|
|
@ -8,6 +8,7 @@ |
|
|
|
#include <unistd.h> |
|
|
|
#include <unistd.h> |
|
|
|
#include <errno.h> |
|
|
|
#include <errno.h> |
|
|
|
#include <err.h> |
|
|
|
#include <err.h> |
|
|
|
|
|
|
|
#include <time.h> |
|
|
|
|
|
|
|
|
|
|
|
#include "util.h" |
|
|
|
#include "util.h" |
|
|
|
|
|
|
|
|
|
|
@ -108,3 +109,18 @@ void print_byte(unsigned char byte) |
|
|
|
{ |
|
|
|
{ |
|
|
|
printf("%s%s", bit_rep[byte >> 4], bit_rep[byte & 0x0F]); |
|
|
|
printf("%s%s", bit_rep[byte >> 4], bit_rep[byte & 0x0F]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static struct timespec clock_start, clock_stop; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void stopwatch_start(void) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
clock_gettime(CLOCK_MONOTONIC_COARSE, &clock_start); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double stopwatch_get(void) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
clock_gettime(CLOCK_MONOTONIC_COARSE, &clock_stop); |
|
|
|
|
|
|
|
return (clock_stop.tv_sec-clock_start.tv_sec)+(double)(clock_stop.tv_nsec-clock_start.tv_nsec)/(double)1000000000L; |
|
|
|
|
|
|
|
} |