Add -DIDRIS_ENABLE_STATS to CodegenC. Add missing #ifdef IDRIS_ENABLED_STATS in rts/idris_gc.c.
commit035e15b40af6278d5214bce123ffb587eb48da65
authorstepcut <jeremy@n-heptane.com>
dateFri 26 Sep 2014, 10:47 (12 years ago)
parent80a2913
config.mk+1
@@ -1,6 +1,7 @@
11CC ?=cc
22CABAL :=cabal
33# IDRIS_ENABLE_STATS should not be set in final release
4+# Any flags defined here which alter the RTS API must also be added to src/IRTS/CodegenC.hs
45CFLAGS :=-O2 -Wall -DHAS_PTHREAD -DIDRIS_ENABLE_STATS $(CFLAGS)
56
67#CABALFLAGS :=
rts/idris_gc.c+3−1
@@ -151,7 +151,9 @@ void idris_gcInfo(VM* vm, int doGC) {
151151 printf("Final heap use %d\n", (int)(vm->heap.next - vm->heap.heap));
152152 if (doGC) { idris_gc(vm); }
153153 printf("Final heap use after GC %d\n", (int)(vm->heap.next - vm->heap.heap));
154−
154+#ifdef IDRIS_ENABLE_STATS
155155 printf("Total allocations %d\n", vm->stats.allocations);
156+#endif
156157 printf("Number of collections %d\n", vm->stats.collections);
158+
157159}
src/IRTS/CodegenC.hs+2−1
@@ -67,7 +67,8 @@ codegenC' defs out exec incs objs libs flags dbg
6767 let gcc = comp ++ " " ++
6868 gccDbg dbg ++ " " ++
6969 gccFlags ++
70− " -DHAS_PTHREAD " ++
70+ -- # Any flags defined here which alter the RTS API must also be added to config.mk
71+ " -DHAS_PTHREAD -DIDRIS_ENABLE_STATS" ++
7172 " -I. " ++ objs ++ " -x c " ++
7273 (if (exec == Executable) then "" else " -c ") ++
7374 " " ++ tmpn ++