From: Tomasz Littau on 22 Sep 2006 13:39 Hello I`m new here and if this question in not for this group please tell me where i should ask about it i need to get a process cpu usage by his ID in win32, how can i do it ? best regards -- _____________________________ tlen: lemkat gg: 4891654 http:///www.lemkat.soft-pc.pl _____________________________
From: Bertel Brander on 22 Sep 2006 14:45 Tomasz Littau wrote: > Hello > > I`m new here and if this question in not for this group please tell me > where i should ask about it I think it is > i need to get a process cpu usage by his ID in win32, how can i do it ? GetProcessTimes: http://windowssdk.msdn.microsoft.com/en-us/library/ms683223.aspx -- Just another homepage: http://damb.dk But it's mine - Bertel
From: Tomasz Littau on 22 Sep 2006 15:18 Bertel Brander napisa?(a): > Tomasz Littau wrote: >> Hello >> >> I`m new here and if this question in not for this group please tell me >> where i should ask about it > > I think it is > >> i need to get a process cpu usage by his ID in win32, how can i do it ? > > GetProcessTimes: > > http://windowssdk.msdn.microsoft.com/en-us/library/ms683223.aspx > Thank you -- _____________________________ tlen: lemkat gg: 4891654 http:///www.lemkat.soft-pc.pl _____________________________
From: Tomasz Littau on 23 Sep 2006 08:03 Bertel Brander napisa?(a): > Tomasz Littau wrote: >> Hello >> >> I`m new here and if this question in not for this group please tell me >> where i should ask about it > > I think it is > >> i need to get a process cpu usage by his ID in win32, how can i do it ? > > GetProcessTimes: > > http://windowssdk.msdn.microsoft.com/en-us/library/ms683223.aspx > Thank you, could some one give me some sample code how can i calculate this cpu usage by process using GetProcessTime(), best in c++ thanks a lot -- _____________________________ tlen: lemkat gg: 4891654 http:///www.lemkat.soft-pc.pl _____________________________
From: Tomasz Littau on 23 Sep 2006 08:30 Bertel Brander napisa?(a): > Tomasz Littau wrote: >> Hello >> >> I`m new here and if this question in not for this group please tell me >> where i should ask about it > > I think it is > >> i need to get a process cpu usage by his ID in win32, how can i do it ? > > GetProcessTimes: > > http://windowssdk.msdn.microsoft.com/en-us/library/ms683223.aspx > Thank you, could some one give me some sample code how can i calculate this cpu usage by process using GetProcessTime(), best in c++ i write something like this but it not work: int TFMain::iFunGetCpuProcUsage( HANDLE hHandle ) { LONG lKernel, lUser, lProcTime; int iProcUsage; DWORD dwTime; FILETIME ftCreate, ftExit, ftUser, ftKernel, ftNewUser, ftNewKernel; DWORD dwOldTime, dwNewTime; dwOldTime = timeGetTime(); GetProcessTimes( hHandle, &ftCreate, &ftExit, &ftUser, &ftKernel ); dwNewTime = timeGetTime(); GetProcessTimes( hHandle, &ftCreate, &ftExit, &ftNewUser, &ftNewKernel ); lKernel = ftNewKernel.dwLowDateTime - ftKernel.dwLowDateTime; lUser = ftNewUser.dwLowDateTime - ftUser.dwLowDateTime; lProcTime = lKernel + lUser; dwTime = dwNewTime-dwOldTime; if( dwTime == 0 ) { Sleep( 100 ); dwNewTime = timeGetTime(); dwTime = dwNewTime-dwOldTime; } iProcUsage = ( (lProcTime*100 ) / dwTime ); return iProcUsage; } -- _____________________________ tlen: lemkat gg: 4891654 http:///www.lemkat.soft-pc.pl _____________________________
|
Next
|
Last
Pages: 1 2 Prev: how to find source of conflicting dll Next: PDH_CSTATUS_NO_OBJECT - but why ? |