1#ifndef BENCHMARKS_UTILS_C
2#define BENCHMARKS_UTILS_C
9static inline void hal_init_perfcounters(
int do_reset,
int enable_divider);
10static unsigned long long get_nanos(
void);
11static unsigned long long get_timestamp(
void);
16static unsigned long long get_timestamp(
void) {
18 unsigned long long timestamp = 0;
19#if (defined(CYCLES) && (defined(AARCH64) || defined(ARMV7l)))
21#elif (defined(CYCLES) && defined(x8664))
22 timestamp = (
unsigned long long) getticks();
24 timestamp = get_nanos();
30static unsigned long long get_nanos(
void)
33 timespec_get(&ts, TIME_UTC);
34 return (
unsigned long long)ts.tv_sec * 1000000000ull + ts.tv_nsec;
41 statsFile = fopen(file_name,
"w+");
43 fprintf(statsFile,
"No.,2-isogeny-walk,3-isogeny-walk\n");
47 fprintf(statsFile,
"%d,%llu,%llu\n",
i, (
unsigned long long)two_isogeny_walk[
i], (
unsigned long long)three_isogeny_walk[
i]);
54static inline void hal_init_perfcounters(
int do_reset,
int enable_divider)
60 printf(
"%d, %d\n", do_reset, enable_divider);
79 asm volatile (
"MCR p15, 0, %0, c9, c12, 0\t\n" ::
"r"(value));
82 asm volatile (
"MCR p15, 0, %0, c9, c12, 1\t\n" ::
"r"(0x8000000f));
85 asm volatile (
"MCR p15, 0, %0, c9, c12, 3\t\n" ::
"r"(0x8000000f));
void printStatisticsFile(const char *file_name, ticks *two_isogeny_walk, ticks *three_isogeny_walk)
#define NUMBER_OF_BENCHMARK_EXPERIMENTS