summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorA404M <ahmadmahmoudiprogrammer@gmail.com>2025-04-25 22:22:40 +0330
committerA404M <ahmadmahmoudiprogrammer@gmail.com>2025-04-25 22:22:40 +0330
commitdc26ae0b913ff49ecbf0f653b4baffa7a37f2303 (patch)
tree155ab12a41b09f3852a7a7cf10f0fabf6ab467f4 /src/main.c
parent833fbb09640e46f7e8968a1a724baf25f2a219fc (diff)
add better time printing
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 273f4ec..1e04d0b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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: ");