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.

272 lines
12 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. // Copyright (c) 2002 Microsoft Corporation. All rights reserved.
  3. // Copyright (c) 2002 OSR Open Systems Resources, Inc.
  4. //
  5. // DisplayDlg.h : header for logger list dialog
  6. //////////////////////////////////////////////////////////////////////////////
  7. #pragma once
  8. //
  9. // 100 mS time limit before resorting and updating event list
  10. //
  11. CONST ULONG EVENT_TIME_LIMIT = 100;
  12. // CDisplayDlg dialog
  13. class CDisplayDlg : public CDialog
  14. {
  15. DECLARE_DYNAMIC(CDisplayDlg)
  16. public:
  17. CDisplayDlg(CWnd* pParent, LONG DisplayID);
  18. virtual ~CDisplayDlg();
  19. BOOL OnInitDialog();
  20. VOID SetDisplayFlags(LONG DisplayFlags);
  21. VOID AddSession(CLogSession *pLogSession);
  22. BOOL BeginTrace(BOOL bUseExisting = FALSE);
  23. BOOL EndTrace(HANDLE DoneEvent = NULL);
  24. BOOL UpdateSession(CLogSession *pLogSession);
  25. BOOL SetupTraceSessions();
  26. VOID EventHandler(PEVENT_TRACE pEvent);
  27. void OnNcPaint();
  28. void OnSize(UINT nType, int cx,int cy);
  29. VOID RemoveSession(CLogSession *pLogSession);
  30. BOOL SetItemText(int nItem, int nSubItem, LPCTSTR lpszText);
  31. void SortTable(int Column = MaxLogSessionOptions);
  32. VOID WriteSummaryFile();
  33. VOID SetState(LOG_SESSION_STATE StateValue);
  34. void AutoSizeColumns();
  35. static UINT RealTimeEventThread(LPVOID pParam);
  36. static UINT EndTraceThread(LPVOID pParam);
  37. static int __cdecl CompareOnName(const void *pMessage1, const void *pMessage2);
  38. static int __cdecl CompareOnMessage(const void *pMessage1, const void *pMessage2);
  39. static int __cdecl CompareOnFileName(const void *pMessage1, const void *pMessage2);
  40. static int __cdecl CompareOnLineNumber(const void *pMessage1, const void *pMessage2);
  41. static int __cdecl CompareOnFunctionName(const void *pMessage1, const void *pMessage2);
  42. static int __cdecl CompareOnProcessId(const void *pMessage1, const void *pMessage2);
  43. static int __cdecl CompareOnThreadId(const void *pMessage1, const void *pMessage2);
  44. static int __cdecl CompareOnCpuNumber(const void *pMessage1, const void *pMessage2);
  45. static int __cdecl CompareOnSeqNumber(const void *pMessage1, const void *pMessage2);
  46. static int __cdecl CompareOnSystemTime(const void *pMessage1, const void *pMessage2);
  47. static int __cdecl CompareOnKernelTime(const void *pMessage1, const void *pMessage2);
  48. static int __cdecl CompareOnUserTime(const void *pMessage1, const void *pMessage2);
  49. static int __cdecl CompareOnIndent(const void *pMessage1, const void *pMessage2);
  50. static int __cdecl CompareOnFlagsName(const void *pMessage1, const void *pMessage2);
  51. static int __cdecl CompareOnLevelName(const void *pMessage1, const void *pMessage2);
  52. static int __cdecl CompareOnComponentName(const void *pMessage1, const void *pMessage2);
  53. static int __cdecl CompareOnSubComponentName(const void *pMessage1, const void *pMessage2);
  54. static int __cdecl ReverseCompareOnName(const void *pMessage1, const void *pMessage2);
  55. static int __cdecl ReverseCompareOnMessage(const void *pMessage1, const void *pMessage2);
  56. static int __cdecl ReverseCompareOnFileName(const void *pMessage1, const void *pMessage2);
  57. static int __cdecl ReverseCompareOnLineNumber(const void *pMessage1, const void *pMessage2);
  58. static int __cdecl ReverseCompareOnFunctionName(const void *pMessage1, const void *pMessage2);
  59. static int __cdecl ReverseCompareOnProcessId(const void *pMessage1, const void *pMessage2);
  60. static int __cdecl ReverseCompareOnThreadId(const void *pMessage1, const void *pMessage2);
  61. static int __cdecl ReverseCompareOnCpuNumber(const void *pMessage1, const void *pMessage2);
  62. static int __cdecl ReverseCompareOnSeqNumber(const void *pMessage1, const void *pMessage2);
  63. static int __cdecl ReverseCompareOnSystemTime(const void *pMessage1, const void *pMessage2);
  64. static int __cdecl ReverseCompareOnKernelTime(const void *pMessage1, const void *pMessage2);
  65. static int __cdecl ReverseCompareOnUserTime(const void *pMessage1, const void *pMessage2);
  66. static int __cdecl ReverseCompareOnIndent(const void *pMessage1, const void *pMessage2);
  67. static int __cdecl ReverseCompareOnFlagsName(const void *pMessage1, const void *pMessage2);
  68. static int __cdecl ReverseCompareOnLevelName(const void *pMessage1, const void *pMessage2);
  69. static int __cdecl ReverseCompareOnComponentName(const void *pMessage1, const void *pMessage2);
  70. static int __cdecl ReverseCompareOnSubComponentName(const void *pMessage1, const void *pMessage2);
  71. void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
  72. INLINE BOOL SetGroupActive(BOOL bActive)
  73. {
  74. LONG active = (LONG)bActive;
  75. return (BOOL)InterlockedExchange(&m_bGroupActive, active);
  76. }
  77. INLINE BOOL SetGroupInActive(BOOL bActive)
  78. {
  79. LONG active = (LONG)bActive;
  80. return (BOOL)InterlockedExchange(&m_bGroupInActive, active);
  81. }
  82. INLINE PVOID GetDockDialogBar()
  83. {
  84. return m_pDockDialogBar;
  85. }
  86. INLINE VOID SetDockDialogBar(PVOID pDockDialogBar)
  87. {
  88. m_pDockDialogBar = pDockDialogBar;
  89. }
  90. INLINE LONG GetDisplayFlags()
  91. {
  92. return m_displayFlags;
  93. }
  94. INLINE LONG GetDisplayID()
  95. {
  96. return m_displayID;
  97. }
  98. INLINE VOID SetDisplayID(LONG DisplayID)
  99. {
  100. m_displayID = DisplayID;
  101. }
  102. // Dialog Data
  103. enum { IDD = IDD_DISPLAY_DIALOG };
  104. LONG m_displayID;
  105. CListCtrl m_displayCtrl;
  106. PVOID m_pDockDialogBar;
  107. LONG m_displayFlags;
  108. CStringArray m_columnName;
  109. LONG m_columnWidth[MaxTraceSessionOptions];
  110. int m_retrievalArray[MaxTraceSessionOptions + 1];
  111. int m_insertionArray[MaxTraceSessionOptions + 1];
  112. CPtrArray m_sessionArray;
  113. int m_columnArray[MaxTraceSessionOptions];
  114. BOOL m_bShowLatest;
  115. CWinThread *m_pRealTimeOutputThread; // pointer to the log session data output thread
  116. HANDLE m_hRealTimeOutputThread; // handle to the real time data output thread
  117. HANDLE m_hRealTimeProcessingDoneEvent; // real time data output process complete event
  118. HANDLE m_hRealTimeProcessingStartEvent;// start processing event for the real time thread
  119. HANDLE m_hRealTimeTerminationEvent; // termination event for the real time thread
  120. TRACEHANDLE m_traceHandleArray[MAX_LOG_SESSIONS];
  121. LONG m_traceHandleCount;
  122. LONG m_totalBuffersRead;
  123. LONG m_totalEventsLost;
  124. LONG m_totalEventCount;
  125. PEVENT_CALLBACK m_pEventCallback;
  126. PLIST_ENTRY m_pEventListHead;
  127. BOOL m_bWriteListingFile;
  128. BOOL m_bWriteSummaryFile;
  129. BOOL m_bListingFileOpen;
  130. CStdioFile m_listingFile;
  131. CString m_listingFileName; // File name for event output
  132. CString m_summaryFileName; // File name for summary output
  133. LONG m_messageType;
  134. HANDLE m_hEndTraceEvent; // Event to signal stopping of session group
  135. CWinThread *m_pEndTraceThread; // pointer to the real time session cleanup thread
  136. LONG m_bGroupActive;
  137. LONG m_bGroupInActive;
  138. CArray<CTraceMessage*, CTraceMessage*> m_traceArray;
  139. HANDLE m_hTraceEventMutex;
  140. HANDLE m_hSessionArrayMutex;
  141. HWND m_hMainWnd;
  142. TCHAR m_pEventBuf[EVENT_BUFFER_SIZE];
  143. LONG m_lastSorted;
  144. BOOL m_bOrder;
  145. UINT_PTR m_eventTimer; // Trace event update timer
  146. int (__cdecl *m_traceSortRoutine[MaxTraceSessionOptions])(const void *, const void *);
  147. int (__cdecl *m_traceReverseSortRoutine[MaxTraceSessionOptions])(const void *, const void *);
  148. protected:
  149. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  150. public:
  151. //{{AFX_MSG(CDisplayDlg)
  152. afx_msg void OnNMClickDisplayList(NMHDR *pNMHDR, LRESULT *pResult);
  153. afx_msg void OnNMRClickDisplayList(NMHDR *pNMHDR, LRESULT *pResult);
  154. afx_msg void OnGetDispInfo(NMHDR *pNMHDR, LRESULT *pResult);
  155. afx_msg void OnLvnBeginScrollDisplayList(NMHDR *pNMHDR, LRESULT *pResult);
  156. afx_msg void OnClearDisplay();
  157. //}}AFX_MSG
  158. DECLARE_MESSAGE_MAP()
  159. virtual BOOL PreTranslateMessage(MSG* pMsg);
  160. afx_msg void OnNameDisplayColumnCheck();
  161. afx_msg void OnMessageDisplayColumnCheck();
  162. afx_msg void OnFileNameDisplayColumnCheck();
  163. afx_msg void OnLineNumberDisplayColumnCheck();
  164. afx_msg void OnFunctionNameDisplayColumnCheck();
  165. afx_msg void OnProcessIDDisplayColumnCheck();
  166. afx_msg void OnThreadIDDisplayColumnCheck();
  167. afx_msg void OnCpuNumberDisplayColumnCheck();
  168. afx_msg void OnSeqNumberDisplayColumnCheck();
  169. afx_msg void OnSystemTimeDisplayColumnCheck();
  170. afx_msg void OnKernelTimeDisplayColumnCheck();
  171. afx_msg void OnUserTimeDisplayColumnCheck();
  172. afx_msg void OnIndentDisplayColumnCheck();
  173. afx_msg void OnFlagsNameDisplayColumnCheck();
  174. afx_msg void OnLevelNameDisplayColumnCheck();
  175. afx_msg void OnComponentNameDisplayColumnCheck();
  176. afx_msg void OnSubComponentNameDisplayColumnCheck();
  177. afx_msg void OnTraceDone(WPARAM wParam, LPARAM lParam);
  178. afx_msg void OnTimer(UINT nIDEvent);
  179. BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  180. VOID CDisplayDlg::OnDoSort(NMHDR * pNmhdr, LRESULT * pResult);
  181. };
  182. VOID WINAPI DumpEvent0(PEVENT_TRACE pEvent);
  183. VOID WINAPI DumpEvent1(PEVENT_TRACE pEvent);
  184. VOID WINAPI DumpEvent2(PEVENT_TRACE pEvent);
  185. VOID WINAPI DumpEvent3(PEVENT_TRACE pEvent);
  186. VOID WINAPI DumpEvent4(PEVENT_TRACE pEvent);
  187. VOID WINAPI DumpEvent5(PEVENT_TRACE pEvent);
  188. VOID WINAPI DumpEvent6(PEVENT_TRACE pEvent);
  189. VOID WINAPI DumpEvent7(PEVENT_TRACE pEvent);
  190. VOID WINAPI DumpEvent8(PEVENT_TRACE pEvent);
  191. VOID WINAPI DumpEvent9(PEVENT_TRACE pEvent);
  192. VOID WINAPI DumpEvent10(PEVENT_TRACE pEvent);
  193. VOID WINAPI DumpEvent11(PEVENT_TRACE pEvent);
  194. VOID WINAPI DumpEvent12(PEVENT_TRACE pEvent);
  195. VOID WINAPI DumpEvent13(PEVENT_TRACE pEvent);
  196. VOID WINAPI DumpEvent14(PEVENT_TRACE pEvent);
  197. VOID WINAPI DumpEvent15(PEVENT_TRACE pEvent);
  198. VOID WINAPI DumpEvent16(PEVENT_TRACE pEvent);
  199. VOID WINAPI DumpEvent17(PEVENT_TRACE pEvent);
  200. VOID WINAPI DumpEvent18(PEVENT_TRACE pEvent);
  201. VOID WINAPI DumpEvent19(PEVENT_TRACE pEvent);
  202. VOID WINAPI DumpEvent20(PEVENT_TRACE pEvent);
  203. VOID WINAPI DumpEvent21(PEVENT_TRACE pEvent);
  204. VOID WINAPI DumpEvent22(PEVENT_TRACE pEvent);
  205. VOID WINAPI DumpEvent23(PEVENT_TRACE pEvent);
  206. VOID WINAPI DumpEvent24(PEVENT_TRACE pEvent);
  207. VOID WINAPI DumpEvent25(PEVENT_TRACE pEvent);
  208. VOID WINAPI DumpEvent26(PEVENT_TRACE pEvent);
  209. VOID WINAPI DumpEvent27(PEVENT_TRACE pEvent);
  210. VOID WINAPI DumpEvent28(PEVENT_TRACE pEvent);
  211. VOID WINAPI DumpEvent29(PEVENT_TRACE pEvent);
  212. VOID WINAPI DumpEvent30(PEVENT_TRACE pEvent);
  213. VOID WINAPI DumpEvent31(PEVENT_TRACE pEvent);
  214. VOID WINAPI DumpEvent32(PEVENT_TRACE pEvent);
  215. VOID WINAPI DumpEvent33(PEVENT_TRACE pEvent);
  216. VOID WINAPI DumpEvent34(PEVENT_TRACE pEvent);
  217. VOID WINAPI DumpEvent35(PEVENT_TRACE pEvent);
  218. VOID WINAPI DumpEvent36(PEVENT_TRACE pEvent);
  219. VOID WINAPI DumpEvent37(PEVENT_TRACE pEvent);
  220. VOID WINAPI DumpEvent38(PEVENT_TRACE pEvent);
  221. VOID WINAPI DumpEvent39(PEVENT_TRACE pEvent);
  222. VOID WINAPI DumpEvent40(PEVENT_TRACE pEvent);
  223. VOID WINAPI DumpEvent41(PEVENT_TRACE pEvent);
  224. VOID WINAPI DumpEvent42(PEVENT_TRACE pEvent);
  225. VOID WINAPI DumpEvent43(PEVENT_TRACE pEvent);
  226. VOID WINAPI DumpEvent44(PEVENT_TRACE pEvent);
  227. VOID WINAPI DumpEvent45(PEVENT_TRACE pEvent);
  228. VOID WINAPI DumpEvent46(PEVENT_TRACE pEvent);
  229. VOID WINAPI DumpEvent47(PEVENT_TRACE pEvent);
  230. VOID WINAPI DumpEvent48(PEVENT_TRACE pEvent);
  231. VOID WINAPI DumpEvent49(PEVENT_TRACE pEvent);
  232. VOID WINAPI DumpEvent50(PEVENT_TRACE pEvent);
  233. VOID WINAPI DumpEvent51(PEVENT_TRACE pEvent);
  234. VOID WINAPI DumpEvent52(PEVENT_TRACE pEvent);
  235. VOID WINAPI DumpEvent53(PEVENT_TRACE pEvent);
  236. VOID WINAPI DumpEvent54(PEVENT_TRACE pEvent);
  237. VOID WINAPI DumpEvent55(PEVENT_TRACE pEvent);
  238. VOID WINAPI DumpEvent56(PEVENT_TRACE pEvent);
  239. VOID WINAPI DumpEvent57(PEVENT_TRACE pEvent);
  240. VOID WINAPI DumpEvent58(PEVENT_TRACE pEvent);
  241. VOID WINAPI DumpEvent59(PEVENT_TRACE pEvent);
  242. VOID WINAPI DumpEvent60(PEVENT_TRACE pEvent);
  243. VOID WINAPI DumpEvent61(PEVENT_TRACE pEvent);
  244. VOID WINAPI DumpEvent62(PEVENT_TRACE pEvent);
  245. VOID WINAPI DumpEvent63(PEVENT_TRACE pEvent);