netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=801e83d990365690f55165f99dd65c8065877e4e

commit 801e83d990365690f55165f99dd65c8065877e4e
Author: Alastair Poole <[email protected]>
Date:   Fri May 15 21:17:00 2020 +0100

    Linux: Add TID and name.
---
 src/bin/system/process.c | 8 +++++++-
 src/bin/system/process.h | 3 +++
 src/bin/ui/ui_process.c  | 4 ++--
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/bin/system/process.c b/src/bin/system/process.c
index 14572cc..8a508b2 100644
--- a/src/bin/system/process.c
+++ b/src/bin/system/process.c
@@ -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);
 }
 
diff --git a/src/bin/system/process.h b/src/bin/system/process.h
index fbade11..c1d97ca 100644
--- a/src/bin/system/process.h
+++ b/src/bin/system/process.h
@@ -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;
 
diff --git a/src/bin/ui/ui_process.c b/src/bin/ui/ui_process.c
index 9e88c8a..5b10d0f 100644
--- a/src/bin/ui/ui_process.c
+++ b/src/bin/ui/ui_process.c
@@ -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);

-- 


Reply via email to