summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-10-20 00:43:25 +0000
committerHisham Muhammad <hisham@gobolinux.org>2012-10-20 00:43:25 +0000
commitf44a8f2009e443349655e32512ef1dc453f3fa22 (patch)
tree1170ac0c98bab6490cd72c34c33046349b74c669
parent1b21827f1f875692e14ee5ac9b22f3fd69fd8593 (diff)
Option to update process names on every refresh
(thanks to Rob Hoelz)
-rw-r--r--ChangeLog2
-rw-r--r--DisplayOptionsPanel.c1
-rw-r--r--ProcessList.c7
-rw-r--r--ProcessList.h1
-rw-r--r--Settings.c3
5 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 4376249d..a866a6a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@ What's new in version 1.0.2
* Avoid deleting .htoprc if it is a symlink
* Fail gracefully when /proc is not mounted
(thanks to Philipp Hagemeister)
+* Option to update process names on every refresh
+ (thanks to Rob Hoelz)
* BUGFIX: Fix crashes when process list is empty
What's new in version 1.0.1
diff --git a/DisplayOptionsPanel.c b/DisplayOptionsPanel.c
index bf521a81..7ec035b0 100644
--- a/DisplayOptionsPanel.c
+++ b/DisplayOptionsPanel.c
@@ -83,5 +83,6 @@ DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager*
Panel_add(super, (Object*) CheckItem_new(strdup("Leave a margin around header"), &(settings->header->margin), false));
Panel_add(super, (Object*) CheckItem_new(strdup("Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest)"), &(settings->pl->detailedCPUTime), false));
Panel_add(super, (Object*) CheckItem_new(strdup("Count CPUs from 0 instead of 1"), &(settings->pl->countCPUsFromZero), false));
+ Panel_add(super, (Object*) CheckItem_new(strdup("Update process names on every refresh"), &(settings->pl->updateProcessNames), false));
return this;
}
diff --git a/ProcessList.c b/ProcessList.c
index 30cc8012..04adac54 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -153,6 +153,7 @@ typedef struct ProcessList_ {
bool highlightThreads;
bool detailedCPUTime;
bool countCPUsFromZero;
+ bool updateProcessNames;
const char **treeStr;
} ProcessList;
@@ -239,6 +240,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) {
this->highlightMegabytes = false;
this->detailedCPUTime = false;
this->countCPUsFromZero = false;
+ this->updateProcessNames = false;
this->treeStr = NULL;
this->following = -1;
@@ -712,6 +714,11 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
goto errorReadingProcess;
ProcessList_add(this, process);
+ } else {
+ if (this->updateProcessNames) {
+ if (! ProcessList_readCmdlineFile(process, dirname, name))
+ goto errorReadingProcess;
+ }
}
if (process->state == 'Z') {
diff --git a/ProcessList.h b/ProcessList.h
index dc628bf1..34bd5e8b 100644
--- a/ProcessList.h
+++ b/ProcessList.h
@@ -136,6 +136,7 @@ typedef struct ProcessList_ {
bool highlightThreads;
bool detailedCPUTime;
bool countCPUsFromZero;
+ bool updateProcessNames;
const char **treeStr;
} ProcessList;
diff --git a/Settings.c b/Settings.c
index 4782e84b..fd200a7c 100644
--- a/Settings.c
+++ b/Settings.c
@@ -124,6 +124,8 @@ static bool Settings_read(Settings* this, char* fileName, int cpuCount) {
this->pl->detailedCPUTime = atoi(option[1]);
} else if (String_eq(option[0], "cpu_count_from_zero")) {
this->pl->countCPUsFromZero = atoi(option[1]);
+ } else if (String_eq(option[0], "update_process_names")) {
+ this->pl->updateProcessNames = atoi(option[1]);
} else if (String_eq(option[0], "delay")) {
this->delay = atoi(option[1]);
} else if (String_eq(option[0], "color_scheme")) {
@@ -183,6 +185,7 @@ bool Settings_write(Settings* this) {
fprintf(fd, "header_margin=%d\n", (int) this->header->margin);
fprintf(fd, "detailed_cpu_time=%d\n", (int) this->pl->detailedCPUTime);
fprintf(fd, "cpu_count_from_zero=%d\n", (int) this->pl->countCPUsFromZero);
+ fprintf(fd, "update_process_names=%d\n", (int) this->pl->updateProcessNames);
fprintf(fd, "color_scheme=%d\n", (int) this->colorScheme);
fprintf(fd, "delay=%d\n", (int) this->delay);
fprintf(fd, "left_meters=");

© 2014-2024 Faster IT GmbH | imprint | privacy policy