#include "repetition_tester.c" int main() { 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 * 8); while (repeat_cycle_times(&repetitor, 3)) { repetitor_clear(&repetitor); while (repetitor_repeat(&repetitor, 2)) { repetitor_start(&repetitor); uint8_t *buffer = malloc(sizeof(uint8_t) * byte_count); repetitor_measure_start(&repetitor); for (int i = 0; i < byte_count; i++) { buffer[i] = (uint8_t)i; } repetitor_measure_stop(&repetitor, byte_count); free(buffer); repetitor_stop(&repetitor); } repetitor_print_results_label(&repetitor, "write forward"); repetitor_clear(&repetitor); while (repetitor_repeat(&repetitor, 2)) { repetitor_start(&repetitor); uint8_t *buffer = malloc(sizeof(uint8_t) * byte_count); repetitor_measure_start(&repetitor); for (int i = 0; i < byte_count; i++) { buffer[byte_count - i - 1] = (uint8_t)i; } repetitor_measure_stop(&repetitor, byte_count); free(buffer); repetitor_stop(&repetitor); } repetitor_print_results_label(&repetitor, "write backward"); } return 0; }