Skip to content

Commit

Permalink
[REFACT] ThreadScanner: in debug - print translated wait reason
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Sep 1, 2024
1 parent c577d47 commit ac1ccf7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions scanners/thread_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ void pesieve::ThreadScanner::printThreadInfo(const pesieve::util::thread_info& t
if (threadi.is_extended) {
std::cout << std::hex << "\tSysStart: ";
printResolvedAddr(threadi.ext.sys_start_addr);
std::cout << "\tState: " << threadi.ext.state;
std::cout << "\tState: [" << ThreadScanReport::translate_thread_state(threadi.ext.state) << "]";
if (threadi.ext.state == Waiting) {
std::cout << " Reason: " << threadi.ext.wait_reason << " Time: " << threadi.ext.wait_time;
std::cout << " Reason: [" << ThreadScanReport::translate_wait_reason(threadi.ext.wait_reason) << "] Time: " << threadi.ext.wait_time;
}
std::cout << "\n";
}
Expand Down
9 changes: 5 additions & 4 deletions scanners/thread_scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ namespace pesieve {
static const DWORD THREAD_STATE_UNKNOWN = (-1);
static const DWORD THREAD_STATE_WAITING = 5;

static std::string translate_thread_state(DWORD thread_state);
static std::string translate_wait_reason(DWORD thread_wait_reason);

//---

ThreadScanReport(DWORD _tid)
: ModuleScanReport(0, 0),
tid(_tid),
Expand Down Expand Up @@ -71,10 +76,6 @@ namespace pesieve {
DWORD thread_wait_reason;
DWORD thread_wait_time;
AreaEntropyStats stats;

protected:
static std::string translate_thread_state(DWORD thread_state);
static std::string translate_wait_reason(DWORD thread_wait_reason);
};

//! A custom structure keeping a fragment of a thread context
Expand Down

0 comments on commit ac1ccf7

Please sign in to comment.