netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=104e4081bd9b81fccae86df06c0cccc5c94740f2

commit 104e4081bd9b81fccae86df06c0cccc5c94740f2
Author: Alastair Poole <nets...@gmail.com>
Date:   Mon Mar 1 21:58:15 2021 +0000

    procs: remove somethings BS
---
 src/bin/system/process.c     | 36 ++++++++++++------------------------
 src/bin/system/process.h     |  2 +-
 src/bin/ui/ui_process_list.c | 17 +++++++++--------
 3 files changed, 22 insertions(+), 33 deletions(-)

diff --git a/src/bin/system/process.c b/src/bin/system/process.c
index 397fd8a..24b6201 100644
--- a/src/bin/system/process.c
+++ b/src/bin/system/process.c
@@ -72,16 +72,16 @@ _states_init(void)
 #if defined(__linux__)
    _states['D']     = "dsleep";
    _states['I']     = "idle";
-   _states['R']     = "run";
-   _states['S']     = "sleep";
-   _states['T']     = "stop";
+   _states['R']     = "running";
+   _states['S']     = "sleeping";
+   _states['T']     = "stopped";
    _states['X']     = "dead";
    _states['Z']     = "zombie";
 #else
    _states[SIDL]    = "idle";
-   _states[SRUN]    = "run";
-   _states[SSLEEP]  = "sleep";
-   _states[SSTOP]   = "stop";
+   _states[SRUN]    = "running";
+   _states[SSLEEP]  = "sleeping";
+   _states[SSTOP]   = "stopped";
 #if !defined(__MacOS__)
 #if !defined(__OpenBSD__)
    _states[SWAIT]   = "wait";
@@ -90,7 +90,7 @@ _states_init(void)
 #endif
 #if defined(__OpenBSD__)
    _states[SDEAD]   = "dead";
-   _states[SONPROC] = "run";
+   _states[SONPROC] = "running";
 #endif
 #endif
 #endif
@@ -358,7 +358,6 @@ _process_list_linux_get(void)
         p->cpu_id = st.psr;
         p->start = st.start_time;
         p->run_time = st.run_time;
-        if (toupper(st.state) == 'S') p->ssleep = 1;
         state = _process_state_name(st.state);
         snprintf(p->state, sizeof(p->state), "%s", state);
         p->cpu_time = st.utime + st.stime;
@@ -399,7 +398,6 @@ _proc_thread_info(Proc_Info *p)
         Proc_Info *t = calloc(1, sizeof(Proc_Info));
         if (!t) continue;
         t->cpu_id = st.psr;
-        if (toupper(st.state) == 'S') p->ssleep = 1;
         state = _process_state_name(st.state);
         snprintf(t->state, sizeof(t->state), "%s", state);
         t->cpu_time = st.utime + st.stime;
@@ -436,7 +434,6 @@ proc_info_by_pid(int pid)
    p->cpu_id = st.psr;
    p->start = st.start_time;
    p->run_time = st.run_time;
-   if (toupper(st.state) == 'S') p->ssleep = 1;
    state = _process_state_name(st.state);
    snprintf(p->state, sizeof(p->state), "%s", state);
    p->cpu_time = st.utime + st.stime;
@@ -472,14 +469,10 @@ _proc_get(Proc_Info *p, struct kinfo_proc *kp)
    p->start = kp->p_ustart_sec;
    p->run_time = kp->p_uutime_sec + kp->p_ustime_sec +
                  (kp->p_uutime_usec / 1000000) + (kp->p_ustime_usec / 1000000);
-   if (kp->p_stat == SSLEEP)
-     {
-        state = kp->p_wmesg;
-        p->ssleep = 1;
-     }
-   else
-     state = _process_state_name(kp->p_stat);
+
+   state = _process_state_name(kp->p_stat);
    snprintf(p->state, sizeof(p->state), "%s", state);
+   snprintf(p->wchan, sizeof(p->wchan), "%s", kp->p_wmesg);
    p->cpu_time = kp->p_uticks + kp->p_sticks + kp->p_iticks;
    p->mem_virt = p->mem_size = (MEMSZ(kp->p_vm_tsize) * MEMSZ(pagesize)) +
       (MEMSZ(kp->p_vm_dsize) * MEMSZ(pagesize)) + (MEMSZ(kp->p_vm_ssize) * 
MEMSZ(pagesize));
@@ -970,14 +963,9 @@ _proc_thread_info(struct kinfo_proc *kp, Eina_Bool 
is_thread)
    p->cpu_time = ((usage->ru_utime.tv_sec * 1000000) + usage->ru_utime.tv_usec 
+
        (usage->ru_stime.tv_sec * 1000000) + usage->ru_stime.tv_usec) / 10000;
    p->run_time = (kp->ki_runtime + 500000) / 1000000;
-   if (kp->ki_stat == SSLEEP)
-     {
-        state = kp->ki_wmesg;
-        p->ssleep = 1;
-     }
-   else
-     state = _process_state_name(kp->ki_stat);
+   state = _process_state_name(kp->ki_stat);
    snprintf(p->state, sizeof(p->state), "%s", state);
+   snprintf(p->wchan, sizeof(p->wchan), "%s", kp->ki_wmesg);
    p->mem_virt = kp->ki_size;
    p->mem_rss = MEMSZ(kp->ki_rssize) * MEMSZ(pagesize);
    p->start = kp->ki_start.tv_sec;
diff --git a/src/bin/system/process.h b/src/bin/system/process.h
index 0f8ae9d..9f3f795 100644
--- a/src/bin/system/process.h
+++ b/src/bin/system/process.h
@@ -30,8 +30,8 @@ typedef struct _Proc_Info
 
    char       *command;
    char       *arguments;
-   int         ssleep;
    char        state[32];
+   char        wchan[32];
 
    Eina_List   *fds;
    int         numfiles;
diff --git a/src/bin/ui/ui_process_list.c b/src/bin/ui/ui_process_list.c
index 33f2aea..7eee145 100644
--- a/src/bin/ui/ui_process_list.c
+++ b/src/bin/ui/ui_process_list.c
@@ -783,18 +783,19 @@ static void
 _summary_total(Ui_Data *pd, Proc_Info *proc)
 {
    pd->summary.total++;
-   if (!strcmp(proc->state, "run"))
+   if (!strcmp(proc->state, "running"))
      pd->summary.running++;
-   pd->summary.sleeping += proc->ssleep;
-   if (!strcmp(proc->state, "stop"))
+   else if (!strcmp(proc->state, "sleeping"))
+     pd->summary.sleeping++;
+   else if (!strcmp(proc->state, "stopped"))
      pd->summary.stopped++;
-   if (!strcmp(proc->state, "idle"))
+   else if (!strcmp(proc->state, "idle"))
      pd->summary.idle++;
-   if (!strcmp(proc->state, "zombie"))
+   else if (!strcmp(proc->state, "zombie"))
      pd->summary.zombie++;
-   if (!strcmp(proc->state, "dead"))
+   else if (!strcmp(proc->state, "dead"))
      pd->summary.dead++;
-   if (!strcmp(proc->state, "dsleep"))
+   else if (!strcmp(proc->state, "dsleep"))
      pd->summary.dsleep++;
 }
 
@@ -1755,7 +1756,7 @@ _content_add(Ui_Data *pd, Evas_Object *parent)
    elm_genlist_homogeneous_set(glist, 1);
    elm_scroller_gravity_set(glist, 0.0, 1.0);
    elm_object_focus_allow_set(glist, 1);
-   elm_scroller_policy_set(glist, ELM_SCROLLER_POLICY_OFF,
+   elm_scroller_policy_set(glist, ELM_SCROLLER_POLICY_AUTO,
                            (ui->proc.show_scroller ?
                             ELM_SCROLLER_POLICY_AUTO :
                             ELM_SCROLLER_POLICY_OFF));

-- 


Reply via email to