"Albert Cahalan" <acahalan@xxxxxxxxx> writes:
> On Mon, Dec 18, 2006 at 11:50:08PM +0000, David Wragg wrote:
>> This patch (against 2.6.19/2.6.19.1) adds the four context
>> switch values (voluntary context switches, involuntary
>> context switches, and the same values accumulated from
>> terminated child processes) to the end of /proc/*/stat,
>> similarly to min_flt, maj_flt and the time used values.
>
> Hmmm, OK, do people have a use for these values?
My reason for writing the patch was to track which processes are
active (i.e. got scheduled to run) by polling these context switch
values. The time used values are not a reliable way to detect process
activity on fast machines. So for example, when sorting by %CPU, top
often shows many processes using 0% CPU, despite the fact that these
processes are running occasionally. If top sorted by (%CPU, context
switch count delta), it might give a more useful display of which
processes are active on the system.