home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6574.LZX / include / sprof.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-04  |  2.2 KB  |  52 lines

  1. /*************************************************************/
  2. /*                                                           */
  3. /* You don't need to include this file at all unless you     */
  4. /* want to disable profiling for short portions of your      */
  5. /* program.  A good example would be disabling the profiler  */
  6. /* while you call Wait() to wait on user input.  To do this, */
  7. /* surround your Wait() call with PROFILE_OFF and PROFILE_ON */
  8. /* macros as shown:                                          */
  9. /*                                                           */
  10. /*    PROFILE_OFF();                                         */
  11. /*    result = Wait(waitbits);                               */
  12. /*    PROFILE_ON();                                          */
  13. /*                                                           */
  14. /* Special note:  ALWAYS USE THE CALLS AS SHOWN.  Surround   */
  15. /*                a simple function call with them.  Do NOT  */
  16. /*                return from the function in which you      */
  17. /*                called PROFILE_OFF without calling         */
  18. /*                PROFILE_ON first.  Do NOT call PROFILE_ON  */
  19. /*                without having called PROFILE_OFF in the   */
  20. /*                same function.  If you do, the profiler's  */
  21. /*                results will be incorrect!                 */
  22. /*                                                           */
  23. /*************************************************************/
  24.  
  25. #if _PROFILE
  26.  
  27. void __asm _PROLOG(register __a0 char *);
  28. void __asm _EPILOG(register __a0 char *);
  29.  
  30. #define PROFILE_OFF() _PROLOG(0L)
  31. #define PROFILE_ON()  _EPILOG(0L)
  32.  
  33. /* Use these to "fool" the profiler into thinking you have */
  34. /* entered and left a new "function".  Make sure you use   */
  35. /* the STRMERGE option and pass a string constant, or pass */
  36. /* the address of a variable that won't be changing.  You  */
  37. /* must pass the exact same address and it must point to   */
  38. /* the same string both times.                             */
  39. #define PROFILE_PUSH(x) _PROLOG(x)
  40. #define PROFILE_POP(x)  _EPILOG(x)
  41.  
  42. #else
  43.  
  44. #define PROFILE_OFF() {}
  45. #define PROFILE_ON()  {}
  46.  
  47. #define PROFILE_PUSH(x) {}
  48. #define PROFILE_POP(x) {}
  49.  
  50. #endif
  51.  
  52.