Commit Graph

210 Commits

Author SHA1 Message Date
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 7ba25aa3c4 IWYU update 2020-12-06 15:32:16 +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
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
Narendran Gopalakrishnan e33d4d9460 Include merge status with column title when enabled 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 4fb82e301d fix indent 2020-11-21 19:26:42 +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 91317322fe Mark ProcessList_keyAt argument const 2020-11-15 18:35:30 +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
Adam Saponara a83f515f0f Address items from review 2020-10-31 20:36:53 -04:00
Adam Saponara dde71c6637 Highlight new and old processes (#74) 2020-10-30 21:56:16 -04:00
Christian Göttsche a3bb7cbe64 Hold only a const version of Settings in ProcessList 2020-10-26 19:30:38 +01:00
Christian Göttsche 96e2a4259e Continue to update generic data in paused mode
Generic data, as CPU and memory usage, are used by Meters.
In paused mode they would stop receiving updates and especially Graph
Meters would stop showing continuous data.

Improves: #214
Closes: #253
2020-10-19 14:45:39 +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
Christian Göttsche e9246abff8 Misc Vector updates
- Move swap() macro to source file and implement as function
- Implement Vector_get() and Vector_size() as inline functions
  to make them type safe and avoid lhs usage
- Comment comparison statistics, they are only needed for performance
  testing
2020-10-16 19:47:34 +02:00
Christian Göttsche 08d85e6143 Mark Object classes and Object class fields const 2020-10-07 13:01:53 +02:00
Daniel Lange 079c2abf8e Update License consistently to GPLv2 as per COPYING file 2020-10-05 10:13:12 +02:00
Nathan Scott 4597332959 Switch variable/field naming from WhiteList to MatchList 2020-09-09 19:38:15 +10:00
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.
2020-09-03 11:58:58 -05:00
Nathan Scott 728b04bbb5 Merge branch 'ci-hwloc-job' of https://github.com/bertwesarg/htop into bertwesarg-ci-hwloc-job 2020-08-26 10:39:43 +10:00
Daniel Flanagan dd33444f7e Clean up existing whitespace 2019-10-31 11:39:12 -05:00
Hisham Muhammad 0dbedf95a8 Collapse current subtree pressing Backspace 2018-04-05 19:38:13 -03:00
Wataru Ashihara b34d76cd41 Fix: infinite loop in tree view on macOS
Fixes #688, the bug regressed on 584a9bc.

On Mac OS X 10.11.6, all processes have their parents since there's a
special process named "kernel_task", whose PID and PPID are 0. As a
result, `this->processes` is never changed causing infinite `while`.
2018-02-04 16:51:06 +01:00
Hisham Muhammad e3f65c8ec2 Make 'c' key work with threads as well. 2017-09-14 17:10:39 -03:00
Hisham Muhammad b9934ffa08 minor style tweak 2017-09-04 13:53:03 -03:00
wangqr 584a9bceab Find roots when constructing process tree, fix #587 2017-09-01 21:34:05 +08:00
Hisham 84a69b1ea4 Release resource when using hwloc 2016-02-29 21:57:27 -03:00
Hisham Muhammad c18309466d Pre-reset 'show' for process.
This simplifies the protocol between the platform-independent
and platform-specific parts. The platform-specific parts
were supposed to re-determine the value of process->show
on each iteration, and the Darwin subsystem wasn't doing that.
Instead of adding the code to the Darwin part, I lifted the
burden of the OS-specific of resetting process->show: now
they can choose to hide a process if they want to (e.g.
detecting kernel threads) but are not required to
(e.g. on Darwin where we're not listing threads separately (yet?)).
Fixes tree view collapsing/expanding on OSX. Closes #416.
2016-02-18 14:32:49 -02:00
Hisham 474d26cea8 Portable affinity using hwloc 2016-02-14 19:57:29 -02:00
Hisham Muhammad 0507cd38f7 Merge pull request #43 from ErkiDerLoony/master
Fix tree view if userland threads are hidden.
2015-08-20 02:15:04 -03:00
Hisham Muhammad ea18a50091 Merge pull request #134 from jeffgarrett/pid-selection
Interpret command line PIDs as PIDs, not TIDs
2015-08-20 01:20:21 -03:00
David Hunt 5e602f18d5 Rename String to StringUtils.
Fixes building on case-insensitive filesystems where String.h gets confused with <string.h>.

From d734dacea0a10d0465dad4e95b3421511e7da112 Mon Sep 17 00:00:00 2001
From: David Hunt <dhunt@iolanthe.attlocal.net>
Date: Sat, 11 Jul 2015 20:56:31 -0500
Subject: [PATCH 1/8] Rename String to StringUtils
2015-08-19 13:45:20 -03:00
Hisham Muhammad b291fba02b Fixes to use platform-specific compare routines. 2015-04-09 15:40:46 -03:00
Hisham Muhammad b1f934c5d5 Visual tweaks: change color when following, add Broken Gray theme. 2015-04-09 15:17:20 -03:00
Hisham Muhammad d880def0e9 Merge branch 'master' into wip
Conflicts:
	Process.c
	Process.h
	htop.c
	linux/LinuxProcess.c
	linux/LinuxProcess.h
	test_spec.lua
2015-04-02 01:57:37 -03:00
Hisham Muhammad 272e2d9b34 Major advances in FreeBSD port. 2015-03-16 23:02:03 -03:00
Hisham Muhammad adbfe3c3f1 Get FreeBSD tree to compile again with latest changes. 2015-03-16 03:14:20 -03:00
Hisham Muhammad e3fe3962cb Move more Linux-specific code into Linux subdir. 2015-03-15 20:29:13 -03:00
Hisham Muhammad 6f868b00c0 Fix allocation of processes. Closes #166. 2015-02-20 14:52:10 -02:00
Hisham Muhammad 3383d8e556 Sorry about the mega-patch.
This is a work-in-progress, code is currently broken.
(Some actions, and notably, the header, are missing.)
2015-01-21 23:27:31 -02:00
Hisham Muhammad cda6bdd56b Add ProcessList_delete to the variable interface. 2014-11-27 17:48:38 -02:00
Hisham Muhammad aaaaf063a1 Builds on Linux again! 2014-11-24 19:22:50 -02:00
Hisham Muhammad eb229d9aef Changes for supporting separate platform subdirectories. 2014-11-24 18:55:03 -02:00
Hisham Muhammad 9faf4938b8 Refactored key handlers.
Made the logic more modular, hopefully easier to follow,
and removed repeated code.
Plus, some optimization in RichString code.
2014-11-19 23:17:52 -02:00
Jeff Garrett ab0bceb550 Interpret command line PIDs as PIDs, not TIDs 2014-10-08 11:52:56 -05:00
yar 730ab0c9a8 pass processlist flags to readOpenVZData (fixes build error) 2014-05-04 09:43:45 -07:00
Hisham Muhammad f54a37b4a9 Update values for fields whose columns may appear later. Fixes #80. 2014-05-03 17:51:19 -03:00
Hisham Muhammad e0209da88f Support pagefaults stats. Closes #45. 2014-04-24 19:40:47 -03:00
Hisham Muhammad 34b89a9747 Add sanity checks. 2014-04-24 12:15:56 -03:00
Hisham Muhammad 28d4cad5fe xread may return -1. 2014-04-22 18:48:27 -03:00
Hisham Muhammad f677843288 Restrict size of inputs on sscanf reads. 2014-04-21 19:17:57 -03:00
Hisham Muhammad 3fbd1ef76d check return of topoErr 2014-04-21 19:17:46 -03:00
Hisham Muhammad 5b30280810 shorten scope of variables. 2014-04-21 19:00:35 -03:00
Hisham Muhammad 4027e5ee44 goto considered harmful and confuses cppcheck. 2014-04-21 18:55:58 -03:00
Hisham Muhammad 99bc23771f Fix resource leak detected by cppcheck 2014-04-21 18:23:21 -03:00
Hisham Muhammad 4716a9857b Fix logic for skipping non-numeric directories.
Closes #42.
2014-04-11 20:17:07 -03:00
Edgar Kalkowski c8be3701b8 Fix tree view if userland threads are hidden. 2014-04-11 13:45:24 +02:00
Hisham Muhammad cb297af848 Fix invalid access when highlighting basename of threads. 2014-04-09 17:43:54 -03:00
Hisham Muhammad f2a190b0e9 New logic for highlighting basenames with spaces 2014-02-27 17:11:23 -03:00
Hisham Muhammad 6d90e58c01 alignment improvements 2014-02-27 16:35:22 -03:00
Leigh Simpson da236ca318 Added additional column to monitor OOM killer score of each process 2014-01-29 22:41:55 +00:00
Hisham Muhammad 76a715ee8c Fix order of calloc arguments.
(Patch by Dawid Gajownik)
2014-01-16 18:51:16 -02:00
Hisham Muhammad 8ace29c267 Make CPU meter optionally account guest time in its percentages 2013-12-18 02:58:34 +00:00
Hisham Muhammad af285d1d3b Fixes in accounting of guest time when using virtualization
(thanks to Patrick Marlier)
2013-12-18 02:20:39 +00:00
Hisham Muhammad 6cfa9e0bf2 Performance improvements due to conditional parsing of IO data depending on selected fields.
On my machine, this gives a ~20% improvement in htop process time use with the default config.
2013-05-24 22:46:01 +00:00
Hisham Muhammad 322ba274ea Performance improvements
(thanks to Jann Horn)
2013-04-29 23:00:15 +00:00
Hisham Muhammad 00b324bfc1 Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers. 2012-12-05 15:12:20 +00:00
Hisham Muhammad 2a73405cd0 search and filter for the strace and lsof screens! 2012-11-10 00:31:37 +00:00
Hisham Muhammad f44a8f2009 Option to update process names on every refresh
(thanks to Rob Hoelz)
2012-10-20 00:43:25 +00:00
Hisham Muhammad 1b21827f1f Fail gracefully when /proc is not mounted
(thanks to Philipp Hagemeister)
2012-10-19 18:59:48 +00:00
Hisham Muhammad 47e881f460 Add IO priority support ('i' key) 2012-10-04 23:59:45 +00:00
Hisham Muhammad e6c6d7fbf7 Add -p flag, contributed by Rob Hoelz 2012-08-10 21:54:41 +00:00
Hisham Muhammad 90d567531a Fix CPU percentage. Patch 3522180 for bug 3516978, by Richard. 2012-05-28 00:47:05 +00:00
Hisham Muhammad 05a78c8111 Auto-follow process when selecting which signal to use when killing a process.
This avoids killing the wrong process.
2012-03-30 01:20:32 +00:00
Hisham Muhammad 1a604a05a5 BUGFIX: behavior of 'F' (follow) key was broken, also affecting the
persistence of mouse selections. Closes #3165065.
2012-02-02 23:45:40 +00:00
Hisham Muhammad 45f7a4fc8d Remove old memory debugging routines. We have Valgrind nowadays. 2011-12-26 22:04:29 +00:00
Hisham Muhammad 84281bdc44 major header cleanup 2011-12-26 21:35:57 +00:00
Hisham Muhammad 81e44312b4 Use strdup explicitly 2011-12-25 20:23:53 +00:00
Hisham Muhammad bfd86a60cc Keep panel structure up-to-date as process list changes when headers are updated during the screen manager. Hopefully closes #3444533. 2011-12-01 12:31:57 +00:00
Hisham Muhammad bc87a8ff8c Remove bundled hwloc-1.2.1. Use either native Linux affinity support or an external libhwloc.
(for details see https://sourceforge.net/mailarchive/forum.php?thread_name=CAJpkDYeZpwqcWxZ77wq6bMrnhn-KzkU1xAqb3cU0drfnA3n9FQ%40mail.gmail.com&forum_name=htop-general )
2011-11-21 02:52:41 +00:00
Hisham Muhammad 7ca1081712 Mega-commit with features and tweaks for 1.0:
* Performance improvements
* Support for splitting CPU meters into two or four columns
  (thanks to Wim Heirman)
* Switch from PLPA, which is now deprecated, to HWLOC.
* Bring back support for native Linux sched_setaffinity,
  so we don't have to use HWLOC where we don't need to.
* Support for typing in user names and column fields in selection panels.
2011-11-18 06:08:56 +00:00
Hisham Muhammad ca6b9238a3 Support for UTF-8 tree drawing
(thanks to Bin Guo)
2011-11-03 22:12:12 +00:00
Hisham Muhammad d1b1cbc757 cleanups and fixes, thanks to cppcheck and gcc -Wextra 2011-10-25 00:05:46 +00:00
Hisham Muhammad ec17b7029a Convert affinity control from the deprecated PLPA to HWLOC 2011-09-24 00:30:47 +00:00
Hisham Muhammad f7fe4b4722 Fix off-by-one error in PROCESSOR display 2011-09-08 02:48:53 +00:00
Hisham Muhammad 27b470e10d Don't simply trust that string splits were successful... 2011-08-29 20:45:29 +00:00
Hisham Muhammad 9599e5650e larger numbers 2011-05-26 16:32:05 +00:00
Hisham Muhammad 219bb9ccff handle large values for process time 2011-03-28 19:06:06 +00:00