Files
mir_server/sdk/utils/Tick.h

63 lines
2.1 KiB
C
Raw Normal View History

2025-01-09 17:45:40 +08:00
#ifndef _MTICK_H_
#define _MTICK_H_
/******************************************************************
*
* wyLib库 2008 - 2010
*
* $ GetTickCount函数库 $
*
* - -
*
* 使64TickCountTickCount在超过49天后重新开始的问题
* 使TickCount的机制SetTickCountEx
*
*
*****************************************************************/
#include "_osdef.h"
namespace wylib
{
namespace time
{
namespace tick64
{
typedef LONGLONG TICKCOUNT64;
typedef DWORD TICKCOUNT32;
//取机器运行时间的函数,函数返回的是毫秒值,
//如果硬件支持查询PerformanceCounter则可避免49天的整数溢出的问题
/***
CPU中断会导致进入内核并可能挂起
r3级的线程
线
***/
TICKCOUNT64 GetTickCount64();
/***
* 使TickCount的机制SetTickCountEx
*
* SetTickCountEx则GetTickCountEx
* TickCount值或设置TickCount值
* 0GetTickCountEx的取值规则
***/
TICKCOUNT64 SetTickCount64(TICKCOUNT64);
TICKCOUNT32 GetTickCount32();
TICKCOUNT32 SetTickCount32(TICKCOUNT32);
#ifdef _MTICK64
typedef TICKCOUNT64 TICKCOUNT;
# define GetTickCountEx GetTickCount64
# define SetTickCountEx SetTickCount64
#else
typedef TICKCOUNT32 TICKCOUNT;
# define GetTickCountEx GetTickCount32
# define SetTickCountEx SetTickCount32
#endif
};
};
};
#endif