public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Igor Pechtchanski <pechtcha@cs.nyu.edu>
To: cygwin@cygwin.com
Subject: Re: a way to read the current cpu load from the shell or via a  cmdline utility in cygwin?
Date: Sat, 27 Jul 2002 19:55:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.44.0207271412090.18003-100000@slinky.cs.nyu.edu> (raw)
In-Reply-To: <20020727084253.531f77cc.jim.george@blueyonder.co.uk>

On Sat, 27 Jul 2002, Jim George wrote:

> On Fri, 26 Jul 2002 18:07:01 -0400 (EDT)
> Igor Pechtchanski <pechtcha@cs.nyu.edu> wrote:
>
> > On Fri, 26 Jul 2002, Jim George wrote:
> >
> > > On Fri, 26 Jul 2002 11:44:03 -0400 (EDT)
> > > Igor Pechtchanski <pechtcha@cs.nyu.edu> wrote:
> > >
> > > > On Thu, 25 Jul 2002, Jim George wrote:
> > > >
> > > > > > On Thu, 25 Jul 2002, Greg McCrory wrote:
> > > > > >
> > > > > > > At 7/24/2002 11:38 PM -0400, Igor Pechtchanski wrote:
> > > > > > > >On Wed, 24 Jul 2002, Jim George wrote:
> > > > > > > >
> > > > > > > >Jim,
> > > > > > > >
> > > > > > > >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.
> > > > > > > >     Igor
> > > > > > >
> > > > > > > Notes on my quick attempt this morning:
> > > > > > >
> > > > > > > To get the ./Configure to run properly I needed a symbolic link to tcsh:
> > > > > > > ln -s /bin/tcsh /bin/csh
> > > > > >
> > > > > > Right, I have that too (from way back, no wonder I forgot to mention it).
> > > > > >
> > > > > > > Also chose module linux when asked.
> > > > > >
> > > > > > Yep.  Again, should have said that.
> > > > > >
> > > > > > > for owner, used SYSTEM instead of default root
> > > > > >
> > > > > > chown and chgrp didn't seem to work for me at all.  However, I don't have
> > > > > > a CYGWIN variable, so that might be the reason.  I don't miss it, though.
> > > > > >
> > > > > > > install script did not move the executable into the proper directory:
> > > > > >
> > > > > > I used /usr/bin/install as the install command.
> > > > > >
> > > > > > > ./install -o SYSTEM -m 4711 -g SYSTEM top /usr/local/bin
> > > > > > > chown: changing ownership of `/usr/local/bin/top': No such file or directory
> > > > > > > chgrp: changing group of `/usr/local/bin/top': No such file or directory
> > > > > > > chmod: changing permissions of `/usr/local/bin/top': No such file or directory
> > > > > > > make: *** [install-top] Error 1
> > > > > >
> > > > > > See http://cygwin.com/cygwin-ug-net/using-specialnames.html#AEN644
> > > > > > It may be necessary to use the local script after all, and re-write it to
> > > > > > boot.
> > > > > >
> > > > > > > I was able to install it manually and it appears to work.
> > > > > > > GMc
> > > > > >
> > > > > > Not quite correctly -- see
> > > > > > http://cygwin.com/ml/cygwin/2002-07/msg01995.html
> > > > > >   Igor
> > > > > Hi everyone,
> > > > >
> > > > >     well I got as far as compiling and installing, in the same way
> > > > >       that Greg did, but...
> > > > >
> > > > >     When I run top I get the following error..
> > > > >
> > > > >             top: proc filesystem not mounted on /proc
> > > > >                  type = 6
> > > > >
> > > > >     The output of mount is..
> > > > > [snip]
> > > > >     Can anyone tell me what I've done wrong?  Do I need to explicitly
> > > > >       mount /proc?
> > > >
> > > > No, /proc is a virtual filesystem that is already mounted.  However, top
> > > > checks something called a PROC_SUPER_MAGIC, which is a compile-time
> > > > constant, but seems to be different for every system.  The value in the
> > > > patch is for my system only (as I repeatedly said).  To determine what the
> > > > value is on your system, edit machine.c, and insert fprintf(stderr, "
> > > > type=%x\n", sb.f_type); in machine_init, right after it prints out the
> > > > above error message (but before the return).  Then recompile and run.
> > > > It'll still fail, but now you'll know what the value of PROC_SUPER_MAGIC
> > > > is for your system.  Edit machine.c and change the #define of
> > > > PROC_SUPER_MAGIC from 0x9fa0 (the value for my system) to whatever it is
> > > > on yours.  Recompile, and top should work.
> > > > I know this is tedious and non-portable.  Someone who knows how the value
> > > > is actually derived on each machine can come up with a better way.
> > > >       Igor
> > >
> > > Igor,
> > >         I went to make the change to machine.c that you suggested but
> > > the entry is already there right before the error return.
> > >         When I run top I get the type=6, so what is the number I should
> > > replace 0x9fa0 with, 0x0006?
> > > Regards,
> > > Jim
> >
> > Jim,
> > Right, sorry, I forgot that I included the printout in the patch...  Well,
> > that means less work for you. :-)
> > Yes, do replace 0x9fa0 with the value that was printed out (in your case,
> > 6).  The printout is in hex, you can just add a 0x in front of it (i.e.,
> > 0x6).  Adding leading 0's (e.g., 0x000006) won't make a difference.
> >       Igor
>
> Thanks Igor,
>         that did it.
>         Were you aware that you had competition?  There's a package
> called procps by Chris January at
> http://www.doc.ic.ac.uk/~ccj00/procps-010801.
>         Perhaps you could share experiences/code?
> Jim

Jim,
Yes, I saw the messages, thanks.  Contrary to the belief some people seem
to have, I'm not an author or maintainer of the top package - I just
looked on the net, found the source, and twiddled with it to make it
compile and run under cygwin.  I'm not even claiming it's the best out
there - it was the first match, that's all.  I'm sure Chris's tools are
better and more Cygwin-compatible.  My attempt was to fill the void, not
to provide the best there is.  I'm not even sure how most of the code
works - I'm only familiar with the parts I had to change to port it.  All
of my experiences are described right here on the list.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.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/

  parent reply	other threads:[~2002-07-27 18:23 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-24  5:59 Dylan Cuthbert
2002-07-24  6:32 ` Gunnar Norling
2002-07-24  6:45 ` John Morrison
2002-07-25  1:57   ` Jim George
2002-07-25  6:01     ` Igor Pechtchanski
2002-07-25  8:54       ` Tony Arnold
2002-07-25 10:01         ` Igor Pechtchanski
2002-07-26 15:24         ` Chris January
2002-07-26 17:54           ` Christopher Faylor
2002-07-26 17:58             ` Chris January
2002-07-25  8:55       ` Greg McCrory
2002-07-25 13:37         ` Igor Pechtchanski
2002-07-26  1:35           ` Dylan Cuthbert
2002-07-26  6:30           ` Jim George
     [not found]             ` <OIENKAGCMBEDKDHGANIKKEONCGAA.john.r.morrison@ntlworld.com>
2002-07-26  6:57               ` Jim George
2002-07-26  7:17                 ` John Morrison
2002-07-26  7:39                   ` Jim George
2002-07-26  7:40                     ` John Morrison
2002-07-26 16:35                       ` Chris January
2002-07-27  7:05                         ` Jim George
2002-07-26 14:22                     ` Chris January
2002-07-26 19:06                       ` Jim George
2002-07-26 19:33                         ` Chris January
2002-07-26 13:15             ` Igor Pechtchanski
2002-07-26 18:31               ` Jim George
2002-07-26 18:47                 ` Igor Pechtchanski
2002-07-27  7:00                   ` Jim George
2002-07-27  8:45                     ` Chris January
2002-07-27 19:55                     ` Igor Pechtchanski [this message]
2002-07-26 13:48 ` Chris January
2002-07-27  6:26   ` Dylan Cuthbert

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=Pine.GSO.4.44.0207271412090.18003-100000@slinky.cs.nyu.edu \
    --to=pechtcha@cs.nyu.edu \
    --cc=cygwin@cygwin.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).