Source code of Windows XP (NT5)
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.

119 lines
3.7 KiB

  1. //------------------------------------------------------------------------
  2. //
  3. // File: shell\themes\test\ctlperf\PerfLog.h
  4. //
  5. // Contents: Declaration of the timing and logging class, CPerfLog
  6. //
  7. // Classes: CPerfLog
  8. //
  9. //------------------------------------------------------------------------
  10. #pragma once
  11. // Class name used as a base for the timing (its timings are removed from the others)
  12. const TCHAR kszFrameWnd[] = _T("FrameWindow");
  13. //-----------------------------------------------------------
  14. //
  15. // Class: CPerfLog
  16. //
  17. // Synopsis: Encapsulates timing and logging
  18. //
  19. //-----------------------------------------------------------
  20. class CPerfLog
  21. {
  22. public:
  23. //** Construction/destruction
  24. CPerfLog();
  25. ~CPerfLog();
  26. //** Public methods
  27. // Initialization method when loggin one pass
  28. void StartLoggingOnePass(LPCTSTR szFileName, HWND hWndStatusBar, LPCTSTR szPass);
  29. // Initialization method when loggin two passes
  30. void StartLoggingTwoPasses(LPCTSTR szFileName, HWND hWndStatusBar, LPCTSTR szPass1, LPCTSTR szPass2);
  31. // Close and cleanup
  32. void StopLogging();
  33. // For parity, does nothing
  34. void StopLoggingPass1();
  35. // Log pass 2
  36. void StartLoggingPass2();
  37. // Close pass 2, output log and cleanup
  38. void StopLoggingPass2();
  39. // Start timing a new control class name for the following timing
  40. void OpenLoggingClass(LPCTSTR szClassName);
  41. // Finished with this class
  42. void CloseLoggingClass();
  43. // Beginning timing creation test
  44. void StartCreate(UINT cCtl);
  45. // Finished timing creation test
  46. void StopCreate();
  47. // Beginning timing painting test
  48. void StartPaint(UINT nTimes);
  49. // Finished timing painting test
  50. void StopPaint();
  51. // Beginning timing resizing test
  52. void StartResize(UINT nTimes);
  53. // Finished timing resizing test
  54. void StopResize();
  55. // Beginning timing resizing with painting test
  56. void StartResizeAndPaint(UINT nTimes);
  57. // Finished timing resizing with painting test
  58. void StopResizeAndPaint();
  59. // Setup the output type
  60. void SetOutputType(LPTSTR szNumberOnly);
  61. private:
  62. //** Private methods
  63. // Stores the data in one of the buffers
  64. void OutputData();
  65. // Stores the string in memory
  66. void LogString(LPCTSTR sz);
  67. //** Private members
  68. // Perf counter frequency
  69. __int64 m_liFreq;
  70. // Start measurement in m_liFreq units
  71. __int64 m_liStart;
  72. // End measurement in m_liFreq units
  73. __int64 m_liEnd;
  74. // File name used for output
  75. TCHAR m_szFileName[_MAX_PATH + 1];
  76. // Status bar to display current info
  77. HWND m_hWndStatusBar;
  78. // Are we ready to log?
  79. bool m_bLogging;
  80. // Handle to the log file
  81. FILE* m_flLogFile;
  82. // Stored reference value for kszFrameWnd
  83. UINT m_nFramePaintTime;
  84. // Stored reference value for kszFrameWnd
  85. UINT m_nFrameResizeTime;
  86. // Stored reference value for kszFrameWnd
  87. UINT m_nFrameResizeAndPaintTime;
  88. // Are we timing the reference frame class?
  89. bool m_bFrame;
  90. // Are we logging two passes?
  91. bool m_bTwoPasses;
  92. // Are we logging the first pass?
  93. bool m_bFirstPass;
  94. // Specify type of output
  95. bool m_bNumberOnly;
  96. // Name of first pass
  97. TCHAR m_szPass1[256];
  98. // Name of second pass
  99. TCHAR m_szPass2[256];
  100. // Numeric results of pass 1
  101. UINT* m_rgnResults1;
  102. // Numeric results of pass 2
  103. UINT* m_rgnResults2;
  104. // Strings to log
  105. LPTSTR* m_rgszResults;
  106. // Number of elements in m_rgnResults1
  107. UINT m_cnResults1;
  108. // Number of elements in m_rgnResults2
  109. UINT m_cnResults2;
  110. // Number of elements in m_rgszResults
  111. UINT m_cszResults;
  112. // Buffer for composing strings before logging
  113. TCHAR m_szBuf[256];
  114. };