Stats in simple.c

New Message Reply Date view Thread view Subject view Author view

william_marinelli++at++ntsc.navy.mil
Thu, 01 Aug 96 16:39:36 EST


         
        I'm trying to grab the number of triangles sent down the pipe and
        do a simple printf. Don't see any evidence of the pfFStatsClassMode
        working out. Fooey. If you could do me a big favor and peruse the
        code below (my code is not indented, SGI's simple.c is), I was
        hoping you could see what I'm missing. I tried the example code in
        the man pages and the programmers guide. Thanks, Bill Marinelli
        See you in New Orleans?
         
         
        #include <stdlib.h>
        #include <Performer/pf.h>
        #include <Performer/pfutil.h>
        #include <Performer/pfdu.h>
         
        /*
        * Usage() -- print usage advice and exit. This
        * procedure is executed in the application process. */ static
        void
        Usage (void)
        {
        pfNotify(PFNFY_FATAL, PFNFY_USAGE, "Usage: simple file.ext ...\n");
        exit(1);
        }
         
         
        int
        main (int argc, char *argv[])
        {
        float t = 0.0f;
        pfScene *scene;
        pfNode *root;
        pfPipe *p;
        pfPipeWindow *pw;
        pfChannel *chan;
        pfSphere bsphere;
pfFrameStats *fstats;
float ftmp[5];
uint qtmp[5];
         
        if (argc < 2)
        Usage();
         
        /* Initialize Performer */
        pfInit();
         
        /* Use default multiprocessing mode based on number of *
        processors.
        */
        pfMultiprocess( PFMP_DEFAULT );
         
        /* Load all loader DSO's before pfConfig() forks */
        pfdInitConverter(argv[1]);
         
        /* initiate multi-processing mode set in pfMultiprocess call
        * FORKs for Performer processes, CULL and DRAW, etc. happen
        here.
        */
        pfConfig();
         
        /* Append to Performer search path, PFPATH, files in *
        /usr/share/Performer/data */
        pfFilePath(".:/usr/share/Performer/data");
         
        /* Read a single file, of any known type. */ if ((root =
        pfdLoadFile(argv[1])) == NULL)
        {
        pfExit();
        exit(-1);
        }
         
        /* Attach loaded file to a new pfScene. */ scene = pfNewScene();
        pfAddChild(scene, root);
        /* Create a pfLightSource and attach it to scene. */
        pfAddChild(scene, pfNewLSource());
         
        /* Configure and open GL window */
        p = pfGetPipe(0);
        pw = pfNewPWin(p);
        pfPWinType(pw, PFPWIN_TYPE_X);
        pfPWinName(pw, "IRIS Performer");
        pfPWinOriginSize(pw, 0, 0, 500, 500); /* Open and configure the GL
        window. */ pfOpenPWin(pw);
         
        /* Create and configure a pfChannel. */ chan = pfNewChan(p);
        pfChanScene(chan, scene);
        pfChanFOV(chan, 45.0f, 0.0f);
         
         
        /* determine extent of scene's geometry */ pfGetNodeBSphere (root,
        &bsphere);
        pfChanNearFar(chan, 1.0f, 10.0f * bsphere.radius);
         
pfFStatsClass(fstats,PFSTATS_ALL, PFSTATS_ON); pfFStatsClassMode(fstats,
PFSTATS_GFX,
PFSTATS_GFX_GEOM,PFSTATS_SET);
printf("I think it thinks the Frame Stats class mode is %d \n",
pfGetFStatsClassMode(fstats, PFSTATS_GFX));

        /* Simulate for twenty seconds. */
        while (t < 4.0f)
        {
        pfCoord view;
        float s, c;
         
         
        /* Go to sleep until next frame time. */ pfSync();
         
        /* Initiate cull/draw for this frame. */ pfFrame();
         
qtmp[0] = PFFSTATS_BUF_AVG | PFSTATSVAL_GFX_GEOM_TRIS; qtmp[1] =
PFFSTATS_BUF_AVG | PFFSTATSVAL_PFTIMES_PROC_TOTAL; qtmp[2] =
PFFSTATS_BUF_AVG | PFSTATSVAL_CPU_SYS_BUSY; qtmp[3] = NULL;

pfMQueryFStats(fstats, qtmp, ftmp, sizeof(ftmp));

fprintf(stderr, "Query num tris: %.0f\n", ftmp[0]);
fprintf(stderr, "Query frame time: %.0f msecs\n", ftmp[1]*1000.0f);
fprintf(stderr, "Query sys busy: %.0f%%\n", ftmp[2]);
         
        /* Compute new view position. */
        t = pfGetTime();
        pfSinCos(45.0f*t, &s, &c);
        pfSetVec3(view.hpr, 45.0f*t, -10.0f, 0); pfSetVec3(view.xyz, 2.0f *
        bsphere.radius * s,
        -2.0f * bsphere.radius *c,
        0.5f * bsphere.radius);
        pfChanView(chan, view.xyz, view.hpr);
         
        }
         
        /* Terminate parallel processes and exit. */ pfExit(); }
         
         
         

=======================================================================
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:53:18 PDT

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