CPU Usage...

delphi package - easy access to kernel objects etc.
Post Reply
stOrM!
Posts: 51
Joined: Thu Jul 15, 2004 7:38 pm

CPU Usage...

Post by stOrM! »

Can someone show / tell me please:

IProcess.GetTimes whats the meaning of Creation, Exit, Kernel, User is?
And maybe how to covert them into human readable values like cpu usage % and so on?

best regards
s!
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

See the Microsoft documentation of GetProcessTimes. Unfortunately this doesn't work in win9x (it's one of the very few things in madKernel, which is limited to one OS family).
stOrM!
Posts: 51
Joined: Thu Jul 15, 2004 7:38 pm

re

Post by stOrM! »

Back from M$ now :D
Ok Madshi I guess I understand the values now, but still unsure how to get the cpu usage for a process because of your function like 10 % so on...

regards
s!
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

That's not easy, I guess. I think you have to check e.g. every second what the three values combined are. E.g. let's say at time X those values are 50. Then one second later the values are 60. Now you can calculate how high the CPU usage for that one second was. Sorry, but I don't have the time to write code for you now. Perhaps you can find some help in google by using for GetProcessTimes and "cpu usage" or something like that?
stOrM!
Posts: 51
Joined: Thu Jul 15, 2004 7:38 pm

re

Post by stOrM! »

That makes sense madshi!
Really not an easy task, thats while I'm here praying for help :D
I was googling the whole day now, not much what I've found mostly c-based things which looks more cryptical to me then my bank account...

cpu usage I've found alot about, but not for single processes like you can see in the normal taskman for windows... with the cpu usage I've play'd around with earlier but noticed that I had to put it in a seperate thread because it takes 100 % for calculating everything freezed :D but with a seperate thread works fine...

regards
s!
stOrM!
Posts: 51
Joined: Thu Jul 15, 2004 7:38 pm

re

Post by stOrM! »

Phew!
I really was searching long for a solution but now I think I have it :D
Thank you Madshi for getting me a starting point!

best regards
s!
Post Reply