Commit Graph

1584 Commits

Author SHA1 Message Date
Christian Göttsche 307c34b028 Hashtable: use dynamic growth and use primes as size
Dynamically increase the hashmap size to not exceed the load factor and
avoid too long chains.

Switch from Separate Chaining to Robin Hood linear probing to improve
cache locality.

Use primes as size to further avoid collisions.

E.g. on a standard kde system the number of entries in the ProcessTable
might be around 650.
2020-11-17 02:01:02 +01:00
Christian Göttsche 7914ec201e Hashtable update
- use consistent type for key by introducing a new typedef
- use unsigned types for sizes
- name parameters in foreach function typedef
2020-11-17 02:01:02 +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
Daniel Lange a8a723ffe9 Add debug state to the configure report (thanks @benbe for the idea) 2020-11-16 17:01:51 +01:00
Daniel Lange 309f1d7282 hwloc = (portable) HardWare LOCality, not related to lock 2020-11-16 13:29:37 +01:00
Daniel Lange 8bc083c6c6 Merge branch 'highlight-new-old-processes'
Thanks to @adsr for the great work
Closes #241, closes #74
Massive rebase, so #keepfingerscrossed
2020-11-16 13:19:31 +01:00
Daniel Lange 19868a3c29 Fix whitespace before comma in the new color definitions 2020-11-16 13:18:29 +01:00
Daniel Lange 8f2d129dce Apply patch from BenBE as per https://github.com/htop-dev/htop/pull/241#issuecomment-720081138 2020-11-16 12:55:32 +01:00
Daniel Lange 0951090fa4 Merge branch 'hili-new-old' of adsr/htop into highlight-new-old-processes 2020-11-16 12:55:07 +01:00
Christian Göttsche 0411fdbcef Use spaceship comparison for TTYs 2020-11-15 22:54:14 +01:00
Christian Göttsche f856fe6463 Early skip non-directories when searching for process information 2020-11-15 22:54:14 +01:00
Christian Göttsche ad72b747fa Drop hideThreads Setting
It is only used to read process directories on RedHat beginning with a dot.
Unconditionally accept directories with a starting dot.
2020-11-15 22:54:14 +01:00
Christian Göttsche 9f67b95308 Mark local functions static 2020-11-15 18:35:30 +01:00
Christian Göttsche 91317322fe Mark ProcessList_keyAt argument const 2020-11-15 18:35:30 +01:00
Christian Göttsche 42073babb9 Use uid_t type for Process_getuid 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
Christian Göttsche d785b1bbc3 Fixup of SystemdMeter merge 2020-11-15 17:53:31 +01:00
Daniel Lange f2b2735e07 Resolve merge conflicts, merge #229 "Add SystemdMeter" from @cgzones 2020-11-15 14:52:25 +01:00
Daniel Lange bb908f3dc4 Resolve merge conflicts, merge #298 "Macro cleanup" from @BenBE 2020-11-15 14:33:09 +01:00
Daniel Lange da2dcf9505 Remove duplicate test for NUL
Fixes #308, thanks @qarmin (Rafał Mikrut)
2020-11-15 14:16:23 +01:00
BenBE 9e976b899b
Merge pull request #239 from StoneBam/list-locks 2020-11-14 16:03:17 +01:00
Benny Baumann d431786fca Split data array for file lock information into separate fields 2020-11-14 15:51:26 +01:00
Benny Baumann 18763051a2 Split platform dependent parts for file locks screen 2020-11-14 15:51:26 +01:00
Benny Baumann 2d6da2e520 Add compat wrapper for readlinkat 2020-11-09 19:17:57 +01:00
Fynn Wulf 84dad4c38e Implement screen for active file locks 2020-11-09 19:17:57 +01:00
Benny Baumann e7b95feee4 Remove unnecessary braces 2020-11-02 22:15:01 +01:00
Benny Baumann 0e922d4085 Integrate NAN check into assignment
The check for NAN is kept to avoid relying on implementation details of the CLAMP macro/function
2020-11-02 22:15:01 +01:00
Benny Baumann cb8bb12974 Shorten initializer 2020-11-02 22:15:01 +01:00
Benny Baumann 1c060a9d6b Avoid RichString_beginAllocated being ammendable 2020-11-02 22:15:01 +01:00
Benny Baumann 0d64ca9262 Wrap inline structure definitions 2020-11-02 22:15:01 +01:00
Benny Baumann 45869513bf Embracing branches 2020-11-02 22:15:01 +01:00
Benny Baumann 61e14d4bb2 Spacing around operators 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 9a16b1079e Make scope of match macro symmetric 2020-11-02 22:15:01 +01:00
Benny Baumann 493217e814 Fix indentation to 3 spaces 2020-11-02 22:15:01 +01:00
Benny Baumann adf797c295 Spacing after keywords (for) 2020-11-02 22:15:01 +01:00
Benny Baumann 374edb9ed5 Spacing after keywords (if) 2020-11-02 22:14:59 +01:00
Benny Baumann 0a51eae11f Spacing after keywords (while) 2020-11-02 22:14:26 +01:00
Benny Baumann 1877325329 Spacing after keywords (#define) 2020-11-02 22:14:26 +01:00
Benny Baumann db0a13970e Convert addattrstr to static inline function
NB: The macro could have been a braced while(0) loop, which without optimization produces more code
2020-11-02 22:14:26 +01:00
Benny Baumann c790b6ae67 Remove accidental syntax collision 2020-11-02 22:14:26 +01:00
Benny Baumann 7ab0915a6c Remove unnecessary trailing semicolon on macros 2020-11-02 22:14:26 +01:00
Christian Göttsche 0806a7958b Assert Vector_get returns an object
It is generally assumed Vector_get returns a non-NULL object.
Use a generic assert in Vector_get instead of in callers.
2020-11-02 19:24:28 +01:00
Daniel Lange 742e610f1d Merge branch 'wrap' of cgzones/htop 2020-11-02 17:08:38 +01:00
Christian Göttsche 0c1908832b Handle data wraparounds in IO Meters
If the current data is smaller than the previous one, either by a retrieve error
or a device removal or a original data wraparound, sanitize the value to zero.

Fixes: #299
2020-11-02 14:46:42 +01:00
Adam Saponara a83f515f0f Address items from review 2020-10-31 20:36:53 -04:00
Christian Göttsche 15652e7b81 Enclose macro arguments in parentheses 2020-10-31 19:54:03 +01:00
Christian Göttsche 2a9e8ca074 Add SystemdMeter 2020-10-31 19:51:42 +01:00
Murloc Knight ab17ef4dc0 Zram Meter feature 2020-10-31 18:51:53 +01:00
Christian Göttsche 43d274a617 Use integer type for item count instead of char 2020-10-31 18:36:55 +01:00