Skip to content

Commit 5025964

Browse files
committed
Basic: Don't print zero counters
1 parent c77fae3 commit 5025964

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/Basic/Statistic.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,20 +456,22 @@ UnifiedStatsReporter::printAlwaysOnStatsAndTimers(raw_ostream &OS) {
456456
const char *delim = "";
457457
if (FrontendCounters) {
458458
auto &C = getFrontendCounters();
459-
#define FRONTEND_STATISTIC(TY, NAME) \
460-
do { \
461-
OS << delim << "\t\"" #TY "." #NAME "\": " << C.NAME; \
462-
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"; \
463464
} while (0);
464465
#include "swift/Basic/Statistics.def"
465466
#undef FRONTEND_STATISTIC
466467
}
467468
if (DriverCounters) {
468469
auto &C = getDriverCounters();
469-
#define DRIVER_STATISTIC(NAME) \
470-
do { \
471-
OS << delim << "\t\"Driver." #NAME "\": " << C.NAME; \
472-
delim = ",\n"; \
470+
#define DRIVER_STATISTIC(NAME) \
471+
do { \
472+
if (C.NAME) \
473+
OS << delim << "\t\"Driver." #NAME "\": " << C.NAME; \
474+
delim = ",\n"; \
473475
} while (0);
474476
#include "swift/Basic/Statistics.def"
475477
#undef DRIVER_STATISTIC

0 commit comments

Comments
 (0)