Christian Göttsche
0cb257586a
Move macro definitions close to usage
2020-12-16 19:13:56 +01:00
Nathan Scott
a3db2da4a7
Cleanup initialization of jiffies on the Linux platform
...
Small cleanups - add error handling, remove a local static
variable and refactor LinuxProcess_adjustTime (also rename
it, as its in LinuxProcessList.c not LinuxProcess.c) - and
while there, move the related 'btime' global variable into
LinuxProcessList.c so it can be made static.
Resolves https://github.com/htop-dev/htop/issues/384
2020-12-14 11:56:13 +11:00
Nathan Scott
75e9f9a8d9
Cull the definitions of pageSize and pageSizeKB from CRT.c
...
By storing the per-process m_resident and m_virt values in the form
htop wants to display them in (KB, not pages), we no longer need to
have definitions of pageSize and pageSizeKB in the common CRT code.
These variables were never really CRT (i.e. display) related in the
first place. It turns out the darwin platform code doesn't need to
use these at all (the process values are extracted from the kernel
in bytes not pages) and the other platforms can each use their own
local pagesize variables, in more appropriate locations.
Some platforms were actually already doing this, so this change is
removing duplication of logic and variables there.
2020-12-10 11:57:48 +11:00
Benny Baumann
f6613db5cd
Additional code simplification
...
Additional correction for #375
2020-12-08 21:24:19 +01:00
Christian Göttsche
157086e750
Split RichString_(append|appendn|write) into wide and ascii
...
RichString_writeFrom takes a top spot during performance analysis due to the
calls to mbstowcs() and iswprint().
Most of the time we know in advance that we are only going to print regular
ASCII characters.
2020-12-08 20:58:40 +01:00
Christian Göttsche
77ec86aff4
Use size_t as type for buffer length in Process
2020-12-06 16:03:44 +01:00
Christian Göttsche
7ba25aa3c4
IWYU update
2020-12-06 15:32:16 +01:00
Christian Göttsche
fe84840314
Add Linux cwd process column
2020-12-03 09:21:28 +01:00
Christian Göttsche
9029cc83ad
Merge identical conditional branches
2020-12-02 19:14:22 +01:00
Christian Göttsche
43ee295c23
Drop redundant return statements
2020-12-02 19:14:22 +01:00
Christian Göttsche
5ee6875f73
Typo
2020-11-28 20:53:49 +01:00
Benny Baumann
0b29e5074c
Use 'N/A' instead of 'no perm' for more consistency
2020-11-28 17:43:08 +01:00
Benny Baumann
08d6e25301
Distinguish display of no permissions for reading M_LRS
2020-11-26 22:58:34 +01:00
Fynn Wulf
7f18b352b0
Calculate library size (M_LRS column) from maps file
2020-11-26 22:58:34 +01:00
Christian Göttsche
9b31ee5b63
Drop taskstats conditional
...
taskstats is only checked on runtime if the column RCHAR, WCHAR, SYSCR,
SYSCW, RBYTES, WBYTES, CNCLWB, IO_READ_RATE, IO_WRITE_RATE or IO_RATE is
selected.
taskstats is currently enabled by default.
Drop the taskstats configuration switch, to reduce the maintenance cost.
2020-11-25 20:49:39 +01:00
Christian Göttsche
c88c80e3bd
Drop cgroup conditional
...
cgroup is only checked on runtime if the column CGROUP is selected.
cgroup is currently disabled by default, but most distributions do
enable it.
Drop the cgroup configuration switch, to reduce the maintenance cost.
2020-11-25 20:49:39 +01:00
Benny Baumann
21e3063e2e
Include comm before cmdline if exe could not be read, but comm mismatches basename from cmdline
...
Also highlights entries where exe was marked deleted
2020-11-24 19:05:48 +01:00
Benny Baumann
46ee28e897
Refactor command string creation
...
Hopefully this patch makes it a bit more approachable how it's done.
2020-11-24 19:05:48 +01:00
Benny Baumann
27b36dab1a
Make kernel thread display for COMM/EXE columns less visible and more consistent
2020-11-24 19:05:48 +01:00
Benny Baumann
f0a232568f
Reduce visual noise to when comm and cmdline actually disagree on the program basename
2020-11-24 19:05:48 +01:00
Narendran Gopalakrishnan
dde2af1fdb
Assume full basename matches COMM when matching full COMM buffer
2020-11-24 19:05:48 +01:00
Narendran Gopalakrishnan
be60419630
Cleanup some documentation
2020-11-24 19:05:48 +01:00
Narendran Gopalakrishnan
09fe94da18
Improving Command display/sort
2020-11-24 19:05:48 +01:00
Christian Göttsche
fa002c0ba9
Rename virtual memory column from M_SIZE to M_VIRT
...
Closes : #325
2020-11-21 19:39:45 +01:00
Christian Göttsche
3e5cba91ce
LinuxProcess: mark LinuxProcess_printDelay static
2020-11-21 19:26:55 +01:00
Christian Göttsche
7cf5277594
IWYU update (Linux)
2020-11-19 23:51:50 +01:00
Christian Göttsche
15eab2012d
Add process column for normalized CPU usage
...
Shows the process CPU usage divided by the number of CPU cores
2020-11-16 18:14:06 +01:00
Christian Göttsche
9f67b95308
Mark local functions static
2020-11-15 18:35:30 +01:00
Christian Göttsche
397b5c4bd0
Introduce spaceship comparison for Processes
...
If currently two unsigned values are compared via `a - b`, in the case b
is actually bigger than a, the result will not be an negative number (as
-1 is expected) but a huge positive number as the subtraction is an
unsigned subtraction.
Avoid over-/underflow affected operations; use comparisons.
Modern compilers will generate sane code, like:
xor eax, eax
cmp rdi, rsi
seta al
sbb eax, 0
ret
2020-11-15 18:25:21 +01:00
Benny Baumann
45869513bf
Embracing branches
2020-11-02 22:15:01 +01:00
Benny Baumann
b23f8235e2
Whitespace and indentation issues
2020-11-02 22:15:01 +01:00
Benny Baumann
374edb9ed5
Spacing after keywords (if)
2020-11-02 22:14:59 +01:00
Christian Göttsche
d33b2be2ca
Implement LinuxProcess_effectiveIOPriority as function
...
Make it more readable and fix unenclosed macro arguments
2020-10-28 19:57:10 +01:00
Christian Göttsche
ac2b07eddd
Avoid some unnecessary casts and mark some not changing variables const
2020-10-27 18:00:43 +01:00
Christian Göttsche
4eb443926f
Hold only a const version of Settings in Process
2020-10-26 19:30:38 +01:00
Christian Göttsche
7109172431
Mark process parameter of Process_writeField consistently const
2020-10-26 19:30:38 +01:00
Christian Göttsche
361877454f
Cache PAGE_SIZE
...
man:sysconf(3) states:
The values obtained from these functions are system configuration constants.
They do not change during the lifetime of a process.
2020-10-19 14:42:35 +02:00
Benny Baumann
0f5262917f
Make all required includes explicit
...
Information as seen by IWYU 0.12 + clang 9 on Linux
2020-10-18 20:09:05 +02:00
Benny Baumann
872e542f4e
Rename StringUtils.[ch] to XUtils.[ch]
2020-10-16 20:30:21 +02:00
Benny Baumann
c6f04a9c5d
Move xAsprintf, xSnprintf and xStrdup to StringUtils.h
2020-10-16 20:29:45 +02:00
Christian Göttsche
783be7711d
Do not use extra starttime process field on Linux
2020-10-16 19:23:40 +02:00
Christian Göttsche
7af06659e2
Mark remaining classes const
2020-10-13 14:56:01 +02:00
Christian Göttsche
41eea8a355
Mark process argument of Process_isThread const
2020-10-09 10:18:40 +02:00
Benny Baumann
2970cae543
Handle parsing envID & VPid from process status file
...
Fixes #55
Fixes #192
2020-10-07 13:14:39 +02:00
Christian Göttsche
954d6c12f5
Simplify statm parsing and document unused fields
2020-10-06 18:59:02 +02:00
Daniel Lange
079c2abf8e
Update License consistently to GPLv2 as per COPYING file
2020-10-05 10:13:12 +02:00
Christian Göttsche
6f387008cb
Add security attribute process column
2020-10-03 18:51:17 +02:00
Christian Göttsche
843949131a
Drop redundant casts to the same type
2020-09-29 10:44:42 +02:00
Christian Göttsche
18b1e9fba9
Do not drop qualifier in cast
...
ListItem.c:73:33: warning: cast from 'const void *' to 'struct ListItem_ *' drops const qualifier [-Wcast-qual]
ListItem* obj1 = (ListItem*) cast1;
^
ListItem.c:74:33: warning: cast from 'const void *' to 'struct ListItem_ *' drops const qualifier [-Wcast-qual]
ListItem* obj2 = (ListItem*) cast2;
^
Process.c:434:28: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
Process* p1 = (Process*)v1;
^
Process.c:435:28: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
Process* p2 = (Process*)v2;
^
Process.c:441:36: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
Settings *settings = ((Process*)v1)->settings;
^
Process.c:443:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
p1 = (Process*)v1;
^
Process.c:444:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
p2 = (Process*)v2;
^
Process.c:446:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
p2 = (Process*)v1;
^
Process.c:447:22: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
p1 = (Process*)v2;
^
AffinityPanel.c:37:16: warning: cast from 'const char *' to 'void *' drops const qualifier [-Wcast-qual]
free((void*)this->text);
^
AffinityPanel.c:39:19: warning: cast from 'const char *' to 'void *' drops const qualifier [-Wcast-qual]
free((void*)this->indent);
^
linux/LinuxProcess.c:294:36: warning: cast from 'const void *' to 'struct Process_ *' drops const qualifier [-Wcast-qual]
Settings *settings = ((Process*)v1)->settings;
^
linux/LinuxProcess.c:296:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual]
p1 = (LinuxProcess*)v1;
^
linux/LinuxProcess.c:297:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual]
p2 = (LinuxProcess*)v2;
^
linux/LinuxProcess.c:299:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual]
p2 = (LinuxProcess*)v1;
^
linux/LinuxProcess.c:300:27: warning: cast from 'const void *' to 'struct LinuxProcess_ *' drops const qualifier [-Wcast-qual]
p1 = (LinuxProcess*)v2;
^
linux/LinuxProcessList.c:62:32: warning: cast from 'const void *' to 'struct TtyDriver_ *' drops const qualifier [-Wcast-qual]
TtyDriver* a = (TtyDriver*) va;
^
linux/LinuxProcessList.c:63:32: warning: cast from 'const void *' to 'struct TtyDriver_ *' drops const qualifier [-Wcast-qual]
TtyDriver* b = (TtyDriver*) vb;
^
linux/Battery.c:130:21: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
free((char *) isOnline);
^
linux/Battery.c:197:26: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/type", entryName);
^
linux/Battery.c:209:29: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/uevent", entryName);
^
linux/Battery.c:262:29: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/online", entryName);
^
2020-09-24 20:14:17 +02:00
Benny Baumann
321960bd96
Update delay accounting to use NAN on error
2020-09-24 18:06:36 +02:00