2 Test performance of native C UUID generation
4 To Compile: cc -luuid benchmark-native.c -o benchmark-native
10 #include <uuid/uuid.h>
19 gettimeofday(&t, NULL);
20 start = t.tv_sec + t.tv_usec/1e6;
23 for (i = 0; i < n; i++) {
25 uuid_unparse(myid, buf);
28 gettimeofday(&t, NULL);
29 finish = t.tv_sec + t.tv_usec/1e6;
30 double dur = finish - start;
32 printf("%d uuids/sec", (int)(n/dur));