mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-13 02:08:49 +12:00
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:
parent
5defa9c7b0
commit
8981227644
2 changed files with 43 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue