42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
#include "repetition_tester.c"
|
|
#include "store_uop.h"
|
|
|
|
int main() {
|
|
typedef void (*test_cb)(uint8_t *buffer, uint64_t byte_count);
|
|
struct testcase {
|
|
char *name;
|
|
test_cb cb;
|
|
};
|
|
|
|
struct testcase cases[] = {
|
|
{ .name = "mov_store_x1()", .cb = mov_store_x1 },
|
|
{ .name = "mov_store_x2()", .cb = mov_store_x2 },
|
|
{ .name = "mov_store_x3()", .cb = mov_store_x3 },
|
|
{ .name = "mov_store_x4()", .cb = mov_store_x4 },
|
|
};
|
|
|
|
struct repetitor repetitor = {};
|
|
repetitor_init(&repetitor);
|
|
printf("CPU Frequency: %ldHz (~%.2fGHz)\n", repetitor.cpu_freq, (float)repetitor.cpu_freq/(1000*1000*1000));
|
|
|
|
uint64_t byte_count = 4096 * 1024;
|
|
uint8_t buffer[byte_count];
|
|
|
|
for (int i = 0; i < ARRAY_LEN(cases); i++) {
|
|
struct testcase *testcase = &cases[i];
|
|
repetitor_clear(&repetitor);
|
|
while (repetitor_repeat(&repetitor, 2)) {
|
|
repetitor_start(&repetitor);
|
|
repetitor_measure_start(&repetitor);
|
|
testcase->cb(buffer, byte_count);
|
|
repetitor_measure_stop(&repetitor, byte_count);
|
|
repetitor_stop(&repetitor);
|
|
}
|
|
repetitor_print_results_label(&repetitor, testcase->name);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
|