Commit Graph

2454 Commits

Author SHA1 Message Date
Benny Baumann 9adb94a379 Some visual code cleanup 2020-12-03 22:41:31 +01:00
Benny Baumann 5fe2a88c08 Use common handling for scrolling 2020-12-03 22:41:31 +01:00
Benny Baumann a7955c4966 Reduce code duplication 2020-12-03 22:41:31 +01:00
Benny Baumann c49ca61dd9 Common order for ESC/q/F10 2020-12-03 22:41:31 +01:00
Christian Göttsche 4f08d2d5ad Fix sensors configure argument 2020-12-03 16:42:38 +01:00
Christian Göttsche 64230ee5cd ci: use clang-11 2020-12-03 16:28:14 +01:00
Christian Göttsche 2ec940e0d2 ci: use correct configure flags for sensors 2020-12-03 16:28:14 +01:00
Christian Göttsche d1db9da936 Linux: avoid float division by 0 after system sleep
linux/LinuxProcessList.c:1403:63: runtime error: division by zero
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:1403:63 in
2020-12-03 13:25:17 +01:00
Christian Göttsche 3695cbd5d8 Silence possible NULL dereference
Found by compiling with LTO

  ProcessList.c: In function ‘ProcessList_updateTreeSetLayer’:
  ProcessList.c:195:15: error: potential null pointer dereference [-Werror=null-dereference]
    195 |       if (proc->tree_depth == deep && proc->tree_left > left && proc->tree_right < right) {
        |               ^
  ProcessList.c:195:15: error: potential null pointer dereference [-Werror=null-dereference]
  ProcessList.c:195:15: error: potential null pointer dereference [-Werror=null-dereference]
2020-12-03 12:32:54 +01:00
Christian Göttsche fe84840314 Add Linux cwd process column 2020-12-03 09:21:28 +01:00
Benny Baumann c6b66a75ea Minor code streamlining 2020-12-02 23:50:05 +01:00
Benny Baumann 709821ff55 Some minor spelling issues 2020-12-02 23:50:05 +01:00
Benny Baumann 2d874177bc Avoid expensive build of tree when not using it 2020-12-02 23:50:05 +01:00
Benny Baumann bd24664fc2 Avoid useless search for pid 0 2020-12-02 23:50:05 +01:00
Benny Baumann d0e71cb75f Reorder field initialization to group fields by task 2020-12-02 23:50:05 +01:00
Benny Baumann e3b6049043 Code style cleanup and documentation/comments 2020-12-02 23:50:05 +01:00
Benny Baumann b4b952d78d Use common values for initial size estimates for Hashtables 2020-12-02 23:50:05 +01:00
Maxim Zhiburt 4907d90cff Fix issue with inconsistent displayTreeSet 2020-12-02 23:50:05 +01:00
Maxim Zhiburt cf306ff86e Implement sorting in tree mode 2020-12-02 23:50:05 +01:00
Christian Göttsche 4f7d48aa24 Set locale only once and do not override it later 2020-12-02 22:08:25 +01:00
Christian Göttsche b76eaf187a Dynamically load libsensors at runtime 2020-12-02 21:03:24 +01:00
Christian Göttsche f7a8952933 Add xReadfile wrapper for reading small to medium size files
Inspired by proposed Linux syscall

Avoid file descriptor leaks like 4af8c63f
2020-12-02 20:39:36 +01:00
Christian Göttsche 1d8192c10b PressureStallMeter: improve display strings
- Shorten name for header setup menu
- Improve caption in bar mode
2020-12-02 19:51:43 +01:00
Christian Göttsche 472f0124cd Meter: document MeterClass string fields 2020-12-02 19:51:43 +01:00
Christian Göttsche c0b50164dd Use String_eq for readability and consistency 2020-12-02 19:14:22 +01:00
Christian Göttsche 7975cd2ca3 Add cast to unsigned char to avoid signed char misuse 2020-12-02 19:14:22 +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 ec0f5d0ba9 Compare indices not index with pair
Fixes always true condition.

Found by LGTM.com
2020-12-02 17:54:53 +01:00
Christian Göttsche bbac4c2a62 Use enum element name instead of magic number 2020-12-02 17:52:16 +01:00
Nathan Scott 65866c69d6 Fix a little typo (spelling) in the styleguide 2020-12-01 14:15:16 +11:00
Nathan Scott f59af39684 Merge branch 'styleguide-tweak' of https://github.com/natoscott/htop into natoscott-styleguide-tweak 2020-12-01 14:11:19 +11:00
Nathan Scott 6ab1e468ef
Update docs/styleguide.md
Co-authored-by: BenBE <BenBE@geshi.org>
2020-12-01 14:05:46 +11:00
Christian Göttsche cd305b4325 Print G in gigabyte color
When printing a size like 27.2G print the G like the 27 in the gigabyte color.
2020-11-29 15:06:08 +01:00
Benny Baumann c1563337ae Implement Hashtable_clear to empty an existing Hashtable 2020-11-29 14:54:10 +01:00
Christian Göttsche 9549ca8c88 Linux: fix process parsing for hidden pid directories 2020-11-29 12:46:25 +01:00
Nathan Scott b2a8b2426e Tweak style guide wording around single code statements
There was wording about brace-enclosing single code statements
being 'strongly encouraged' - this isn't consistently used and
IMO it introduces unnecessary noise in otherwise neat, concise
code.

I've reworded (dropped) this section and also fixed a handful
of minor typos while reading this doc a little more carefully.
2020-11-28 23:47:13 +01:00
Christian Göttsche 5ee6875f73 Typo 2020-11-28 20:53:49 +01:00
Benny Baumann a7cf6c67d6 Typo fix in docs 2020-11-28 20:47:36 +01:00
Benny Baumann 0380d0bfd5 Include documentation for COMM and EXE 2020-11-28 20:23:33 +01:00
Christian Göttsche 19b5141685 Hide process selection on ESC
Do not highlight the current process line after pressing ESC in the main
screen.
Restore after pressing any key.
2020-11-28 19:49:38 +01:00
Christian Göttsche ea4f33409a Update even more snprintfs
Use size of actual buffers instead of magic numbers
2020-11-28 19:33:07 +01:00
Daniel Lange 7899ae2eb1 Replace more snprintfs, reduce buffer sizes to what is printed 2020-11-28 17:57:51 +01:00
Benny Baumann 0b29e5074c Use 'N/A' instead of 'no perm' for more consistency 2020-11-28 17:43:08 +01:00
Daniel Lange 6c306315c8 Fix reading of device nodes > 2 chars from memory maps 2020-11-28 17:06:06 +01:00
Christian Göttsche a41e5c0a80 configure: do not check functions we are using unconditionally 2020-11-28 12:35:34 +01:00
Christian Göttsche 2ff2859c23 Add compat mode for systems without openat(2) 2020-11-28 12:35:34 +01:00
Christian Göttsche 638207a2ff LinuxProcessList: use openat instead of building path strings
openat() is available since Linux 2.6.16
2020-11-28 12:35:34 +01:00
Nathan Scott f704baeb82 Drop unused global ProcessList memory fields
The global ProcessList structure contains a couple of unused
fields.  'sharedMem' has never been used by any Meter, since
its not been anything other than zero in Linux /proc/meminfo
for many, many years.  The freeMem field is only used in the
usedMem calculation, so it can reside on the stack like some
other memory variables used within-calculations-only and not
exposed to the user via a Meter.
2020-11-27 07:55:58 +01:00
Nathan Scott fee217551c Drop unneeded parameters to the ScreenManager constructor
All calls to ScreenManager_new always pass the same first
five values, the orientation is always HORIZONTAL and the
y1 parameter is always the height of the passed-in header
struct pointer.  I think its safe to assert at this point
that no VERTICAL orientation will arrive (if it does, its
no harm in re-adding this then) - so we can remove unused
conditionals (and TODOs) based on orientation too.
2020-11-26 23:55:53 +01:00