Unix Programming - How 'top' utility gets CPU ID

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > March 2004 > How 'top' utility gets CPU ID





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How 'top' utility gets CPU ID
Israel Hsu

2004-03-18, 4:35 pm

Hi,

I'm using the 'top' CPU monitoring program in Linux (redhat 9), and I
want to know what function it's calling in order to get the CPU ID
when running on a multiprocessor machine. That is, one of the columns
of information shows 0 or 1 depending on which CPU the process was
last scheduled to run on (for a 2-processor machine). How can I get
that information programmatically?

I need this information to run a rough test that checks to see if a
process has been scheduled on a different processor.

Thanks.
Israel Hsu
Barry Margolin

2004-03-18, 5:35 pm

In article <c3492661.0403181333.22793b64@posting.google.com>,
israelhsu@hotmail.com (Israel Hsu) wrote:

> Hi,
>
> I'm using the 'top' CPU monitoring program in Linux (redhat 9), and I
> want to know what function it's calling in order to get the CPU ID
> when running on a multiprocessor machine. That is, one of the columns
> of information shows 0 or 1 depending on which CPU the process was
> last scheduled to run on (for a 2-processor machine). How can I get
> that information programmatically?


Use the Source, Luke.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Israel Hsu

2004-03-19, 2:35 pm

Barry Margolin <barmar@alum.mit.edu> wrote in message news:<barmar-AA61FF.17175118032004@comcast.ash.giganews.com>...
> In article <c3492661.0403181333.22793b64@posting.google.com>,
> israelhsu@hotmail.com (Israel Hsu) wrote:
>
>
> Use the Source, Luke.


Thanks a lot, Obiwan.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com