12345678910111213141516171819(* print GC statistics; taken from Cil.Stats.print which also includes timing; there's also Gc.print_stat, but it's in words instead of MB and more info than we want (also slower than quick_stat since it goes through the heap) *)letprint_quick_statchn=letgc=Gc.quick_stat()inletprintM(w:float):string=letcoeff=float_of_int(Sys.word_size/8)inPrintf.sprintf"%.2fMB"(w*.coeff/.1000000.0)inPrintf.fprintfchn"Memory statistics: total=%s, max=%s, minor=%s, major=%s, promoted=%s\n minor collections=%d major collections=%d compactions=%d\n"(printM(gc.Gc.minor_words+.gc.Gc.major_words-.gc.Gc.promoted_words))(printM(float_of_intgc.Gc.top_heap_words))(printMgc.Gc.minor_words)(printMgc.Gc.major_words)(printMgc.Gc.promoted_words)gc.Gc.minor_collectionsgc.Gc.major_collectionsgc.Gc.compactions;gc