processes: Allow toggle of kernel threads.

This commit is contained in:
Alastair Poole 2020-07-31 19:13:23 +01:00
parent 8ac69d606e
commit 305ba225e4
5 changed files with 40 additions and 4 deletions

6
NEWS
View File

@ -1,3 +1,9 @@
============
Evisum 0.5.3
============
* Option to show kernel threads.
============ ============
Evisum 0.5.2 Evisum 0.5.2
============ ============

5
README
View File

@ -29,3 +29,8 @@ Patches with bug fixes are more than welcome. If you do wish to
add a substantial querying feature PLEASE ensure that it works reliaibly add a substantial querying feature PLEASE ensure that it works reliaibly
on OpenBSD, Linux and FreeBSD (ideally macOS also). UI changes on OpenBSD, Linux and FreeBSD (ideally macOS also). UI changes
should be platform independent. should be platform independent.
NOTES:
Ctrl + k or Ctrl + K to show kernel threads.
Ctrl + e or Ctrl + E to show evisum in the process list.

View File

@ -44,6 +44,20 @@
#include "macros.h" #include "macros.h"
static Eina_Bool _show_kthreads = EINA_FALSE;
void
proc_info_kthreads_show_set(Eina_Bool enabled)
{
_show_kthreads = enabled;
}
Eina_Bool
proc_info_kthreads_show_get(void)
{
return _show_kthreads;
}
static const char * static const char *
_process_state_name(char state) _process_state_name(char state)
{ {
@ -305,7 +319,8 @@ _process_list_linux_get(void)
if (!_stat(eina_slstr_printf("/proc/%d/stat", pid), &st)) if (!_stat(eina_slstr_printf("/proc/%d/stat", pid), &st))
continue; continue;
if (st.flags & PF_KTHREAD) continue; if (st.flags & PF_KTHREAD && !proc_info_kthreads_show_get())
continue;
Proc_Info *p = calloc(1, sizeof(Proc_Info)); Proc_Info *p = calloc(1, sizeof(Proc_Info));
if (!p) return NULL; if (!p) return NULL;
@ -895,7 +910,7 @@ _process_list_freebsd_fallback_get(void)
if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1) if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1)
continue; continue;
if (kp.ki_flag & P_KPROC) if (kp.ki_flag & P_KPROC && !proc_info_kthreads_show_get())
continue; continue;
Proc_Info *p = _proc_thread_info(&kp, EINA_FALSE); Proc_Info *p = _proc_thread_info(&kp, EINA_FALSE);
@ -928,7 +943,7 @@ _process_list_freebsd_get(void)
for (int i = 0; i < pid_count; i++) for (int i = 0; i < pid_count; i++)
{ {
if (kps[i].ki_flag & P_KPROC) if (kps[i].ki_flag & P_KPROC && !proc_info_kthreads_show_get())
continue; continue;
kp = &kps[i]; kp = &kps[i];
@ -988,7 +1003,7 @@ proc_info_by_pid(int pid)
for (int i = 0; i < pid_count; i++) for (int i = 0; i < pid_count; i++)
{ {
if (kps[i].ki_flag & P_KPROC) if (kps[i].ki_flag & P_KPROC && !proc_info_kthreads_show_get())
continue; continue;
if (kps[i].ki_pid != pid) if (kps[i].ki_pid != pid)
continue; continue;

View File

@ -76,6 +76,13 @@ proc_info_by_pid(int pid);
void void
proc_info_free(Proc_Info *proc); proc_info_free(Proc_Info *proc);
void
proc_info_kthreads_show_set(Eina_Bool enabled);
Eina_Bool
proc_info_kthreads_show_get(void);
/** /**
* @} * @}
*/ */

View File

@ -1381,6 +1381,9 @@ _evisum_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
if (ev->keyname[0] == 'e' || ev->keyname[0] == 'E') if (ev->keyname[0] == 'e' || ev->keyname[0] == 'E')
ui->show_self = !ui->show_self; ui->show_self = !ui->show_self;
if (ev->keyname[0] == 'k' || ev->keyname[0] == 'K')
proc_info_kthreads_show_set(!proc_info_kthreads_show_get());
_config_save(ui); _config_save(ui);
} }