📄 timer.h
字号:
#ifndef _TIMER_H_
#define _TIMER_H_
#include "portab.h"
typedef struct
{
int64_t all;
int64_t start;
int64_t overhead;
} timer_st;
#ifdef ENABLE_PROFILE
static __inline void
start_timer(timer_st* t)
{
t->start = read_counter();
}
static __inline void
stop_timer_all(timer_st* t)
{
t->all += read_counter() - t->start - t->overhead;
}
static __inline void
init_timer(timer_st* t)
{
memset(t, 0, sizeof(*t));
start_timer(t);
t->overhead = read_counter() - t->start;
}
#else // ENABLE_PROFILE
static __inline void
start_timer(timer_st* t)
{
}
static __inline void
stop_timer_all(timer_st* t)
{
}
static __inline void
init_timer(timer_st* t)
{
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -