Christian Göttsche
0cb257586a
Move macro definitions close to usage
5 years ago
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
5 years ago
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.
5 years ago
Benny Baumann
f6613db5cd
Additional code simplification
...
Additional correction for #375
5 years ago
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.
5 years ago
Christian Göttsche
77ec86aff4
Use size_t as type for buffer length in Process
5 years ago
Christian Göttsche
7ba25aa3c4
IWYU update
5 years ago
Christian Göttsche
fe84840314
Add Linux cwd process column
5 years ago
Christian Göttsche
9029cc83ad
Merge identical conditional branches
5 years ago
Christian Göttsche
43ee295c23
Drop redundant return statements
5 years ago
Christian Göttsche
5ee6875f73
Typo
5 years ago
Benny Baumann
0b29e5074c
Use 'N/A' instead of 'no perm' for more consistency
5 years ago
Benny Baumann
08d6e25301
Distinguish display of no permissions for reading M_LRS
5 years ago
Fynn Wulf
7f18b352b0
Calculate library size (M_LRS column) from maps file
5 years ago
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.
5 years ago
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.
5 years ago
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
5 years ago
Benny Baumann
46ee28e897
Refactor command string creation
...
Hopefully this patch makes it a bit more approachable how it's done.
5 years ago
Benny Baumann
27b36dab1a
Make kernel thread display for COMM/EXE columns less visible and more consistent
5 years ago
Benny Baumann
f0a232568f
Reduce visual noise to when comm and cmdline actually disagree on the program basename
5 years ago
Narendran Gopalakrishnan
dde2af1fdb
Assume full basename matches COMM when matching full COMM buffer
5 years ago
Narendran Gopalakrishnan
be60419630
Cleanup some documentation
5 years ago
Narendran Gopalakrishnan
09fe94da18
Improving Command display/sort
5 years ago
Christian Göttsche
fa002c0ba9
Rename virtual memory column from M_SIZE to M_VIRT
...
Closes : #325
5 years ago
Christian Göttsche
3e5cba91ce
LinuxProcess: mark LinuxProcess_printDelay static
5 years ago
Christian Göttsche
7cf5277594
IWYU update (Linux)
5 years ago
Christian Göttsche
15eab2012d
Add process column for normalized CPU usage
...
Shows the process CPU usage divided by the number of CPU cores
5 years ago
Christian Göttsche
9f67b95308
Mark local functions static
5 years ago
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
5 years ago
Benny Baumann
45869513bf
Embracing branches
5 years ago
Benny Baumann
b23f8235e2
Whitespace and indentation issues
5 years ago
Benny Baumann
374edb9ed5
Spacing after keywords (if)
5 years ago
Christian Göttsche
d33b2be2ca
Implement LinuxProcess_effectiveIOPriority as function
...
Make it more readable and fix unenclosed macro arguments
5 years ago
Christian Göttsche
ac2b07eddd
Avoid some unnecessary casts and mark some not changing variables const
5 years ago
Christian Göttsche
4eb443926f
Hold only a const version of Settings in Process
5 years ago
Christian Göttsche
7109172431
Mark process parameter of Process_writeField consistently const
5 years ago
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.
5 years ago
Benny Baumann
0f5262917f
Make all required includes explicit
...
Information as seen by IWYU 0.12 + clang 9 on Linux
5 years ago
Benny Baumann
872e542f4e
Rename StringUtils.[ch] to XUtils.[ch]
5 years ago
Benny Baumann
c6f04a9c5d
Move xAsprintf, xSnprintf and xStrdup to StringUtils.h
5 years ago
Christian Göttsche
783be7711d
Do not use extra starttime process field on Linux
5 years ago
Christian Göttsche
7af06659e2
Mark remaining classes const
5 years ago
Christian Göttsche
41eea8a355
Mark process argument of Process_isThread const
6 years ago
Benny Baumann
2970cae543
Handle parsing envID & VPid from process status file
...
Fixes #55
Fixes #192
6 years ago
Christian Göttsche
954d6c12f5
Simplify statm parsing and document unused fields
6 years ago
Daniel Lange
079c2abf8e
Update License consistently to GPLv2 as per COPYING file
6 years ago
Christian Göttsche
6f387008cb
Add security attribute process column
6 years ago
Christian Göttsche
843949131a
Drop redundant casts to the same type
6 years ago
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);
^
6 years ago
Benny Baumann
321960bd96
Update delay accounting to use NAN on error
6 years ago