int main() { printf("Measuring unlocked cmpxchg:\n"); time_func(LOOPS, loop_cmpxchg); printf("Measuring locked cmpxchg:\n"); time_func(LOOPS, loop_cmpxchg_locked); printf("Measuring implicit locked xchg:\n"); time_func(LOOPS, loop_xchg); return 0; }
void list_tests(void) { unsigned int millis; printf("Running list performance tests.\n"); printf("Running list_append() tests.\n"); millis = time_func(_test_append); printf("Test took %d sec %d millis CPU time\n", (int)(millis / 1000), (int)(millis % 1000)); printf("Running list_remove() tests.\n"); millis = time_func(_test_remove); printf("Test took %d sec %d millis CPU time\n", (int)(millis / 1000), (int)(millis % 1000)); printf("Completed list tests.\n"); }
int main() { printf("Measuring syscall getuid:\n"); time_func(LOOPS, loop_syscall_getuid); return 0; }
void compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a, void (*func_a), const char *name_b, void (*func_b)) { timedelta_t timer_a, timer_b; char ratio_buf[6]; time_func(&timer_a, nwarmup, niter, func_a); time_func(&timer_b, nwarmup, niter, func_b); timer_ratio(&timer_a, &timer_b, ratio_buf, sizeof(ratio_buf)); malloc_printf("%"PRIu64" iterations, %s=%"PRIu64"us, " "%s=%"PRIu64"us, ratio=1:%s\n", niter, name_a, timer_usec(&timer_a), name_b, timer_usec(&timer_b), ratio_buf); }
int main(int argc, char **argv) { // DynArray array_1(??); // get argument from command line (how many consecutive appends?) ul_int n = atoi(argv[1]); // measure time for each call time_func(&array_1, n); return 0; }