per-process %CPU

From: Albert D. Cahalan (acahalan@cs.uml.edu)
Date: Wed Oct 16 2002 - 22:05:14 EST


> I want to do following
>
> [root@server13 root]# ps -eo pid,%cpu,%mem,user,args --sort user hC
> ps: error: Option C is reserved.
> usage: ps -[Unix98 options]
> ps [BSD-style options]
> ps --[GNU-style long options]
> ps --help for a command summary
>
> but If I replace C by any other OUTPUT MODIFIERS it works.
> I just want the current %cpu of the process and not the
> decaying average, so is there an other way to get to my goal?
>
> I tried it on redhat, suse and debian distris ... always the same.

I have bad news for you. The kernel doesn't even maintain
the decaying average. Per-process %cpu on Linux is a lie,
and always has been -- except with "top", which crudely does
a measurement itself.

What you get for %cpu is calculated over the lifetime of
the process. Maybe you can find a scheduler hacker to fix
this problem. I'll Cc: a few for you.

Guys, this is a POSIX and UNIX requirement. The system is
supposed to report per-process %CPU for a "recent" time frame.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Oct 23 2002 - 22:00:31 EST