X-Git-Url: https://git.llucax.com/software/dgc/cdgc.git/blobdiff_plain/60c2ff134a50c1196ebfbce3c823fcac619fd043..7b736090719c6f08e286b246d9b7509413716fcf:/rt/gc/cdgc/stats.d?ds=sidebyside diff --git a/rt/gc/cdgc/stats.d b/rt/gc/cdgc/stats.d index 1a2e8ef..b854812 100644 --- a/rt/gc/cdgc/stats.d +++ b/rt/gc/cdgc/stats.d @@ -228,8 +228,8 @@ private: cstdio.FILE* start_file(char* filename, char* header) { cstdio.FILE* file = cstdio.fopen(filename, "w"); - assert (file !is null); - cstdio.fputs(header, file); + if (file !is null) + cstdio.fputs(header, file); return file; } @@ -298,22 +298,24 @@ public: Stats this_; this_.gc = gc; if (options.malloc_stats_file[0] != '\0') { - this_.active = true; this_.mallocs_file = this_.start_file( options.malloc_stats_file.ptr, "Timestamp,Time,Pointer,Size,Collection triggered," "Finalize,No scan,No move,Pointer map,Type size," "Pointer map scan bitmask (first word, hexa)," "Pointer map pointer bitmask (first word, hexa)\n"); + if (this_.mallocs_file !is null) + this_.active = true; } // collection if (options.collect_stats_file[0] != '\0') { - this_.active = true; this_.collections_file = this_.start_file( options.collect_stats_file.ptr, "Timestamp,Malloc time,Collection time,Stop-the-world time," "Used before,Free before,Wasted before,Overhead before," "Used after,Free after,Wasted after,Overhead after\n"); + if (this_.collections_file !is null) + this_.active = true; } this_.program_start = this_.now(); return this_;