Re: OpenBSD CPU Load Calculation of a Process

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Aaron Mason
Date: Thursday, January 14, 2010 - 4:48 pm

On Thu, Jan 14, 2010 at 10:50 PM, Sebastian Spies
<sebastian.spies@de-cix.net> wrote:

You want the load of a process on a per second basis - that actually is.

Consider this diff:

--- cpucalc-old.c       Fri Jan 15 21:46:32 2010
+++ cpucalc.c   Fri Jan 15 21:44:55 2010
@@ -30,7 +30,7 @@
                exit(1);
        }

-       printf("%x\n",info->p_cpticks);
+       printf("%x in %x\n",info->p_pctcpu, info->p_swtime);

        exit(0);
 }

And this test run:

# while sleep 1; do ./cpucalc 21380; done
0 in 15ca3
0 in 15ca4
0 in 15ca5
^C

So there it is - it already is calculated on a per second basis for you.

HTH




--
Aaron Mason - Programmer, open source addict
I've taken my software vows - for beta or for worse
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
OpenBSD CPU Load Calculation of a Process, Sebastian Spies, (Wed Jan 13, 3:07 am)
Re: OpenBSD CPU Load Calculation of a Process, patrick keshishian, (Wed Jan 13, 1:28 pm)
Re: OpenBSD CPU Load Calculation of a Process, Aaron Mason, (Wed Jan 13, 4:19 pm)
Re: OpenBSD CPU Load Calculation of a Process, Sebastian Spies, (Thu Jan 14, 4:50 am)
Re: OpenBSD CPU Load Calculation of a Process, Philip Guenther, (Thu Jan 14, 11:20 am)
Re: OpenBSD CPU Load Calculation of a Process, Bryan Irvine, (Thu Jan 14, 1:10 pm)
Re: OpenBSD CPU Load Calculation of a Process, Aaron Mason, (Thu Jan 14, 4:48 pm)
Re: OpenBSD CPU Load Calculation of a Process, Tomas Bodzar, (Thu Jan 14, 11:51 pm)
Re: OpenBSD CPU Load Calculation of a Process, Philip Guenther, (Fri Jan 15, 12:56 am)
Re: OpenBSD CPU Load Calculation of a Process, Tomas Bodzar, (Fri Jan 15, 1:38 am)
Re: OpenBSD CPU Load Calculation of a Process, Sebastian Spies, (Mon Jan 18, 2:11 am)