aboutsummaryrefslogtreecommitdiffstats
path: root/TasksMeter.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-04-11 13:00:27 +0200
committerDaniel Lange <DLange@git.local>2016-04-11 13:00:27 +0200
commit283707c5e5bc436b78ea23bf5500cb6b16a01148 (patch)
treeb977131bbbb4c3bd8ade370aab2e4fc913440c04 /TasksMeter.c
parentbea9b4798717b6f4e31085506dfc179eeb8dc17c (diff)
downloaddebian_htop-283707c5e5bc436b78ea23bf5500cb6b16a01148.tar.gz
debian_htop-283707c5e5bc436b78ea23bf5500cb6b16a01148.tar.bz2
debian_htop-283707c5e5bc436b78ea23bf5500cb6b16a01148.zip
Imported Upstream version 0.9upstream/0.9
Diffstat (limited to 'TasksMeter.c')
-rw-r--r--TasksMeter.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/TasksMeter.c b/TasksMeter.c
index f21ec82..9f17795 100644
--- a/TasksMeter.c
+++ b/TasksMeter.c
@@ -1,6 +1,6 @@
/*
htop
-(C) 2004-2006 Hisham H. Muhammad
+(C) 2004-2010 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
@@ -19,18 +19,37 @@ int TasksMeter_attributes[] = {
};
static void TasksMeter_setValues(Meter* this, char* buffer, int len) {
- this->total = this->pl->totalTasks;
- this->values[0] = this->pl->runningTasks;
+ ProcessList* pl = this->pl;
+ this->total = pl->totalTasks;
+ this->values[0] = pl->runningTasks;
snprintf(buffer, len, "%d/%d", (int) this->values[0], (int) this->total);
}
static void TasksMeter_display(Object* cast, RichString* out) {
Meter* this = (Meter*)cast;
- RichString_init(out);
+ ProcessList* pl = this->pl;
char buffer[20];
- sprintf(buffer, "%d", (int)this->total);
- RichString_append(out, CRT_colors[METER_VALUE], buffer);
- RichString_append(out, CRT_colors[METER_TEXT], " total, ");
+ sprintf(buffer, "%d", (int)(this->total - pl->userlandThreads - pl->kernelThreads));
+ RichString_write(out, CRT_colors[METER_VALUE], buffer);
+ int threadValueColor = CRT_colors[METER_VALUE];
+ int threadCaptionColor = CRT_colors[METER_TEXT];
+ if (pl->highlightThreads) {
+ threadValueColor = CRT_colors[PROCESS_THREAD_BASENAME];
+ threadCaptionColor = CRT_colors[PROCESS_THREAD];
+ }
+ if (!pl->hideUserlandThreads) {
+ RichString_append(out, CRT_colors[METER_TEXT], ", ");
+ sprintf(buffer, "%d", (int)pl->userlandThreads);
+ RichString_append(out, threadValueColor, buffer);
+ RichString_append(out, threadCaptionColor, " thr");
+ }
+ if (!pl->hideKernelThreads) {
+ RichString_append(out, CRT_colors[METER_TEXT], ", ");
+ sprintf(buffer, "%d", (int)pl->kernelThreads);
+ RichString_append(out, threadValueColor, buffer);
+ RichString_append(out, threadCaptionColor, " kthr");
+ }
+ RichString_append(out, CRT_colors[METER_TEXT], "; ");
sprintf(buffer, "%d", (int)this->values[0]);
RichString_append(out, CRT_colors[TASKS_RUNNING], buffer);
RichString_append(out, CRT_colors[METER_TEXT], " running");

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