Calculate thread busyness as the current concurrent running threads vs. the max number of threads ever seen running concurrently.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4404 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-08-17 00:01:59 +00:00
parent 358d02d97f
commit faca2d387b
6 changed files with 23 additions and 61 deletions

View File

@ -114,7 +114,6 @@ typedef struct _tf_task_t
uv_timer_t trace_timer;
uint64_t last_hrtime;
uint64_t last_idle_time;
uint64_t last_thread_time;
float idle_percent;
float thread_percent;
@ -1462,12 +1461,10 @@ static void _tf_task_trace_timer(uv_timer_t* timer)
tf_task_t* task = timer->data;
uint64_t hrtime = uv_hrtime();
uint64_t idle_time = uv_metrics_idle_time(&task->_loop);
uint64_t thread_time = tf_ssb_get_average_thread_time(task->_ssb);
task->idle_percent = (hrtime - task->last_hrtime) ? 100.0f * (idle_time - task->last_idle_time) / (hrtime - task->last_hrtime) : 0.0f;
task->thread_percent = (hrtime - task->last_hrtime) ? 100.0f * (thread_time - task->last_thread_time) / (hrtime - task->last_hrtime) : 0.0f;
task->thread_percent = tf_ssb_get_average_thread_percent(task->_ssb);
task->last_hrtime = hrtime;
task->last_idle_time = idle_time;
task->last_thread_time = thread_time;
const char* k_names[] =
{
"child_tasks",