MCPcopy Create free account
hub / github.com/BeneficialCode/WinArk / GetColumnText

Method GetColumnText

WinArk/EtwView.cpp:62–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62CString CEtwView::GetColumnText(HWND, int row, int col) const {
63 auto item = m_Events[row].get();
64
65 CString text;
66 switch (col)
67 {
68 case 0:// index
69 text.Format(L"%7u", item->GetIndex());
70 if (item->GetStackEventData())
71 text += L" *";
72 break;
73
74 case 1:// Time
75 {
76 auto ts = item->GetTimeStamp();
77 return FormatHelper::FormatTime(ts);
78 }
79
80 case 3:// PID
81 {
82 DWORD tid = -1;
83 DWORD pid = -1;
84 if (item->GetEventName() == L"Thread/CSwitch") {
85 tid = item->GetProperty(L"NewThreadId")->GetValue<DWORD>();
86 HANDLE hThread = ::OpenThread(THREAD_QUERY_INFORMATION, FALSE, tid);
87 if (hThread != NULL) {
88 pid = GetProcessIdOfThread(hThread);
89 ::CloseHandle(hThread);
90 }
91 }
92 else if (item->GetEventName() == L"PerfInfo/SysClEnter") {
93 tid = _threadById[item->GetProcessorNumber()];
94 pid = _processById[tid];
95 }
96 else {
97 pid = item->GetProcessId();
98 }
99 if (pid != (DWORD)-1 && pid != 0)
100 text.Format(L"%u (0x%X)", pid, pid);
101 break;
102 }
103
104 case 5:// TID
105 {
106 DWORD tid = -1;
107 if (item->GetEventName() == L"Thread/CSwitch") {
108 tid = item->GetProperty(L"NewThreadId")->GetValue<DWORD>();
109 }
110 else if (item->GetEventName() == L"PerfInfo/SysClEnter") {
111 tid = _threadById[item->GetProcessorNumber()];
112 }
113 else {
114 tid = item->GetThreadId();
115 }
116 if (tid != (DWORD)-1 && tid != 0)
117 text.Format(L"%u (0x%X)", tid, tid);
118
119 break;

Callers

nothing calls this directly

Calls 7

GetIndexMethod · 0.80
GetStackEventDataMethod · 0.80
GetTimeStampMethod · 0.80
GetPropertyMethod · 0.80
GetProcessorNumberMethod · 0.80
GetProcessIdMethod · 0.80
GetThreadIdMethod · 0.80

Tested by

no test coverage detected