diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-25 22:22:40 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-25 22:22:40 +0330 |
commit | dc26ae0b913ff49ecbf0f653b4baffa7a37f2303 (patch) | |
tree | 155ab12a41b09f3852a7a7cf10f0fabf6ab467f4 /src/main.c | |
parent | 833fbb09640e46f7e8968a1a724baf25f2a219fc (diff) |
add better time printing
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -11,12 +11,14 @@ static int run(const char *filePath) { #ifdef PRINT_STATISTICS struct timespec start, end; + struct timespec lexTime = {0}; + struct timespec parseTime = {0}; struct timespec astTime; struct timespec runTime; struct timespec totalTime = {0}; clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start); #endif - AstTreeRoots astTrees = makeAstTree(filePath); + AstTreeRoots astTrees = makeAstTree(filePath, &lexTime, &parseTime); if (astTrees.size == AST_TREE_ROOTS_ERROR.size) { return 1; } @@ -48,6 +50,12 @@ static int run(const char *filePath) { #endif #ifdef PRINT_STATISTICS + astTime = time_diff(astTime, parseTime); + parseTime = time_diff(parseTime, lexTime); + printf("\nlexTime: "); + time_print(lexTime); + printf("\nparseTime: "); + time_print(parseTime); printf("\nastTime: "); time_print(astTime); printf("\nrunTime: "); |