Remove SystemThread performance stats

Resolves #18
This commit is contained in:
Tyler Wilding
2020-09-13 21:38:56 -04:00
parent 28cd6a7e65
commit 80d04a8fbd
2 changed files with 0 additions and 36 deletions
-33
View File
@@ -134,36 +134,3 @@ bool SystemThreadInterface::get_want_exit() const {
void SystemThreadInterface::trigger_shutdown() {
thread.manager->shutdown();
}
// TODO-Windows
#ifdef __linux__
#include <sys/time.h>
#include <sys/resource.h>
/*!
* 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
-3
View File
@@ -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();