From a5e206d009b86e5134d7749e0d0677554328e887 Mon Sep 17 00:00:00 2001 From: dzaima Date: Tue, 26 Jul 2022 03:14:05 +0300 Subject: [PATCH] always print sample sum in the profiler --- src/vm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vm.c b/src/vm.c index c23f563e..cd311ff6 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1520,16 +1520,19 @@ void profiler_displayResults() { Comp* c = c(Comp, GetU(compList, i)); B mapObj = GetU(mapList, i); i32* m = i32arr_ptr(mapObj); + + u64 sum = 0; + usz ia = a(mapObj)->ia; + for (usz i = 0; i < ia; i++) sum+= m[i]; + if (q_N(c->src)) { if (q_N(c->path)) printf("(anonymous)"); else printRaw(c->path); - u64 sum = 0; - usz ia = a(mapObj)->ia; for (usz i = 0; i < ia; i++) sum+= m[i]; printf(": "N64d" samples\n", sum); } else { if (q_N(c->path)) printf("(anonymous)"); else printRaw(c->path); - printf(":\n"); + printf(": "N64d" samples:\n", sum); B src = c->src; SGetU(src) usz sia = a(src)->ia;