re whicProcess

New Message Reply Date view Thread view Subject view Author view

Mike Stephens (stephens++at++zeus.wes.hpc.mil)
Thu, 20 Nov 1997 14:28:51 -0600 (CST)


bill,

here's somethig i use all the time. hope it helps.

mike

 first set aside a bit of space for the id's in a shared memory segment(Shared).

 in the main right after the pfConfig.

        fprintf(stderr,"My pid is %d\n", getpid());
        Shared->appid = (int)pfGetPID(0, PFPROC_APP);
        fprintf(stderr,"Application pid %d\n", Shared->appid);
        Shared->drawid = (int)pfGetPID(0, PFPROC_DRAW);
        fprintf(stderr,"Draw pid %d\n", Shared->drawid);
        Shared->cullid = (int)pfGetPID(0, PFPROC_CULL);
        fprintf(stderr,"Cull pid %d\n", Shared->cullid);
        WhichProcess( getpid(), "Main", __FILE__, __LINE__);

the WhichProcess Routine...

void
WhichProcess( pid_t pid, char *routine, char *file, int line )
{

        if ( pid == Shared->appid ) {
                fprintf(stderr,
                "----->Application pid in %s [%s %d] Parent %d\n",
                        routine, file, line, getppid());
        }
        else if ( pid == Shared->drawid ) {
                fprintf(stderr,
                "---->Drawing pid in %s [%s %d] Parent %d\n",
                        routine, file, line,getppid());
        }
        else if ( pid == Shared->cullid ) {
                fprintf(stderr,
                "---->Culling pid in %s [%s %d] Parent %d\n",
                        routine, file, line, getppid());
        }
        else {
                fprintf(stderr,
"--------->Unknowm process number (%d) %s [%s %d] Parent %d\n",

                        pid, routine, file, line, getppid());
        }
}

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:56:14 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.