我无法在重新启动的Windows 7计算机上从远程计算机上获取性能计数器,直到我登录后1分钟到2分钟。有什么方法可以让它更快地提供吗?我使用以下代码:
PDH_STATUS status;
HQUERY perfQuery = NULL;
HCOUNTER uptimeCounter;
char uptimeCounterPath[] = "\\\\SRVJET01\\System\\System Up Time";
PDH_FMT_COUNTERVALUE uptimeValue;
DWORD seconds = 0;
if( PdhOpenQuery(NULL, 0, perfQuery ) != ERROR_SUCCESS )
return FALSE;
status = PdhAddCounter(perfQuery, uptimeCounterPath,0, &uptimeCounter );
if( status != ERROR_SUCCESS )
return FALSE;
status = PdhCollectQueryData( perfQuery );
if( status != ERROR_SUCCESS )
return FALSE;
status = PdhGetFormattedCounterValue( uptimeCounter, PDH_FMT_LARGE , NULL, &uptimeValue );
if( status != ERROR_SUCCESS )
return FALSE;
PdhCloseQuery( &perfQuery );
seconds = (DWORD) (uptimeValue.largeValue);