timer.h

来自「T264是中国在JM系列和X264的基础上寻找的新的H264编程途径」· C头文件 代码 · 共 53 行

H
53
字号
#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 + =
减小字号Ctrl + -
显示快捷键?