Annotation of pmsdk/profiler/example/testprof.c, revision 1.1

1.1     ! root        1: /***   testprof.c - TestProfile
        !             2: *
        !             3: *      HISTORY:     4 May 87 - Initial version.
        !             4: *
        !             5: */
        !             6: 
        !             7: #include <os2.h>
        !             8: #include <stdio.h>
        !             9: #include <conio.h>
        !            10: #include "profile.h"
        !            11: 
        !            12: #define     OUTER_LOOP     300     /* program does N*(N+1)/2 iterations */
        !            13: 
        !            14: /*  Check return code */
        !            15: #define     crc(a)  doCrc((a),__FILE__,__LINE__)
        !            16: 
        !            17: doCrc (rc,file,line)
        !            18: int    rc;
        !            19: char   *file;
        !            20: int    line;
        !            21: {
        !            22:     if (rc != 0) {
        !            23:        printf ("%s:(%d) call failed; rc=%d\n", file, line, rc);
        !            24:        exit (rc);
        !            25:     }
        !            26: }
        !            27: 
        !            28: main (argc,argv)
        !            29: int argc;
        !            30: char *argv[];
        !            31: {
        !            32:     long    i;
        !            33:     unsigned    unused;
        !            34: 
        !            35:     if (argc != 2) {
        !            36:        printf ("invalid parms\n");
        !            37:        printf ("  usage: %s file\n", argv[0]);
        !            38:        exit (1);
        !            39:     }
        !            40: 
        !            41:     crc( PROFINIT(PT_USER|PT_USEKP, (char far *)NULL) );
        !            42:     crc( PROFCLEAR(PT_USER) );
        !            43:     crc( PROFON(PT_USER) );
        !            44: 
        !            45:     for (i=0; i<OUTER_LOOP; i++)
        !            46:        inner(i);
        !            47: 
        !            48:     crc( PROFOFF(PT_USER) );
        !            49:     crc( PROFDUMP(PT_USER, (char far *)argv[1]) );
        !            50:     crc( PROFFREE(PT_USER) );
        !            51: }
        !            52: 
        !            53: inner(i)
        !            54: long i;
        !            55: {
        !            56:     long    j;
        !            57:     long    k;
        !            58: 
        !            59:     for (j=0; j<i; j++)
        !            60:        k=j;
        !            61: }
        !            62: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.