Linux: Add TID and name.

This commit is contained in:
Alastair Poole 2020-05-15 21:17:00 +01:00
parent ee290301af
commit 801e83d990
3 changed files with 12 additions and 3 deletions

View File

@ -350,7 +350,10 @@ _proc_thread_info(Proc_Info *p)
t->numthreads = st.numthreads;
t->mem_virt = st.mem_virt;
t->mem_rss = st.mem_rss;
t->command = strdup(st.name);
t->tid = tid;
t->thread_name = strdup(st.name);
p->threads = eina_list_append(p->threads, t);
}
@ -1085,6 +1088,9 @@ proc_info_free(Proc_Info *proc)
free(proc->command);
if (proc->arguments)
free(proc->arguments);
if (proc->thread_name)
free(proc->thread_name);
free(proc);
}

View File

@ -46,6 +46,9 @@ typedef struct _Proc_Info
// Not used yet in UI.
long cpu_time;
int tid;
char *thread_name;
Eina_List *threads;
} Proc_Info;

View File

@ -48,7 +48,7 @@ _thread_info_set(Ui_Process *ui, Proc_Info *proc)
{
long *cpu_time, *cpu_time_prev;
double cpu_usage = 0.0;
const char *key = t->command;
const char *key = eina_slstr_printf("%s:%d", t->thread_name, t->tid);
if ((cpu_time_prev = eina_hash_find(ui->hash_cpu_times, key)) == NULL)
{
@ -62,7 +62,7 @@ _thread_info_set(Ui_Process *ui, Proc_Info *proc)
*cpu_time_prev = t->cpu_time;
}
eina_strbuf_append_printf(buf, "Name %s<br>", t->command);
eina_strbuf_append_printf(buf, "Name %s<br>", t->thread_name);
eina_strbuf_append_printf(buf, "State %s<br>", t->state);
eina_strbuf_append_printf(buf, "CPU %d<br>", t->cpu_id);
eina_strbuf_append_printf(buf, "CPU %1.1f%%", cpu_usage);