aboutsummaryrefslogtreecommitdiff
path: root/tools/tool.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-08-13 16:38:21 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2025-08-13 16:38:21 +0100
commit9b94c7d039341afb8609075da0ce52a7a7aa705a (patch)
treeddfc26411eed421a03870e163e62e24d6ff2961a /tools/tool.h
parentc368c0f4aa0a810f5102cb8958e57410e572afa8 (diff)
downloadnissy-core-9b94c7d039341afb8609075da0ce52a7a7aa705a.tar.gz
nissy-core-9b94c7d039341afb8609075da0ce52a7a7aa705a.zip
More build.bat options
Diffstat (limited to '')
-rw-r--r--tools/tool.h36
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
29static double
30timerun(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
25static double 59static double
26timerun(void (*run)(void)) 60timerun(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
54static void 90static void
55writetable(const unsigned char *buf, int64_t size, const char *filename) 91writetable(const unsigned char *buf, int64_t size, const char *filename)
56{ 92{

Generated with cgit - Back to sebastiano.tronto.net