www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/25/11:34:22

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Thu, 25 Jul 2002 11:34:01 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
To: cygwin AT cygwin DOT com
Subject: RE: a way to read the current cpu load from the shell or via a
cmdline utility in cygwin?
In-Reply-To: <31CB870AD5AA384BB5419025DD9F7A84104345@dailymail.cfs.ac.uk>
Message-ID: <Pine.GSO.4.44.0207251111010.14447-100000@slinky.cs.nyu.edu>
MIME-Version: 1.0

Tony,

On Thu, 25 Jul 2002, Tony Arnold wrote:

> > I did a google search on "linux top cpu load".  Here's a top
> > from the first match:
> > http://www.groupsys.com/topsrc/top-3.5beta9.tar.gz
> > It took about an hour to make it compile and
> > run under cygwin 1.3.12-2 on Win2k.  The patch is attached.
> >
> > Note: I just compiled and ran the code; I haven't verified
> > the correctness of the output.  It seemed to work without
> > crashing, and the output looked plausible.  I also haven't
> > tested it on any system other than mine (above). Try it at
> > your own risk.
>
> Thanks for this, it's a good start to getting top working under Cygwin.
>
> My question is that when you run the Configure script what do give as
> the 'appropriate module' for the machine? I've used 'linux' but I wonder
> if there is a better option, or whether we should invent a Cygwin
> machine definition?

'linux' seemed to work for me.  I've had to comment out some
linux-specific stuff, though (see patch:
http://cygwin.com/ml/cygwin/2002-07/msg01974.html ), so creating a cygwin
module might be a better long-term solution.

> Secondly, when it runs, I'm not convinced the figures are correct! For
> example, my setiathome process should show almost 100% cpu utilisation,
> but it shows 0%! Is this a refelction of my choice above, or problems
> with the /proc file system infotmation?

As I said, I haven't verified the correctness of the output.  As my
machine is mostly idle, the output looked plausible (compatible with that
of the Win2k Task Manager).  Now that I actually ran an experiment with a
CPU-intensive process, it looks like top downscales utilization by a
factor of 3 (again, on my machine and configuration).

> Hints and tips on this much appreciated.
> Regards, Tony.

The way top calculates CPU percentage is by dividing the accumulated
process time since last check by the wallclock time since last check.  As
far as I can see, the code itself looks correct.  Thus, the blame would
probably lie with either the /proc filesystem entries (particularly
/proc/$PID/stat) or the gettimeofday() implementation/granularity.
I'm sorry I don't have time to investigate further.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019