util/thread_ctrl: Method for measuring cycles a thread has run for
Also add a getter for the native thread handle.
This commit is contained in:
@@ -138,6 +138,9 @@ class thread_ctrl final
|
||||
// Fixed name
|
||||
std::string m_name;
|
||||
|
||||
// CPU cycles thread has run for
|
||||
u64 m_cycles{0};
|
||||
|
||||
// Start thread
|
||||
static void start(const std::shared_ptr<thread_ctrl>&, task_stack);
|
||||
|
||||
@@ -172,6 +175,15 @@ public:
|
||||
return m_name;
|
||||
}
|
||||
|
||||
// Get CPU cycles since last time this function was called. First call returns 0.
|
||||
u64 get_cycles();
|
||||
|
||||
// Get platform-specific thread handle
|
||||
std::uintptr_t get_native_handle() const
|
||||
{
|
||||
return m_thread.load();
|
||||
}
|
||||
|
||||
// Get exception
|
||||
std::exception_ptr get_exception() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user