aboutsummaryrefslogtreecommitdiffstats
path: root/TasksMeter.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
committerDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
commit65357c8c46154de4e4eca14075bfe5523bb5fc14 (patch)
tree8f430ee5a0d5de377c4e7c94e47842a27c70d7e8 /TasksMeter.c
parentf80394a20254938142011855f2954b3f63fe5909 (diff)
downloaddebian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.gz
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.bz2
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.zip
New upstream version 3.0.3upstream/3.0.3
Diffstat (limited to 'TasksMeter.c')
-rw-r--r--TasksMeter.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/TasksMeter.c b/TasksMeter.c
index 0b37ab2..7696988 100644
--- a/TasksMeter.c
+++ b/TasksMeter.c
@@ -1,22 +1,30 @@
/*
htop - TasksMeter.c
(C) 2004-2011 Hisham H. Muhammad
-Released under the GNU GPL, see the COPYING file
+Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "TasksMeter.h"
-#include "Platform.h"
#include "CRT.h"
+#include "Macros.h"
+#include "Object.h"
+#include "ProcessList.h"
+#include "RichString.h"
+#include "Settings.h"
+#include "XUtils.h"
-int TasksMeter_attributes[] = {
- CPU_SYSTEM, PROCESS_THREAD, PROCESS, TASKS_RUNNING
+static const int TasksMeter_attributes[] = {
+ CPU_SYSTEM,
+ PROCESS_THREAD,
+ PROCESS,
+ TASKS_RUNNING
};
-static void TasksMeter_updateValues(Meter* this, char* buffer, int len) {
- ProcessList* pl = this->pl;
+static void TasksMeter_updateValues(Meter* this, char* buffer, size_t len) {
+ const ProcessList* pl = this->pl;
this->values[0] = pl->kernelThreads;
this->values[1] = pl->userlandThreads;
this->values[2] = pl->totalTasks - pl->kernelThreads - pl->userlandThreads;
@@ -24,15 +32,15 @@ static void TasksMeter_updateValues(Meter* this, char* buffer, int len) {
if (pl->totalTasks > this->total) {
this->total = pl->totalTasks;
}
- if (this->pl->settings->hideKernelThreads) {
+ if (pl->settings->hideKernelThreads) {
this->values[0] = 0;
}
xSnprintf(buffer, len, "%d/%d", (int) this->values[3], (int) this->total);
}
-static void TasksMeter_display(Object* cast, RichString* out) {
- Meter* this = (Meter*)cast;
- Settings* settings = this->pl->settings;
+static void TasksMeter_display(const Object* cast, RichString* out) {
+ const Meter* this = (const Meter*)cast;
+ const Settings* settings = this->pl->settings;
char buffer[20];
int processes = (int) this->values[2];
@@ -63,7 +71,7 @@ static void TasksMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[METER_TEXT], " running");
}
-MeterClass TasksMeter_class = {
+const MeterClass TasksMeter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,

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