Mmm maybe you are looking for something like -m option in prstat(1M)
command http://docs.sun.com/app/docs/doc/819-2240/prstat-1m?l=en&a=view
. Here you can find code
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/prstat/

On Fri, Jan 15, 2010 at 12:48 AM, Aaron Mason <simplersolut...@gmail.com>
wrote:
> On Thu, Jan 14, 2010 at 10:50 PM, Sebastian Spies
> <sebastian.sp...@de-cix.net> wrote:
>> Aaron Mason wrote:
>>> different exit value for each error condition. B It's usually good
>>> practice to send a numeric error code and let your script handle the
>>> error itself. B By all means keep the message there, but don't make it
>>> impossible to use in a script.
>>>
>>> </offtopic>
>>>
>>> Try info->p_pctcpu instead.
>>>
>> u_int32_t p_pctcpu; B  B  B  B  B  B  /* FIXPT_T: %cpu for this process
during
>> p_swtime */
>> u_int32_t p_swtime; B  B  B  B  B  B  /* U_INT: Time swapped in or out. */
>>
>> My understanding is, that pctcpu is a normalized value over swtime,
>> which is useless for me.
>
> You want the load of a process on a per second basis - that actually is.
>
> Consider this diff:
>
> --- cpucalc-old.c B  B  B  Fri Jan 15 21:46:32 2010
> +++ cpucalc.c B  Fri Jan 15 21:44:55 2010
> @@ -30,7 +30,7 @@
> B  B  B  B  B  B  B  B exit(1);
> B  B  B  B }
>
> - B  B  B  printf("%x\n",info->p_cpticks);
> + B  B  B  printf("%x in %x\n",info->p_pctcpu, info->p_swtime);
>
> B  B  B  B exit(0);
> B }
>
> 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
>
>>
>> --
>> Sebastian Spies B  B  B  B  B  B  B  B  B  B  B e-mail:
sebastian.sp...@de-cix.net
>> DE-CIX Management GmbH
>> Lindleystr. 12, 60314 Frankfurt B  B  B Mobile: +49 1577 7830883
>> Geschaeftsfuehrer Harald A. Summa B  B Fax: +49 69 4056 2716
>> Registergericht AG Koeln, HRB 51135 B http://www.de-cix.net
>> Zentrale: Lichtstr. 43i, 50825 Koeln
>>
>>
>>
>
>
>
> --
> Aaron Mason - Programmer, open source addict
> I've taken my software vows - for beta or for worse

Reply via email to