SUMMARY: process per cpu

From: Jeff Kennedy (jeff.kennedy@natdecsys.com)
Date: Wed Jun 09 1999 - 17:01:20 CDT


Thanks to the MANY of you for not pointing out that I must be blind.......

Top will do exactly what I was asking about. I have run it before but
never noticed the cpu listing either because it was a single cpu machine or
there wasn't any real load. Or because I'm just a doof. Take your pick.

Proctool was mentioned as was the '-o psr' option to 'ps'.

One inventive soul gave me this:

"from proc(4) man page ... this may help ...

#include <sys/types.h>
#include <sys/signal.h>
#include <sys/fault.h>
#include <sys/syscall.h>
#include <sys/procfs.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>

main()
{
        prstatus_t pr ;
        pid_t myPid = getpid() ;
        char ppath[256] ;
        int pfid ;

        (void)sprintf(ppath, "/proc/%.1d", myPid) ;
        if ((pfid = open(ppath, O_RDONLY))==-1) {
                perror("open(pid)") ;
                return 1 ;
        }
        if (ioctl(pfid, PIOCSTATUS, (void*)&pr)==-1) {
                perror("ioctl(pid,PIOCSTATUS)") ;
                return 1 ;
        }
        printf("process last run on cpu #%.1d",
                pr.pr_processor) ;
        printf(" is bound to cpu #%.1d\n",
                pr.pr_bind) ;

        return 0 ;
}

If the process is not bound to a cpu, the 'last cpu' may change."

I'll skip this one for the time being and stick with top. Thanks though.

Jeff Kennedy
---------------------- Forwarded by Jeff Kennedy/NDS on 06/09/99 02:58 PM
---------------------------

"Jeff Kennedy" <jeff.kennedy@natdecsys.com> on 06/09/99 10:36:16 AM
                                                              
                                                              
                                                              
 To: sun-managers@sunmanagers.ececs.uc.edu
                                                              
 cc: (bcc: Jeff Kennedy/NDS)
                                                              
                                                              
                                                              
 Subject: process per cpu
                                                              

Greetings All,

I have another question even though i have not posted a summary to my first
one, but they are related.

Is there a way to see which processes are using which cpu? I know I can
use mpstat to see the load on each cpu but it doesn't tell me what process
an individual cpu is servicing. And I can see the percent cpu used by a
particular process but not which cpu is providing that percent.

Thanks,

Jeff Kennedy



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:21 CDT