in reply to Re^2: CPU utilization
in thread CPU utilization

Is this ActiveState's perl? Which windows operating system are you using? Just before the sleep call in CPU_max, try putting in a
print "CPU_max: cpu: $cpu real: $real\n";
and run it for a little while to see how it goes.

You might also try getting rid of the sleep function and instead putting use Time::HiRes "sleep"; at the top of your code.

Replies are listed 'Best First'.
Re^4: CPU utilization
by contact_chatan (Initiate) on Feb 24, 2005 at 12:52 UTC

    Yes i am already doing it and it is printing value like:
    start: MAX: 0.2 REAL: 0.15625CPU: 0.031
    start: MAX: 0.2 REAL: 0.15625CPU: 0.031
    start: MAX: 0.2 REAL: 0.15625CPU: 0.031
    start: MAX: 0.2 REAL: 0.171875CPU: 0.047
    Wat should i do and it is utilizing more than 80% of CPU.Please can you check this code at your end>Also do you have yahoo or MSN messenger ID
    Thanks,

    Chatanya Agrawal
      I just noticed you say "start:" there. You do realize you should call CPU_start only once, before reading from the logfile? Inside the loop reading logfile records, you should only be calling CPU_max(.2).
      Did you try my Time::HiRes suggestion? How are you determining how much CPU it is using? According to the above numbers, it's using about 20% as it should.