|
[求助]Windows下可以达到1ms的休眠,或1ms级别的线程切换吗?
恩,是用QueryPerformanceCounter来计算的,是它测量有问题吗? |
|
[求助]Windows下可以达到1ms的休眠,或1ms级别的线程切换吗?
经过测试,北极星的方法可行,不过有些问题出现. timeBeginPeriod(1); m_hEvent=::CreateEvent(NULL,TRUE,FALSE,NULL); InitBenchmark();//初始化计时器 BM_START(1);//开始计时 for(int i=0;i<100;i++) { ::WaitForSingleObject(m_hEvent,1); } BM_END(1);//停止计时 timeEndPeriod(1); ConsoleWrite();//输出计时结果 循环100次的时候,耗时要么是150ms左右,要么是200ms左右. 但是如果只进行一次的时候,有1900us(1.9ms)的,有15000us(15ms)的,也有6200us(6.2ms)的,还有-44000us(-4.4ms)的.很奇怪的是,基本只有这几种结果,其中15ms出现得最多.这是什么原因呢? |
|
[求助]Windows下可以达到1ms的休眠,或1ms级别的线程切换吗?
这个最简单,我试一下,驱动不会写,调用zw开头的函数也不会,正在学,呵呵 |
|
[求助]Windows下可以达到1ms的休眠,或1ms级别的线程切换吗?
在我这里的双核机器上,主线程发出一个信号立刻sleep,另一个线程接到信号立刻输出耗时,一般耗时20ms左右,不知道双核和单核的机器上是否相同 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值