From: Tomasz Littau on
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
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
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
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
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
_____________________________