[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] build: Laufzeit messen



+ build: Am Ende des Bauens die benoetigte Zeit augeben, damit kann man
         das vielleicht mal als Benchmark benutzen.

Signed-off-by: Antoine Kaufmann <toni@xxxxxxxxxx>
---
 src/modules/c/build/main.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/modules/c/build/main.c b/src/modules/c/build/main.c
index 062c4e5..51b7658 100644
--- a/src/modules/c/build/main.c
+++ b/src/modules/c/build/main.c
@@ -37,6 +37,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
+#include <syscall.h>
 
 #include "build.h"
 
@@ -83,6 +84,9 @@ int main(int argc, char** argv)
     struct build_dir* rootdir;
     int i;
     char* rootdir_path = NULL;
+    uint64_t start_time;
+
+    start_time = get_tick_count();
 
     // Verarbeitung der Kommandozeilenparameter
     for (i = 1; i < argc; i++) {
@@ -120,5 +124,9 @@ int main(int argc, char** argv)
     // Aufraeumen
     free_directory(rootdir);
 
+    uint64_t msecs = (get_tick_count() - start_time) / 1000;
+    uint64_t secs = msecs / 1000;
+    msecs -= secs * 1000;
+    printf("Laufzeit: %lld Sec. %lld Msec.\n", secs, msecs);
     return 0;
 }
-- 
1.6.0.6