Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.5 KiB

  1. //timer.h
  2. #if TIMEIT
  3. #if !defined(TIMEIT_STAMP) || TIMEIT_STAMP
  4. #define TimeStamp(n) TimerStamp(n) //for hands on types
  5. #define TIMER_STAMP(symb) {\
  6. extern const int TimerSymb ## symb ## Stamp; \
  7. extern const int TimerSymb ## TimerOverhead ## Stamp; \
  8. TimerStamp(TimerSymb ## symb ## Stamp);\
  9. TimerStamp(TimerSymb ## TimerOverhead ## Stamp);\
  10. }
  11. void TimerStamp(int n);
  12. #else
  13. #define TIMER_STAMP(s)
  14. #endif //TIMEIT_STAMP
  15. #if !defined(TIMEIT_SPOT) || TIMEIT_SPOT
  16. #define TIMER_SPOT_ON(symb) {\
  17. extern const int TimerSymb ## symb ## Spot; \
  18. TimerSpotOn(TimerSymb ## symb ## Spot);\
  19. }
  20. #define TIMER_SPOT_OFF(symb) {\
  21. extern const int TimerSymb ## symb ## Spot; \
  22. TimerSpotOff(TimerSymb ## symb ## Spot);\
  23. }
  24. void TimerSpotOn(int n);
  25. void TimerSpotOff(int n);
  26. #else
  27. #define TIMER_SPOT_ON(s)
  28. #define TIMER_SPOT_OFF(s)
  29. #endif //TIMEIT_SPOT
  30. #define TIMER_INITIALIZE TimerInitialize()
  31. #define TIMER_ON TimerBegin()
  32. #define TIMER_OFF TimerEnd()
  33. #define TIMER_REPORT(unitString, scale) TimerReport((unitString), (double)(scale), 1.)
  34. void TimerInitialize(void);
  35. void TimerBegin(void);
  36. void TimerEnd(void);
  37. void TimerReport(const char *unitName, double scaleSum, double scaleRatio);
  38. #else
  39. #define TimeStamp(n)
  40. #define TIMER_INITIALIZE
  41. #define TIMER_STAMP(s)
  42. #define TIMER_SPOT_ON(s)
  43. #define TIMER_SPOT_OFF(s)
  44. #define TIMER_ON
  45. #define TIMER_OFF
  46. #define TIMER_REPORT(u,s)
  47. #endif //TIMEIT