Skip to content

Commit

Permalink
Fix #43 , add error handling to example.
Browse files Browse the repository at this point in the history
  • Loading branch information
boazsegev committed Jan 26, 2019
1 parent 377b256 commit fb1c561
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/malloc_speed.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,21 @@ int main(void) {
/* test system allocations */
fprintf(stderr, "===== Performance Testing system memory allocator "
"(please wait):\n ");
pthread_create(&thread2, NULL, test_system_malloc, NULL);
FIO_ASSERT(pthread_create(&thread2, NULL, test_system_malloc, NULL) == 0,
"Couldn't spawn thread.");
size_t system = test_mem_functions(malloc, calloc, realloc, free);
pthread_join(thread2, &thrd_result);
FIO_ASSERT(pthread_join(thread2, &thrd_result) == 0, "Couldn't join thread");
system += (uintptr_t)thrd_result;
fprintf(stderr, "Total Cycles: %zu\n", system);

/* test facil.io allocations */
fprintf(stderr, "\n===== Performance Testing facil.io memory allocator "
"(please wait):\n");
pthread_create(&thread2, NULL, test_facil_malloc, NULL);
FIO_ASSERT(pthread_create(&thread2, NULL, test_facil_malloc, NULL) == 0,
"Couldn't spawn thread.");
size_t fio =
test_mem_functions(fio_malloc, fio_calloc, fio_realloc, fio_free);
pthread_join(thread2, &thrd_result);
FIO_ASSERT(pthread_join(thread2, &thrd_result) == 0, "Couldn't join thread");
fio += (uintptr_t)thrd_result;
fprintf(stderr, "Total Cycles: %zu\n", fio);

Expand Down

0 comments on commit fb1c561

Please sign in to comment.