home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / profile1.zip / PROFILE.H < prev    next >
C/C++ Source or Header  |  1991-01-26  |  1KB  |  34 lines

  1. /* profile.h */
  2.  
  3. #define PRO_MEM "\\sharemem\\promsg"   //name of shared memory segment
  4. #define PRO_WAITING -3  //profiler waiting for target to start
  5. #define PRO_START   -2  //target tells profiler to start tracking
  6. #define PRO_EXIT    -1  //target tells profiler to finish
  7. #define PRO_MAX     40  //profiler will track values 0 - 39
  8. #define PRO_STACK   20  //stack for up to 20 nested function calls
  9.  
  10. #ifdef PROFILE
  11. #define ENTER(a) {pPM->sTop++; pPM->sCode = pPM->asStack[pPM->sTop] = a;}
  12. #define SET(a)   {pPM->sCode = pPM->asStack[pPM->sTop] = a;}
  13. #define LEAVE    {pPM->sTop--; pPM->sCode = pPM->asStack[pPM->sTop];}
  14. #define SETUP_PRO if(fnusIPro()){printf("profile setup fail\n");exit(TRUE);}
  15. #define EXIT_PRO  {fnvXPro();}
  16. #else
  17. #define ENTER       //start a function, pushes stack
  18. #define SET         //changes code, does no push stack
  19. #define LEAVE       //leave function, pops stack
  20. #define SETUP_PRO   //set up memory segments in target program
  21. #define EXIT_PRO    //clean up memory segments in target program
  22. #endif
  23.  
  24. typedef struct _ProMessage {
  25.   SHORT    sCode;
  26.   SHORT    sTop;
  27.   SHORT   asStack[PRO_STACK];
  28. } PROMESSAGE, *PPROMESSATE;
  29.  
  30. extern PROMESSAGE   *pPM;
  31.  
  32. VOID fnvXPro(VOID);
  33. USHORT fnusIPro(VOID);
  34.