38 lines
554 B
C
38 lines
554 B
C
#ifndef TIMER_H
|
|
#define TIMER_H
|
|
|
|
#include "aliases.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct {
|
|
const char *title;
|
|
u64 start;
|
|
u64 end;
|
|
} profiler_sample_t;
|
|
|
|
u64 get_os_frequency();
|
|
|
|
// Time in nanoseconds
|
|
u64 get_os_time(void);
|
|
|
|
// CPU timer using rdtsc
|
|
u64 read_cpu_timer(void);
|
|
|
|
// CPU frequency in hz/sec
|
|
u64 get_cpu_freq(u64 milliseconds);
|
|
|
|
void profile_start();
|
|
void profile_end();
|
|
|
|
profiler_sample_t sample_start(const char *title);
|
|
void sample_end(profiler_sample_t *sample);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // !TIMER_H
|