This example shows how to use Yeppp! library to do cross-platform measurements of execution time using high-frequency system timer:
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <yepLibrary.h>
#define ARRAY_SIZE (1024*1024*16)
int compare_function(const void* aVoidPointer, const void* bVoidPointer) {
if (a > b)
return 1;
else if (a < b)
return -1;
else
return 0;
}
int main(int argc, char **argv) {
Yep64u startTime, endTime, time, frequency;
assert(array != NULL);
for (i = 0; i < ARRAY_SIZE; i++) {
array[i] = rand();
}
qsort(array, ARRAY_SIZE,
sizeof(
Yep32u), &compare_function);
time = endTime - startTime;
printf("Executed in %3.2lf secs\n", (double)timeSecs);
free(array);
return 0;
}