aboutsummaryrefslogtreecommitdiffstats
path: root/pcp
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2022-05-02 16:04:21 +0200
committerDaniel Lange <DLange@git.local>2022-05-02 16:04:21 +0200
commit1b805a31720727008b32b1129a167758519fd4db (patch)
tree900c84e10a25f2c8eaeec3ae54f1365688ce02a4 /pcp
parenta6822e98434cf7da6fab033898094976d881ee0f (diff)
downloaddebian_htop-1b805a31720727008b32b1129a167758519fd4db.tar.gz
debian_htop-1b805a31720727008b32b1129a167758519fd4db.tar.bz2
debian_htop-1b805a31720727008b32b1129a167758519fd4db.zip
New upstream version 3.2.0upstream/3.2.0
Diffstat (limited to 'pcp')
-rw-r--r--pcp/PCPMetric.c2
-rw-r--r--pcp/PCPProcess.c4
-rw-r--r--pcp/PCPProcessList.c27
-rw-r--r--pcp/Platform.c15
-rw-r--r--pcp/Platform.h4
5 files changed, 32 insertions, 20 deletions
diff --git a/pcp/PCPMetric.c b/pcp/PCPMetric.c
index f6d4c97..606a5df 100644
--- a/pcp/PCPMetric.c
+++ b/pcp/PCPMetric.c
@@ -166,7 +166,7 @@ bool PCPMetric_fetch(struct timeval* timestamp) {
}
int sts, count = 0;
do {
- sts = pmFetch(pcp->totalMetrics, pcp->fetch, &pcp->result);
+ sts = pmFetch(pcp->totalMetrics, pcp->fetch, &pcp->result);
} while (sts == PM_ERR_IPC && ++count < 3);
if (sts < 0) {
if (pmDebugOptions.appl0)
diff --git a/pcp/PCPProcess.c b/pcp/PCPProcess.c
index e686d51..d0bcfbb 100644
--- a/pcp/PCPProcess.c
+++ b/pcp/PCPProcess.c
@@ -54,8 +54,8 @@ const ProcessFieldData Process_fields[] = {
[M_LRS] = { .name = "M_LRS", .title = " LIB ", .description = "The library size of the process (unused since Linux 2.6; always 0)", .flags = 0, .defaultSortDesc = true, },
[M_DT] = { .name = "M_DT", .title = " DIRTY ", .description = "Size of the dirty pages of the process (unused since Linux 2.6; always 0)", .flags = 0, .defaultSortDesc = true, },
[ST_UID] = { .name = "ST_UID", .title = "UID", .description = "User ID of the process owner", .flags = 0, },
- [PERCENT_CPU] = { .name = "PERCENT_CPU", .title = "CPU% ", .description = "Percentage of the CPU time the process used in the last sampling", .flags = 0, .defaultSortDesc = true, },
- [PERCENT_NORM_CPU] = { .name = "PERCENT_NORM_CPU", .title = "NCPU%", .description = "Normalized percentage of the CPU time the process used in the last sampling (normalized by cpu count)", .flags = 0, .defaultSortDesc = true, },
+ [PERCENT_CPU] = { .name = "PERCENT_CPU", .title = "CPU% ", .description = "Percentage of the CPU time the process used in the last sampling", .flags = 0, .defaultSortDesc = true, .autoWidth = true, },
+ [PERCENT_NORM_CPU] = { .name = "PERCENT_NORM_CPU", .title = "NCPU%", .description = "Normalized percentage of the CPU time the process used in the last sampling (normalized by cpu count)", .flags = 0, .defaultSortDesc = true, .autoWidth = true, },
[PERCENT_MEM] = { .name = "PERCENT_MEM", .title = "MEM% ", .description = "Percentage of the memory the process is using, based on resident memory size", .flags = 0, .defaultSortDesc = true, },
[USER] = { .name = "USER", .title = "USER ", .description = "Username of the process owner (or user ID if name cannot be determined)", .flags = 0, },
[TIME] = { .name = "TIME", .title = " TIME+ ", .description = "Total time the process has spent in user and system time", .flags = 0, .defaultSortDesc = true, },
diff --git a/pcp/PCPProcessList.c b/pcp/PCPProcessList.c
index cae097f..ca82575 100644
--- a/pcp/PCPProcessList.c
+++ b/pcp/PCPProcessList.c
@@ -384,12 +384,12 @@ static bool PCPProcessList_updateProcesses(PCPProcessList* this, double period,
continue;
}
- if (settings->flags & PROCESS_FLAG_IO)
+ if (settings->ss->flags & PROCESS_FLAG_IO)
PCPProcessList_updateIO(pp, pid, offset, now);
PCPProcessList_updateMemory(pp, pid, offset);
- if ((settings->flags & PROCESS_FLAG_LINUX_SMAPS) &&
+ if ((settings->ss->flags & PROCESS_FLAG_LINUX_SMAPS) &&
(Process_isKernelThread(proc) == false)) {
if (PCPMetric_enabled(PCP_PROC_SMAPS_PSS))
PCPProcessList_updateSmaps(pp, pid, offset);
@@ -408,6 +408,7 @@ static bool PCPProcessList_updateProcesses(PCPProcessList* this, double period,
proc->percent_cpu = isnan(percent_cpu) ?
0.0 : CLAMP(percent_cpu, 0.0, pl->activeCPUs * 100.0);
proc->percent_mem = proc->m_resident / (double)pl->totalMem * 100.0;
+ Process_updateCPUFieldWidths(proc->percent_cpu);
PCPProcessList_updateUsername(proc, pid, offset, pl->usersTable);
@@ -419,22 +420,22 @@ static bool PCPProcessList_updateProcesses(PCPProcessList* this, double period,
PCPProcessList_updateCmdline(proc, pid, offset, command);
}
- if (settings->flags & PROCESS_FLAG_LINUX_CGROUP)
+ if (settings->ss->flags & PROCESS_FLAG_LINUX_CGROUP)
PCPProcessList_readCGroups(pp, pid, offset);
- if (settings->flags & PROCESS_FLAG_LINUX_OOM)
+ if (settings->ss->flags & PROCESS_FLAG_LINUX_OOM)
PCPProcessList_readOomData(pp, pid, offset);
- if (settings->flags & PROCESS_FLAG_LINUX_CTXT)
+ if (settings->ss->flags & PROCESS_FLAG_LINUX_CTXT)
PCPProcessList_readCtxtData(pp, pid, offset);
- if (settings->flags & PROCESS_FLAG_LINUX_SECATTR)
+ if (settings->ss->flags & PROCESS_FLAG_LINUX_SECATTR)
PCPProcessList_readSecattrData(pp, pid, offset);
- if (settings->flags & PROCESS_FLAG_CWD)
+ if (settings->ss->flags & PROCESS_FLAG_CWD)
PCPProcessList_readCwd(pp, pid, offset);
- if (settings->flags & PROCESS_FLAG_LINUX_AUTOGROUP)
+ if (settings->ss->flags & PROCESS_FLAG_LINUX_AUTOGROUP)
PCPProcessList_readAutogroup(pp, pid, offset);
if (proc->state == ZOMBIE && !proc->cmdline && command[0]) {
@@ -676,16 +677,16 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
for (int metric = PCP_PROC_PID; metric < PCP_METRIC_COUNT; metric++)
PCPMetric_enable(metric, enabled);
- flagged = settings->flags & PROCESS_FLAG_LINUX_CGROUP;
+ flagged = settings->ss->flags & PROCESS_FLAG_LINUX_CGROUP;
PCPMetric_enable(PCP_PROC_CGROUPS, flagged && enabled);
- flagged = settings->flags & PROCESS_FLAG_LINUX_OOM;
+ flagged = settings->ss->flags & PROCESS_FLAG_LINUX_OOM;
PCPMetric_enable(PCP_PROC_OOMSCORE, flagged && enabled);
- flagged = settings->flags & PROCESS_FLAG_LINUX_CTXT;
+ flagged = settings->ss->flags & PROCESS_FLAG_LINUX_CTXT;
PCPMetric_enable(PCP_PROC_VCTXSW, flagged && enabled);
PCPMetric_enable(PCP_PROC_NVCTXSW, flagged && enabled);
- flagged = settings->flags & PROCESS_FLAG_LINUX_SECATTR;
+ flagged = settings->ss->flags & PROCESS_FLAG_LINUX_SECATTR;
PCPMetric_enable(PCP_PROC_LABELS, flagged && enabled);
- flagged = settings->flags & PROCESS_FLAG_LINUX_AUTOGROUP;
+ flagged = settings->ss->flags & PROCESS_FLAG_LINUX_AUTOGROUP;
PCPMetric_enable(PCP_PROC_AUTOGROUP_ID, flagged && enabled);
PCPMetric_enable(PCP_PROC_AUTOGROUP_NICE, flagged && enabled);
diff --git a/pcp/Platform.c b/pcp/Platform.c
index 150660a..b3d6ed4 100644
--- a/pcp/Platform.c
+++ b/pcp/Platform.c
@@ -54,9 +54,20 @@ in the source distribution for its full text.
Platform* pcp;
-ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_VIRT, M_RESIDENT, (int)M_SHARE, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
+const ScreenDefaults Platform_defaultScreens[] = {
+ {
+ .name = "Main",
+ .columns = "PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command",
+ .sortKey = "PERCENT_CPU",
+ },
+ {
+ .name = "I/O",
+ .columns = "PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE PERCENT_SWAP_DELAY PERCENT_IO_DELAY Command",
+ .sortKey = "IO_RATE",
+ },
+};
-int Platform_numberOfFields = LAST_PROCESSFIELD;
+const unsigned int Platform_numberOfDefaultScreens = ARRAYSIZE(Platform_defaultScreens);
const SignalItem Platform_signals[] = {
{ .name = " 0 Cancel", .number = 0 },
diff --git a/pcp/Platform.h b/pcp/Platform.h
index ad38cbb..dc51c73 100644
--- a/pcp/Platform.h
+++ b/pcp/Platform.h
@@ -58,9 +58,9 @@ typedef struct Platform_ {
unsigned int ncpu; /* maximum processor count configured */
} Platform;
-extern ProcessField Platform_defaultFields[];
+extern const ScreenDefaults Platform_defaultScreens[];
-extern int Platform_numberOfFields;
+extern const unsigned int Platform_numberOfDefaultScreens;
extern const SignalItem Platform_signals[];

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