Created
May 18, 2015 22:12
-
-
Save tstellanova/927084e8ba1bf7c56fcd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <uuid/uuid.h> | |
| #include <time.h> | |
| #include <stdio.h> | |
| #include <ctime> | |
| int main(void) | |
| { | |
| uuid_t blob = {}; | |
| clock_t startTime = clock(); | |
| const int totalRuns = 1E6; | |
| for (int i = 0; i < totalRuns; i++) { | |
| uuid_generate_time(blob); | |
| } | |
| clock_t endTime = clock(); | |
| char outbuf[512]; | |
| uuid_unparse(blob, outbuf); | |
| double elapsed_secs = double(endTime - startTime) / CLOCKS_PER_SEC; | |
| double elapsed_usec = elapsed_secs * 1E6; | |
| double per_run = (elapsed_usec / totalRuns); | |
| printf("%0.6f usec per run\n",per_run); | |
| printf("last uuid: %s \n",outbuf); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment