@@ -319,6 +319,7 @@ UnifiedStatsReporter::UnifiedStatsReporter(StringRef ProgramName,
319319 StringRef Directory,
320320 SourceManager *SM,
321321 clang::SourceManager *CSM,
322+ bool FineGrainedTimers,
322323 bool TraceEvents,
323324 bool ProfileEvents,
324325 bool ProfileEntities)
@@ -329,7 +330,7 @@ UnifiedStatsReporter::UnifiedStatsReporter(StringRef ProgramName,
329330 OutputType,
330331 OptType),
331332 Directory,
332- SM, CSM,
333+ SM, CSM, FineGrainedTimers,
333334 TraceEvents, ProfileEvents, ProfileEntities)
334335{
335336}
@@ -339,6 +340,7 @@ UnifiedStatsReporter::UnifiedStatsReporter(StringRef ProgramName,
339340 StringRef Directory,
340341 SourceManager *SM,
341342 clang::SourceManager *CSM,
343+ bool FineGrainedTimers,
342344 bool TraceEvents,
343345 bool ProfileEvents,
344346 bool ProfileEntities)
@@ -355,7 +357,8 @@ UnifiedStatsReporter::UnifiedStatsReporter(StringRef ProgramName,
355357 SourceMgr(SM),
356358 ClangSourceMgr(CSM),
357359 RecursiveTimers(std::make_unique<RecursionSafeTimers>()),
358- IsFlushingTracesAndProfiles(false )
360+ IsFlushingTracesAndProfiles(false ),
361+ FineGrainedTimers(FineGrainedTimers)
359362{
360363 path::append (StatsFilename, makeStatsFileName (ProgramName, AuxName));
361364 path::append (TraceFilename, makeTraceFileName (ProgramName, AuxName));
@@ -453,20 +456,22 @@ UnifiedStatsReporter::printAlwaysOnStatsAndTimers(raw_ostream &OS) {
453456 const char *delim = " " ;
454457 if (FrontendCounters) {
455458 auto &C = getFrontendCounters ();
456- #define FRONTEND_STATISTIC (TY, NAME ) \
457- do { \
458- OS << delim << " \t\" " #TY " ." #NAME " \" : " << C.NAME ; \
459- delim = " ,\n " ; \
459+ #define FRONTEND_STATISTIC (TY, NAME ) \
460+ do { \
461+ if (C.NAME ) \
462+ OS << delim << " \t\" " #TY " ." #NAME " \" : " << C.NAME ; \
463+ delim = " ,\n " ; \
460464 } while (0 );
461465#include " swift/Basic/Statistics.def"
462466#undef FRONTEND_STATISTIC
463467 }
464468 if (DriverCounters) {
465469 auto &C = getDriverCounters ();
466- #define DRIVER_STATISTIC (NAME ) \
467- do { \
468- OS << delim << " \t\" Driver." #NAME " \" : " << C.NAME ; \
469- delim = " ,\n " ; \
470+ #define DRIVER_STATISTIC (NAME ) \
471+ do { \
472+ if (C.NAME ) \
473+ OS << delim << " \t\" Driver." #NAME " \" : " << C.NAME ; \
474+ delim = " ,\n " ; \
470475 } while (0 );
471476#include " swift/Basic/Statistics.def"
472477#undef DRIVER_STATISTIC
0 commit comments