summaryrefslogtreecommitdiffstats
path: root/Process.c
Commit message (Collapse)AuthorAgeFilesLines
* ProcessList: fix quadratic process removal when scanningCharlie Vieth2022-05-051-7/+0
| | | | | | | | | | | | | | | | | | | | | | | This commit changes ProcessList_scan to lazily remove Processes by index, which is known, instead of performing a brute-force search by pid and immediately reclaiming the lost vector space via compaction. Searching by pid is potentially quadratic in ProcessList_scan because the process we are searching for is always at the back of the vector (the scan starts from the back of the vector). Additionally, removal via Vector_remove immediately reclaims space (by sliding elements down). With these changes process removal in ProcessList_scan is now linear. Changes: * ProcessList: add new ProcessList_removeIndex function to remove by index * Vector: add Vector_softRemove and Vector_compact functions to support lazy removal/deletion of entries Vector_softRemove Vector_compact * Vector: replace Vector_count with Vector_countEquals since it only used for consistency assertions.
* Avoid extremely large year values when printing timeBenny Baumann2022-04-211-1/+6
|
* Force elapsed time display to zero if process seems started in the futureBenny Baumann2022-04-211-1/+9
|
* Process: Fix PID & UID column widths off-by-one errorExplorer092022-04-181-2/+2
| | | | | | | | | If the max PID or UID value for a platform is exactly a power of ten (10000, 100000, etc.) the column widths of PID and UID would be 1 char less than the correct number of digits. This is caused by the wrong rounding function (ceil(x)); change to the correct one (trunc(x) + 1). Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* Auto-size (normalized) CPU usage columnsBenny Baumann2022-03-061-7/+20
|
* Linux: dynamically adjust the SECATTR column widthChristian Göttsche2022-03-061-0/+20
| | | | | | | | SELinux contexts can be quite long; adjust the column width dynamically at each cycle to the longest value. Also with the recent addition of multiple screens, over-long columns can be moved into their own screen.
* Process: Handle rounding ambiguity between 99.9 and 100.0Kumar2022-02-191-1/+3
| | | | | | | | | | | | | | | | Depending upon default behavior of the compiler and floating-point environment, compiler could round down the value between "99.9" and "100.0" to "99.0", instead of rounding it to the nearest value, "100.0". Note: The floating-point environment access and modification is only meaningful when "#pragma STD FENV_ACCESS" is set to "ON"[1]. Otherwise implementation is free to assume that floating-point control modes are always the default. So it would be a good idea to address the rounding ambiguity between "99.9" and "100.0" to become compiler agnostic. [1]: https://en.cppreference.com/w/c/numeric/fenv Credits: @Explorer09, thanks for the suggestion.
* Process: Show only integer value when CPU% more than 99.9%Kumar2022-02-191-3/+0
| | | | | | | | | | | | | | When we run a process which utilizes CPU between 100.0% and 999.9%, htop shows an unnecessary decimal character at the end of the value. For example, '100.x' and '247.x' become '100.' and '247.' respectively. When CPU utilization is less than and equal to '99.9%', show the result with single digit precision and if result is less than four characters, pad it with the blank space. When CPU utilization is greater than '99.9%', show only integral part of the result and if it's less than four characters, pad it with the blank space. Closes: #946
* Fix custom thread name display issueJan Kończak2022-02-131-2/+5
| | | | Fixes #877
* Drop getCommandStr member of ProcessChristian Göttsche2021-12-171-3/+2
| | | | | | Formatting the merged command string is now implemented in an platform independent way. Drop the Process member getCommandStr designed for overrides of individual platforms.
* Process: print default keyChristian Göttsche2021-12-081-0/+1
|
* Introduce screen tabsHisham Muhammad2021-12-071-4/+6
| | | | This is a forward port (by nathans) of Hisham's original code.
* Process: highlight UNINTERRUPTIBLE_WAIT state (D)Christian Göttsche2021-12-051-1/+1
| | | | | | | | | Commit d8dfbbd3 ("Tidy up process state handling") did change the highlighting of the UNINTERRUPTIBLE_WAIT state (D) from red to gray. As this state might means the process probably still has work to do and can hint at bottlenecks, revert this particular change. Fixes: d8dfbbd3 ("Tidy up process state handling")
* Tidy up process state handlingmarcluque2021-11-021-49/+43
|
* Dynamically scale the ST_UID size to support 32-bit UIDsSilke Hofstra2021-10-271-4/+20
| | | | | | | | | | | | | | | | | | While most Unix-like systems use 16-bit user IDs, Linux supports 32-bit UIDs since version 2.6. UIDs above 65535 are used for UID namespacing of containers, where a container has its own set of 16-bit user IDs. Processes in such containers will have (much) larger UIDs than 65535. Because the current format strings for `ST_UID` and `USER` are `%5d` and `%9d` respectively, processes with such UIDs lead to misaligned columns. Dynamically scale the `ST_UID` column and increase the size of `USER` to 10 characters (length of UINT32_MAX) to ensure that the user ID always fits. Additionally: clean up how the titlebuffer size calculation and ensure the PID column has a minimum size of 5.
* Handle procExeDeleted & usesDeletedLib without mergedCommandline modeBenny Baumann2021-10-071-0/+6
|
* Update license headers to explicitly say GPLv2+Daniel Lange2021-09-221-1/+1
|
* Process_printPercentage using one color transitionNathan Scott2021-09-141-1/+1
| | | Update Process_printPercentage such that color change happens only once at 100% and beyond.
* Highlight large percentages similar to large memory columnsBenny Baumann2021-09-051-0/+2
|
* Add a Process_printPercentage helper routineHisham Muhammad2021-09-051-25/+22
| | | | | Replace several open-coded variants of percentage formatting. This function has been ported from Hishams old 'next' branch.
* NetBSD: color process state P as runningChristian Göttsche2021-09-031-1/+5
| | | | | | On NetBSD state 'R' means runnable not running. Improve the color identifier name accordingly.
* Use break inside loop with false conditionChristian Göttsche2021-08-221-1/+1
| | | | | | | | | | | Found by clang-tidy. home/christian/Coding/workspaces/htop/Process.c:505:13: warning: 'continue' in loop with false condition is equivalent to 'break' [bugprone-terminating-continue] WRITE_HIGHLIGHT(0, strlen(procComm), commAttr, CMDLINE_HIGHLIGHT_FLAG_COMM); ^ /home/christian/Coding/workspaces/htop/Process.c:461:13: note: expanded from macro 'WRITE_HIGHLIGHT' continue; \ ^
* Respect "Show custom thread names" setting updateChristian Göttsche2021-08-141-6/+6
| | | | | | | Update merged command-line when started with "Show custom thread names" disabled and enabling at runtime. Also only consider showThreadNames when working on userland threads.
* PCP: support for 'dynamic columns' added at runtimeSohaib Mohamed2021-08-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements support for arbitrary Performance Co-Pilot metrics with per-process instance domains to form new htop columns. The column-to-metric mappings are setup using configuration files which will be documented via man pages as part of a follow-up commit. We provide an initial set of column configurations so as to provide new capabilities to pcp-htop: including configs for containers, open fd counts, scheduler run queue time, tcp/udp bytes/calls sent/recv, delay acct, virtual machine guests, detailed virtual memory, swap. Note there is a change to the configuration file path resolution algorithm introduced for 'dynamic meters'. First, look in any custom PCP_HTOP_DIR location. Then iterate, in priority order, users home directory, then local sysadmins files in /etc/pcp/htop, then readonly configuration files below /usr/share/pcp/htop. This final location becomes the preferred place for our own shipped meter and column files. The Settings file (htoprc) writing code is updated to not using the numeric identifier for dynamic columns. The same strategy used for dynamic meters is used here where we write Dynamic(name) so the name can be setup once more at start. Regular (static) columns writing to htoprc - i.e. numerically indexed - is unchanged.
* Merge branch 'cpu_count' of cgzones/htopDaniel Lange2021-08-021-1/+1
|\
| * Rework CPU countingChristian Göttsche2021-07-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | Currently htop does not support offline CPUs and hot-swapping, e.g. via echo 0 > /sys/devices/system/cpu/cpu2/online Split the current single cpuCount variable into activeCPUs and existingCPUs. Supersedes: #650 Related: #580
* | Respect "Show custom thread names" settingBenny Baumann2021-07-171-5/+8
|/
* Pointer indication aligned to typenameBenny Baumann2021-07-151-25/+25
|
* Whitespace around operatorsBenny Baumann2021-07-151-16/+16
|
* Code indentationBenny Baumann2021-07-151-8/+8
|
* Apply stale lib highlighting for EXE tooBenny Baumann2021-06-111-2/+6
|
* Linux: update process uid on changeChristian Göttsche2021-06-091-0/+1
| | | | Always check if the user of a process changed, e.g. by using setuid(2).
* Check processes for using deleted shared librariesChristian Göttsche2021-06-091-3/+8
| | | | | | | | | Shared libraries can be replaced by an upgrade, highlight processes using deleted shared libraries. Link with highlightDeletedExe setting, enabled by default. Currently only checked on Linux.
* Move CWD field handling to platform-neutral codeBenny Baumann2021-05-251-0/+17
|
* Linux: add reset to heuristicChristian Göttsche2021-05-251-1/+1
| | | | | | On hard to parse command lines tokenStart might be computed to be bigger than tokenEnd. Reset both values in such cases.
* Add ELAPSED process columnChristian Göttsche2021-05-231-0/+4
| | | | | | | | | Add process columns showing the elapsed time since the process was started. Similar to STARTTIME, but shows the time passed since the process start instead of the fixed start time of the process. Closes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=782636
* Allow for highlighting of deleted executables to be configuredBenny Baumann2021-05-231-2/+2
| | | | Fixes #383
* Process: add convenience helper functions to update merged command line ↵Christian Göttsche2021-05-231-0/+71
| | | | related data
* Drop mc->maxLen fieldBenny Baumann2021-05-231-1/+6
|
* Reduce code duplication for nearly identical code-pathsBenny Baumann2021-05-231-7/+3
|
* Properly brace macro argumentsBenny Baumann2021-05-231-17/+17
|
* Move PROC_COMM/PROC_EXE column handling to global Process implementationBenny Baumann2021-05-231-0/+41
|
* Call makeCommandStr on all platformsBenny Baumann2021-05-231-0/+11
|
* Move Process_makeCommandStr to global Process implementationBenny Baumann2021-05-231-22/+376
|
* Move LinuxProcess_getCommandStr to Process_getCommandStrBenny Baumann2021-05-231-2/+9
|
* Move mergeCommand to global process structBenny Baumann2021-05-231-0/+1
|
* Rename cmdlineBasenameOffset to cmdlineBasenameEnd to properly indicate the ↵Benny Baumann2021-05-231-3/+3
| | | | fields purpose
* Rename basenameOffset to cmdlineBasenameOffsetBenny Baumann2021-05-231-3/+3
|
* Move procComm and procExe to main Process structureBenny Baumann2021-05-231-0/+2
|
* Rename command line field from comm to cmdlineBenny Baumann2021-05-231-7/+7
|

© 2014-2024 Faster IT GmbH | imprint | privacy policy