pstats: Add convenience method for ticking current thread only

This commit is contained in:
rdb 2022-02-15 17:31:18 +01:00
parent aea2d6ef45
commit cf9574b412
2 changed files with 33 additions and 0 deletions

View File

@ -373,6 +373,14 @@ main_tick() {
get_global_pstats()->client_main_tick();
}
/**
* A convenience function to call new_frame() for the current thread.
*/
void PStatClient::
thread_tick() {
get_global_pstats()->client_thread_tick();
}
/**
* A convenience function to call new_frame() on any threads with the
* indicated sync_name
@ -410,6 +418,19 @@ client_main_tick() {
}
}
/**
* A convenience function to call new_frame() on the current thread.
*/
void PStatClient::
client_thread_tick() {
ReMutexHolder holder(_lock);
if (has_impl()) {
PStatThread thread = do_get_current_thread();
_impl->new_frame(thread.get_index());
}
}
/**
* A convenience function to call new_frame() on all of the threads with the
* indicated sync name.
@ -1285,6 +1306,10 @@ void PStatClient::
main_tick() {
}
void PStatClient::
thread_tick() {
}
void PStatClient::
thread_tick(const std::string &) {
}
@ -1293,6 +1318,10 @@ void PStatClient::
client_main_tick() {
}
void PStatClient::
client_thread_tick() {
}
void PStatClient::
client_thread_tick(const std::string &sync_name) {
}

View File

@ -95,9 +95,11 @@ PUBLISHED:
INLINE static void resume_after_pause();
static void main_tick();
static void thread_tick();
static void thread_tick(const std::string &sync_name);
void client_main_tick();
void client_thread_tick();
void client_thread_tick(const std::string &sync_name);
bool client_connect(std::string hostname, int port);
void client_disconnect();
@ -291,10 +293,12 @@ PUBLISHED:
INLINE static void resume_after_pause() { }
static void main_tick();
static void thread_tick();
static void thread_tick(const std::string &);
public:
void client_main_tick();
void client_thread_tick();
void client_thread_tick(const std::string &sync_name);
bool client_connect(std::string hostname, int port);
void client_disconnect();