65.9K
CodeProject 正在变化。 阅读更多。
Home

移动处理器使用情况

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.80/5 (9投票s)

2010 年 12 月 2 日

CPOL
viewsIcon

19444

您是否好奇您的 Windows Mobile 设备的处理器有多忙? 试试这段使用 GetIdleTime() 的代码。
DWORD start = ::GetTickCount();
DWORD idle_start = ::GetIdleTime();
Sleep( 1000 );
DWORD stop = ::GetTickCount();
DWORD idle_end = ::GetIdleTime();
float percent_used = 100 - ( 100.0f * ( idle_end - idle_start ) ) / static_cast< float >( stop - start );
NKDbgPrintfW( L"Processor usage: %d%%\r\n", ( int )percent_used );
对我来说,它打印:处理器使用率:3% 享受吧!
© . All rights reserved.