Skip to content

Commit 7a3cbd0

Browse files
committed
Alter USE_TIMING_COUNTS implementation
1 parent 1d089b7 commit 7a3cbd0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/timing.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ JL_DLLEXPORT __itt_event jl_timing_ittapi_events[(int)JL_TIMING_EVENT_LAST];
5656

5757
void jl_print_timings(void)
5858
{
59+
#ifdef USE_TIMING_COUNTS
5960
uint64_t total_time = cycleclock() - t0;
6061
uint64_t root_time = total_time;
6162
for (int i = 0; i < JL_TIMING_LAST; i++) {
@@ -70,11 +71,12 @@ void jl_print_timings(void)
7071
}
7172

7273
fprintf(stderr, "\nJULIA COUNTERS\n");
73-
uint64_t val = 0;
74-
#ifdef USE_TIMING_COUNTS
75-
#define X(name) val = jl_atomic_load_relaxed(&jl_timing_counters[(int)JL_TIMING_COUNTER_##name].basic_counter); \
76-
if (val != 0) \
77-
fprintf(stderr, "%-25s : %" PRIu64 "\n", #name, val);
74+
#define X(name) do { \
75+
int64_t val = (int64_t) jl_atomic_load_relaxed(&jl_timing_counters[(int)JL_TIMING_COUNTER_##name].basic_counter); \
76+
if (val != 0) \
77+
fprintf(stderr, "%-25s : %" PRIi64 "\n", #name, val); \
78+
} while (0);
79+
7880
JL_TIMING_COUNTERS
7981
#undef X
8082
#endif

0 commit comments

Comments
 (0)