Christian Göttsche
a63cfc8b7c
Refactor generating starttime string into Process class
5 years ago
Christian Göttsche
783be7711d
Do not use extra starttime process field on Linux
5 years ago
Christian Göttsche
25022c219d
Read CPU count every cycle to avoid issues when HT/SMT mode changes
5 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
d69585b82a
Resolve DEBUG compilation issues
...
Use NDEBUG conditional instead of DEBUG.
Do not call static functions in extern inline ones.
Vector.c:67:11: error: static function 'Vector_isConsistent' is used in an inline function with external linkage [-Werror,-Wstatic-in-inline]
6 years ago
Christian Göttsche
6f387008cb
Add security attribute process column
6 years ago
Christian Göttsche
7ae967a04b
Drop redundant return statements
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
Christian Göttsche
edf1b10d2c
Read CPU frequency from sysfs by default
...
Use the more portable sysfs node /sys/devices/system/cpu/cpuX/cpufreq/scaling_cur_freq
to get the CPU frequency.
In case of an error fall back to /proc/cpuinfo .
Also use a fixed width of 4 for the frequency to avoid position jumps
in case the frequency moves in the range 900-1100 MHz.
6 years ago
Christian Göttsche
594409f299
Add DeepCode inline suppression
...
commsize is bounded by the allocated length passed in by commLen, saved
into commLenIn
6 years ago
Benny Baumann
321960bd96
Update delay accounting to use NAN on error
6 years ago
Benny Baumann
3c65d78d77
Update CPU freq display to use NAN on error
6 years ago
Benny Baumann
d0d3deb73c
Properly query sysconf settting and use NAN if unavailable
...
This also fixes an issue with time returned negative if sysconf(_SC_CLK_TCK) returned an error.
6 years ago
Benny Baumann
29ec115143
Update IO rate display to use NAN on error
6 years ago
Christian Göttsche
f9966b5be3
Use checked allocation wrappers
6 years ago
Christian Göttsche
eb260af6bf
Fix memory leak on cgroup read failure
6 years ago
Christian Göttsche
00665e2a2b
Avoid unsigned integer overflow
...
unsigned overflow is well defined, but creates noise when using
sanitizers. unsigned overflow can be a symptom of logic issues of
counter, so its reasonable to use.
linux/LinuxProcessList.c:64:50: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:64:50 in
linux/LinuxProcessList.c:64:11: runtime error: implicit conversion from type 'unsigned int' of value 4294967295 (32-bit, unsigned) to type 'int' changed the value to -1 (32-bit, signed)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:64:11 in
linux/LinuxProcessList.c:64:78: runtime error: unsigned integer overflow: 4 - 136 cannot be represented in type 'unsigned int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:64:78 in
6 years ago
Christian Göttsche
98ee833932
Add Linux process column for context switches
...
Displays the incremental sum of voluntary_ctxt_switches and nonvoluntary_ctxt_switches.
6 years ago
Christian Göttsche
37921382f4
Use PROCDIR throughout instead of /proc on Linux
6 years ago
Christian Göttsche
b096fdbfc0
Avoid potential buffer overflow in LinuxProcessList_readStatFile
...
Pass size of allocated command buffer and limit write.
6 years ago
Nathan Scott
4597332959
Switch variable/field naming from WhiteList to MatchList
6 years ago
Nathan Scott
c5808c56db
Consolidate repeated macro definitions into one header
...
The MIN, MAX, CLAMP, MINIMUM, and MAXIMUM macros appear
throughout the codebase with many re-definitions. Make
a single copy of each in a common header file, and use
the BSD variants of MINIMUM/MAXIMUM due to conflicts in
the system <sys/param.h> headers.
6 years ago
Zev Weiss
a1a027b9bd
Axe automated header generation.
...
Reasoning:
- implementation was unsound -- broke down when I added a fairly
basic macro definition expanding to a struct initializer in a *.c
file.
- made it way too easy (e.g. via otherwise totally innocuous git
commands) to end up with timestamps such that it always ran
MakeHeader.py but never used its output, leading to overbuild noise
when running what should be a null 'make'.
- but mostly: it's just an awkward way of dealing with C code.
6 years ago
Christian Göttsche
5c99c6e942
Check btime sscanf parse from /proc/stat
...
Found by Coverity
6 years ago
Christian Göttsche
a850d81bf5
Avoid use of uninitialized variables
...
Found by Coverity
6 years ago
Christian Göttsche
05a5fdc47f
Ignore sscanf return value of /proc/stat
...
Found by Coverity
6 years ago
Christian Göttsche
af84d3dfa9
Fail on out-of-range CPU number
...
Found by Coverity
6 years ago
Christian Göttsche
d9a5dd4b91
Improve OOM output
...
* Fix sort by adding cast
* Shrink column size to 4
* Drop unnecessary maximum field width specifier in sscanf
6 years ago
Christian Göttsche
a48ce9d103
Really tell gcc to ignore return value of fscanf
6 years ago
Christian Göttsche
4e2b9f0965
Avoid shadowing warnings
6 years ago
Christian Göttsche
3856bf574b
Introduce xAsprintf as checked version of asprintf
6 years ago
Nathan Scott
eef6bc447d
Correction to smaps buffer size passed to smaps path snprintf
6 years ago
Jure Oder
88c9ebb8f7
Properly identify zombie processes
...
This closes issue #930 .
6 years ago
Daniel Flanagan
dd33444f7e
Clean up existing whitespace
6 years ago
Ross Williams
a267003f2f
Linux fixes
7 years ago
Ross Williams
613556faeb
Support for ZFS Compressed ARC statistics
7 years ago
Arnavion
81b64691a7
Move sysfs-reading code to LinuxProcessList.c and add average frequency.
...
This way the frequency is read from sysfs only once per update cycle
instead of every time the UI is redrawn.
This also changes the code to read from /proc/cpuinfo instead. This is because
reading from scaling_cur_freq stalls for 10ms if the previous read for the file
was more than one second ago. [1] Since htop's update cycle is
longer than that, it would cause the read of each CPU's scaling_cur_freq file
to block the UI for 20ms. This easily led to a noticeable half-second lag on
a 20+ CPU machine.
/proc/cpuinfo also has a 10ms delay, but this applies for the whole file
so the delay does not scale with the number of CPUs. [2]
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=4815d3c56d1e10449a44089a47544d9ba84fad0d
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7d5905dc14a87805a59f3c5bf70173aac2bb18f8
7 years ago
Ross Williams
a88d2e313d
Refactor common OpenZFS sysctl access
...
Darwin and FreeBSD export zfs kstats through the
same APIs, so moving functions into a common file.
7 years ago
Ross Williams
070fe90461
ZFS arcstats for Linux
...
If no pools are imported (ARC size == 0) or the
ZFS module is not in the kernel (/proc/spl/kstat/zfs/arcstats
does not exist), then the Meter reports "Unavailable".
7 years ago
Alexander Schlarb
078c2ddde5
Linux: Use /proc/*/smaps_rollup for improved PSS parsing speed
7 years ago
Alexander Schlarb
fc0bf546c3
Linux: Add PSS (proportional set size), Swap and SwapPSS calculation
...
Original code was written by *Craig M. Brandenburg* for htop 1.0.2
Many performance improvements by GitHub user *linvinus*, ported to htop 2.0.2
7 years ago
Hisham Muhammad
402e46bb82
Linting changes
...
as reported by lgtm.com
7 years ago
Wataru Ashihara
41754e5632
Remove unnecessary HAVE_SYS_SYSMACROS_H check
...
HAVE_SYS_SYSMACROS_H is always true if MAJOR_IN_SYSMACROS.
This way of checking is recommended in autoconf 2.70 documentation:
https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blobdiff;f=doc/autoconf.texi;h=4f041bd4e;hp=9ad7dc1c5f02c8ba25b2fe1218bf931c7113a5d5;hb=e17a30e987d7ee695fb4294a82d987ec3dc9b974;hpb=565a6dc50cfa01cec2fb4db894026689cdf4970c
NOTE: currently
https://www.gnu.org/software/autoconf/manual/autoconf.html is the
doc for autoconf 2.69.
7 years ago
Hisham Muhammad
bae27054e6
Linux: fix CPU count
8 years ago
Hisham Muhammad
8d01ae2054
Linux: remove warnings of unused variables
8 years ago
Shawn Landden
bd1d719a61
Linux: add process->starttime and use it for STARTTIME column ( #700 )
...
this way a remount of /proc will not reset starttimes
and we can also see startup times for processes started before the mount
of /proc
also record btime (boot time in seconds since epoch) as Linux semi-global
8 years ago
Score_Under
d74b6dc8e0
Fix process name updates for shorter strings ( #812 )
...
When a process name changes from a long string to a short string,
truncate instead of just overwriting the beginning.
8 years ago