diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-08-13 16:38:21 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-08-13 16:38:21 +0100 |
| commit | 9b94c7d039341afb8609075da0ce52a7a7aa705a (patch) | |
| tree | ddfc26411eed421a03870e163e62e24d6ff2961a /tools | |
| parent | c368c0f4aa0a810f5102cb8958e57410e572afa8 (diff) | |
| download | nissy-core-9b94c7d039341afb8609075da0ce52a7a7aa705a.tar.gz nissy-core-9b94c7d039341afb8609075da0ce52a7a7aa705a.zip | |
More build.bat options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/tool.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/tool.h b/tools/tool.h index 47155c2..c6fafbc 100644 --- a/tools/tool.h +++ b/tools/tool.h | |||
| @@ -22,6 +22,40 @@ log_stderr(const char *str, void *unused) | |||
| 22 | fprintf(stderr, "%s", str); | 22 | fprintf(stderr, "%s", str); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | #ifdef _WIN32 | ||
| 26 | |||
| 27 | #include <windows.h> | ||
| 28 | |||
| 29 | static double | ||
| 30 | timerun(void (*run)(void)) | ||
| 31 | { | ||
| 32 | LARGE_INTEGER freq, start, end; | ||
| 33 | double tdiff; | ||
| 34 | |||
| 35 | fflush(stdout); | ||
| 36 | |||
| 37 | if (run == NULL) { | ||
| 38 | printf("nothing to run!\n"); | ||
| 39 | fflush(stdout); | ||
| 40 | return -1.0; | ||
| 41 | } | ||
| 42 | |||
| 43 | QueryPerformanceFrequency(&freq); | ||
| 44 | QueryPerformanceCounter(&start); | ||
| 45 | run(); | ||
| 46 | QueryPerformanceCounter(&end); | ||
| 47 | |||
| 48 | tdiff = (double)(end.QuadPart - start.QuadPart) / freq.QuadPart; | ||
| 49 | |||
| 50 | printf("---------\n"); | ||
| 51 | printf("\nTotal time: %.4fs\n", tdiff); | ||
| 52 | fflush(stdout); | ||
| 53 | |||
| 54 | return tdiff; | ||
| 55 | } | ||
| 56 | |||
| 57 | #else | ||
| 58 | |||
| 25 | static double | 59 | static double |
| 26 | timerun(void (*run)(void)) | 60 | timerun(void (*run)(void)) |
| 27 | { | 61 | { |
| @@ -51,6 +85,8 @@ timerun(void (*run)(void)) | |||
| 51 | return tdiff; | 85 | return tdiff; |
| 52 | } | 86 | } |
| 53 | 87 | ||
| 88 | #endif | ||
| 89 | |||
| 54 | static void | 90 | static void |
| 55 | writetable(const unsigned char *buf, int64_t size, const char *filename) | 91 | writetable(const unsigned char *buf, int64_t size, const char *filename) |
| 56 | { | 92 | { |
