Skip to content

Commit c110904

Browse files
Formatting
1 parent f095b73 commit c110904

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
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

runtime/timer/timer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#include <fstream>
2+
13
#include "runtime/header.h"
24
#include "runtime/timer.h"
35

4-
#include <fstream>
5-
66
REGISTER_TIMER(hook, nanoseconds);
77

88
extern "C" {
@@ -22,5 +22,4 @@ block *hook_TIMER_timerStop(void) {
2222

2323
return dot_k();
2424
}
25-
2625
}

0 commit comments

Comments
 (0)