Re: [psutil] cpu_times with percent

36 views
Skip to first unread message

Giampaolo Rodolà

unread,
Apr 7, 2013, 5:12:28 PM4/7/13
to psu...@googlegroups.com
Ciao Danilo,
this is currently not implemented but I think it would definitively be
nice to have (...and also top shows those stats).
I came up with the patch in attachment which adds a new
cpu_percent_per_time function:

>>> cpu_percent_per_time()
cpupercent(user=4.8, nice=0.0, system=4.8, idle=90.5, iowait=0.0,
irq=0.0, softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)

I expect it to be available starting from next psutil release.


2013/4/7 Danilo Chilene <bico...@gmail.com>:
> Hello,
>
> Is there a way to return the below command in percent format without using a
> external function or something else outside psutils?
>
> In [78]: psutil.cpu_times(percpu=False)
> Out[78]: cputimes(user=2169.85, nice=74.45, system=1625.38, idle=50340.71,
> iowait=509.16, irq=0.07, softirq=24.48)
>
> Best Regards,
>
> Danilo
>
> --
> --
> You received this message because you are subscribed to the "Python process
> utilities (psutil)" project group:
> http://code.google.com/p/psutil
> To post to this group, send email to psu...@googlegroups.com
> To unsubscribe from this group, send email to
> psutil-un...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/psutil
> ---
> You received this message because you are subscribed to the Google Groups
> "psutil" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to psutil+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
per-cpu-times-perc.diff

Giampaolo Rodolà

unread,
Apr 7, 2013, 5:42:43 PM4/7/13
to psu...@googlegroups.com
Ticket on the bug tracker:
https://code.google.com/p/psutil/issues/detail?id=362
After some thinking I suppose cpu_times_percent() is a more
appropriate name (it's also consistent with already existent
cpu_times()).

2013/4/7 Giampaolo Rodolà <g.ro...@gmail.com>:

Danilo Chilene

unread,
Apr 9, 2013, 10:25:49 AM4/9/13
to psu...@googlegroups.com
Thanks Giampaolo.
Reply all
Reply to author
Forward
0 new messages