From 80d04a8fbd9782a82032f2495eedc91597be881d Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sun, 13 Sep 2020 21:38:56 -0400 Subject: [PATCH] Remove SystemThread performance stats Resolves #18 --- game/system/SystemThread.cpp | 33 --------------------------------- game/system/SystemThread.h | 3 --- 2 files changed, 36 deletions(-) diff --git a/game/system/SystemThread.cpp b/game/system/SystemThread.cpp index 408d963f2a..d449f7d405 100644 --- a/game/system/SystemThread.cpp +++ b/game/system/SystemThread.cpp @@ -134,36 +134,3 @@ bool SystemThreadInterface::get_want_exit() const { void SystemThreadInterface::trigger_shutdown() { thread.manager->shutdown(); } - -// TODO-Windows -#ifdef __linux__ -#include -#include - -/*! - * Get thread performance statistics and report them. - */ -void SystemThreadInterface::report_perf_stats() { - if (thread.stat_diff_timer.getMs() > 16.f) { - thread.stat_diff_timer.start(); - - uint64_t current_ns = thread.stats_timer.getNs(); - rusage stats; - getrusage(RUSAGE_THREAD, &stats); - - uint64_t current_kernel = stats.ru_stime.tv_usec + (1000000 * stats.ru_stime.tv_sec); - uint64_t current_user = stats.ru_utime.tv_usec + (1000000 * stats.ru_utime.tv_sec); - - uint64_t ns_dt = current_ns - thread.last_collection_nanoseconds; - uint64_t dt_kernel = current_kernel - thread.last_cpu_kernel; - uint64_t dt_user = current_user - thread.last_cpu_user; - - thread.cpu_kernel = dt_kernel * 1000. / (double)ns_dt; - thread.cpu_user = dt_user * 1000. / (double)ns_dt; - - thread.last_cpu_kernel = current_kernel; - thread.last_cpu_user = current_user; - thread.last_collection_nanoseconds = current_ns; - } -} -#endif \ No newline at end of file diff --git a/game/system/SystemThread.h b/game/system/SystemThread.h index 0a01af1837..2d794cb940 100644 --- a/game/system/SystemThread.h +++ b/game/system/SystemThread.h @@ -24,8 +24,6 @@ class SystemThreadManager; * Runs a function in a thread and provides a SystemThreadInterface to that function. * Once the thread is ready, it should tell the interface with intitialization_complete(). * Thread functions should try to return when get_want_exit() returns true. - * Thread functions should also call report_perf_stats every now and then to update performance - * statistics. */ class SystemThread { public: @@ -63,7 +61,6 @@ class SystemThreadInterface { public: SystemThreadInterface(SystemThread* p) : thread(*p) {} void initialization_complete(); - void report_perf_stats(); bool get_want_exit() const; void trigger_shutdown();