| 7 | } |
| 8 | |
| 9 | CString ThreadObjectType::GetDetails(HANDLE hThread) { |
| 10 | CString details; |
| 11 | auto tid = ::GetThreadId(hThread); |
| 12 | if (tid == 0) |
| 13 | return details; |
| 14 | |
| 15 | auto pid = ::GetProcessIdOfThread(hThread); |
| 16 | FILETIME created{}, exited{}, kernel{}, user{}; |
| 17 | ATLVERIFY(::GetThreadTimes(hThread, &created, &exited, &kernel, &user)); |
| 18 | CString name; |
| 19 | auto info = _pm.GetProcessById(pid); |
| 20 | if (info) |
| 21 | name = info->GetImageName().c_str(); |
| 22 | details.Format(L"TID: %u, PID: %u (%s) Created: %s, Exited: %s, CPU Time: %s", |
| 23 | tid, pid, name, CTime(created).Format(L"%D %X"), |
| 24 | exited.dwHighDateTime + exited.dwLowDateTime == 0 ? CString(L"(running)") : CTime(exited).Format(L"%D %X"), |
| 25 | CTimeSpan((*(int64_t*)& kernel + *(int64_t*)& user) / 10000000).Format(L"%D.%H:%M:%S")); |
| 26 | |
| 27 | return details; |
| 28 | } |
nothing calls this directly
no test coverage detected