Use sample_start and sample_end pairs instead of the PROFILER_SAMPLE
macro
This commit is contained in:
@@ -3,17 +3,16 @@
|
||||
|
||||
#include "aliases.h"
|
||||
|
||||
// TODO (Abdelrahman): Not fully satisfied with this solution
|
||||
#define PROFILER_SAMPLE(ID, TITLE, CODE) \
|
||||
u64 ID##_start = read_cpu_timer(); \
|
||||
CODE; \
|
||||
u64 ID##_end = read_cpu_timer(); \
|
||||
add_sample(TITLE, ID##_end - ID##_start);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
const char *title;
|
||||
u64 start;
|
||||
u64 end;
|
||||
} profiler_sample_t;
|
||||
|
||||
u64 get_os_frequency();
|
||||
|
||||
// Time in nanoseconds
|
||||
@@ -28,7 +27,8 @@ u64 get_cpu_freq(u64 milliseconds);
|
||||
void profile_start();
|
||||
void profile_end();
|
||||
|
||||
void add_sample(const char *title, u64 duration);
|
||||
profiler_sample_t sample_start(const char *title);
|
||||
void sample_end(profiler_sample_t *sample);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user