home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWDebug / Include / FWPrfCnt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-08  |  1.8 KB  |  87 lines  |  [TEXT/MPS ]

  1. #ifndef FWPRFCNT_H
  2. #define FWPRFCNT_H
  3.  
  4. //========================================================================================
  5. //
  6. //    File:                FWPrfCnt.h
  7. //    Release Version:    $ 1.0d11 $
  8. //
  9. //    Copyright:    (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //========================================================================================
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #ifdef FW_PROFILE
  18.  
  19. #if defined(FW_BUILD_MAC) && !defined(__TIMER__)
  20. #include <Timer.h>
  21. #endif
  22.  
  23. #if defined(FW_BUILD_WIN) && !defined(_INC_WINDOWS)
  24. #include <windows.h>
  25. #endif
  26.  
  27. #if FW_LIB_EXPORT_PRAGMAS
  28. #pragma lib_export on
  29. #endif
  30.  
  31. //========================================================================================
  32. // CLASS FW_CPerformanceCounter
  33. //========================================================================================
  34.  
  35. class FW_CLASS_ATTR FW_CPerformanceCounter
  36. {
  37. public:
  38. // ---- Construction
  39.     FW_CPerformanceCounter();
  40.     ~FW_CPerformanceCounter();
  41.     
  42.     void        EndCheckPoint();
  43.  
  44. // ----- Implementation
  45. private:
  46.     long            fResult;
  47. #ifdef FW_BUILD_WIN
  48.     LARGE_INTEGER    fWinBegin;
  49.     LARGE_INTEGER    fWinEnd;
  50.     static DWORD    gWinOverhead;
  51.     static DWORD    gWinFreq;
  52. #endif
  53. #ifdef FW_BUILD_MAC
  54.     TMTask            fMacTMTask;
  55.     FW_Boolean        fMacIsInQueue;
  56.     
  57.     static long        gMacTMOverhead;
  58. #endif
  59. };
  60.  
  61. #if FW_LIB_EXPORT_PRAGMAS
  62. #pragma lib_export off
  63. #endif
  64.  
  65. #endif
  66.  
  67. //========================================================================================
  68. // Performance counter macros
  69. //========================================================================================
  70.  
  71. #ifdef FW_PROFILE
  72.  
  73. #define    FW_PERF_CNT_BEGIN(name)        \
  74.     FW_CPerformanceCounter perfCntObj##name;
  75.  
  76. #define    FW_PERF_CNT_END(name)        \
  77.     perfCntObj##name.EndCheckPoint();
  78.  
  79. #else
  80.  
  81. #define    FW_PERF_CNT_BEGIN(name)        ((void) 0)
  82. #define    FW_PERF_CNT_END(name)        ((void) 0)
  83.  
  84. #endif
  85.  
  86. #endif // FWPRFCNT_H
  87.