Skip to content

Commit 4f159db

Browse files
Formatting
1 parent f095b73 commit 4f159db

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

include/runtime/timer.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@
77
// Timers are implemented using the std::chrono::high_resolution_clock.
88
// The unit should be one of the duration types provided in std::chrono,
99
// e.g. seconds, microseconds, etc.
10-
#define REGISTER_TIMER(name, unit) \
11-
static std::chrono::high_resolution_clock::time_point name ## _clock_start; \
12-
static std::chrono::high_resolution_clock::time_point name ## _clock_stop; \
13-
void name ## _timer_start() { \
14-
name ## _clock_start = std::chrono::high_resolution_clock::now(); \
15-
} \
16-
void name ## _timer_stop() { \
17-
name ## _clock_stop = std::chrono::high_resolution_clock::now(); \
18-
} \
19-
uint64_t name ## _timer_measurement() { \
20-
return std::chrono::duration_cast<std::chrono::unit>( \
21-
name ## _clock_stop - name ## _clock_start).count(); \
10+
#define REGISTER_TIMER(name, unit) \
11+
static std::chrono::high_resolution_clock::time_point name##_clock_start; \
12+
static std::chrono::high_resolution_clock::time_point name##_clock_stop; \
13+
void name##_timer_start() { \
14+
name##_clock_start = std::chrono::high_resolution_clock::now(); \
15+
} \
16+
void name##_timer_stop() { \
17+
name##_clock_stop = std::chrono::high_resolution_clock::now(); \
18+
} \
19+
uint64_t name##_timer_measurement() { \
20+
return std::chrono::duration_cast<std::chrono::unit>( \
21+
name##_clock_stop - name##_clock_start) \
22+
.count(); \
2223
}
2324

2425
#endif // TIMER_H

0 commit comments

Comments
 (0)