mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Al Boldi <a1426z@gawab.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] procfs: export context switch counts in /proc/*/stat
Date: Thu, 21 Dec 2006 09:02:27 +0300	[thread overview]
Message-ID: <200612210902.27256.a1426z@gawab.com> (raw)

Albert Cahalan wrote:
> On 12/20/06, David Wragg <david@wragg.org> wrote:
> > "Albert Cahalan" <acahalan@gmail.com> 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.
>
> Oh, that'd be great.

It may be great, but it's really only a workaround.  The real fix is in 
changing the current probed proc-timing to an inlined one.

> The cumulative ones are still not justified though, and I fear they
> may be 64-bit even on i386. It turns out that an i386 procps spends
> much of its time doing 64-bit division to parse the damn ASCII crap.
> I suppose I could just skip those fields, but generating them isn't
> too cheap and probably I'd get stuck parsing them for some other
> reason -- having them separate is probably a good idea.

Agreed.  It may also be advisable to add a top3 line in /proc/stat, to 
circumvent parsing /proc/*/stat, when only checking who is eating CPU most. 


Thanks!

--
Al


             reply	other threads:[~2006-12-21  6:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-21  6:02 Al Boldi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-12-20  5:40 Albert Cahalan
2006-12-20 13:20 ` David Wragg
2006-12-20 13:48   ` Arjan van de Ven
2006-12-20 14:38     ` David Wragg
2006-12-20 14:51       ` Arjan van de Ven
2006-12-20 15:13         ` David Wragg
2006-12-20 17:36   ` Albert Cahalan
2006-12-24  1:40     ` David Wragg
2006-12-18 23:50 David Wragg
2006-12-19  6:39 ` Benjamin LaHaise
2006-12-19 11:47   ` David Wragg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200612210902.27256.a1426z@gawab.com \
    --to=a1426z@gawab.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®