summaryrefslogtreecommitdiffstats
path: root/Process.c
AgeCommit message (Collapse)Author
2021-02-17Refactor to remove no-op callsBenny Baumann
This removes the call-sites of the removed setuid feature
2021-01-30Linux: overhaul io process fieldsChristian Göttsche
- avoid UBSAN conversions - print N/A on no data (i.e. as unprivileged user) - fix rate calculation to show bytes (instead of a thousandth) - print bytes as human number (i.e. 8MB) instead of 8388608 - stabilize sorting by adjusting NAN values to very tiny negative number
2021-01-30Update generic process field displayChristian Göttsche
- sort cases by identifier - use check snprintf - color nice value of 0 as gray - color cpu and memory percentages of 0.0 as gray - color number of threads of 1 as gray - color idle and sleeping state as gray - color tgid matching pid (indicating main thread) as gray
2021-01-30Overhaul sorting of state process columnChristian Göttsche
Do not sort by ascii value of the state identifier, sort by relevance
2021-01-30Refactor to tty_nr process field displayChristian Göttsche
If no terminal name can be found, fall back to generic display method with major and minor device numbers. Print special value '(none)' in case both are zero.
2021-01-26Use typedef names instead of raw struct onesChristian Göttsche
2021-01-22Implement stable tie-breaker and add more defaultSortDesc fields as per ↵Daniel Lange
cgzones' suggestions, simplify Process_compare flow from BenBE
2021-01-21Sort out the mess around column sorting that had accumulated over timeDaniel Lange
2021-01-15RichString: refactor writing limited amount of columnsChristian Göttsche
Closes: #468
2021-01-13RichString_appendChr: add parameter to set attributesChristian Göttsche
Allows to set attributes when padding process fields in non-wide ncurses mode. Closes: #475
2021-01-11Linux: use correct column alignment for wide fieldsChristian Göttsche
This affects: - PROC_COMM, PROC_EXE and CWD on Linux - JAIL on FreeBSD and DragonFlyBSD - ZONE on Solaris
2021-01-10RichString_setAttrn: refactor to take a length instead of a stop indexChristian Göttsche
Fixes: #459
2021-01-06Declare for loop variables inside the loopChristian Göttsche
2021-01-02Object: return int on comparisonChristian Göttsche
Comparisons do, due to the new introduced shaceship-comparisons, only return -1, 0, 1 or the result of strcmp().
2020-12-23Process: use correct column aligning on wide usernameChristian Göttsche
Closes: #421
2020-12-19Merge Process_pidColumns into Process_fields and rework auto-fit for ↵Christian Göttsche
PID-like columns
2020-12-19Rework enum ProcessFieldChristian Göttsche
Use only one enum instead of a global and a platform specific one. Drop Platform_numberOfFields global variable. Set known size of Process_fields array
2020-12-19Split boilerplate and platform-independent field comparisonBenny Baumann
This acheives two things: - Allows for simple tie-breaking if values compare equal (needed to make sorting the tree-view stable) - Allows for platform-dependent overriding of the sort-order for specific fields Also fixes a small oversight on DragonFlyBSD when default-sorting.
2020-12-19Separate tree and list sort ordersHisham Muhammad
Implements the suggestion from https://github.com/htop-dev/htop/issues/399#issuecomment-747861013 Thanks to the refactors from 0bd5c8fb5da and 6393baa74e5, this was really easy and clean to do. It maintains the "Tree view always by PID" option in the Settings, which results in some specific behaviors such as "clicking on the column header to exit tree view" and "picking a new sort order to exit tree view", for the sake of the muscle memory of long time htop users. :)
2020-12-19Add "Tree view is always sorted by PID" option to mimic htop 2 behaviorHisham Muhammad
2020-12-19Invert Process_compare resolution so that superclass matches run firstHisham Muhammad
* This removes duplicated code that adjusts the sort direction from every OS-specific folder. * Most fields in a regular htop screen are OS-independent, so trying Process_compare first and only falling back to the OS-specific compareByKey function if it's an OS-specific field makes sense. * This will allow us to override the sortKey in a global way without having to edit each OS-specific file.
2020-12-18ProcessList: save scan time in millisecondChristian Göttsche
The delay is saved in deciseconds, use a bigger resolution to avoid timing irregularities.
2020-12-10Cull the definitions of pageSize and pageSizeKB from CRT.cNathan Scott
By storing the per-process m_resident and m_virt values in the form htop wants to display them in (KB, not pages), we no longer need to have definitions of pageSize and pageSizeKB in the common CRT code. These variables were never really CRT (i.e. display) related in the first place. It turns out the darwin platform code doesn't need to use these at all (the process values are extracted from the kernel in bytes not pages) and the other platforms can each use their own local pagesize variables, in more appropriate locations. Some platforms were actually already doing this, so this change is removing duplication of logic and variables there.
2020-12-08Process: simplifyChristian Göttsche
2020-12-08Additional code simplificationBenny Baumann
Additional correction for #375
2020-12-08Fix broken tree display on inverted sort orderBenny Baumann
Fixes #375
2020-12-08Split RichString_(append|appendn|write) into wide and asciiChristian Göttsche
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-06Use size_t as type for buffer length in ProcessChristian Göttsche
2020-11-29Print G in gigabyte colorChristian Göttsche
When printing a size like 27.2G print the G like the 27 in the gigabyte color.
2020-11-28Replace more snprintfs, reduce buffer sizes to what is printedDaniel Lange
2020-11-28Use 'N/A' instead of 'no perm' for more consistencyBenny Baumann
2020-11-24Minor indentation fixBenny Baumann
2020-11-24Improving Command display/sortNarendran Gopalakrishnan
2020-11-21Rename virtual memory column from M_SIZE to M_VIRTChristian Göttsche
Closes: #325
2020-11-19IWYU update (Linux)Christian Göttsche
2020-11-16Add process column for normalized CPU usageChristian Göttsche
Shows the process CPU usage divided by the number of CPU cores
2020-11-16Merge branch 'hili-new-old' of adsr/htop into highlight-new-old-processesDaniel Lange
2020-11-15Use uid_t type for Process_getuidChristian Göttsche
2020-11-15Introduce spaceship comparison for ProcessesChristian Göttsche
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-02Embracing branchesBenny Baumann
2020-11-02Spacing around operatorsBenny Baumann
2020-11-02Whitespace and indentation issuesBenny Baumann
2020-11-02Spacing after keywords (if)Benny Baumann
2020-10-31Address items from reviewAdam Saponara
2020-10-30Highlight new and old processes (#74)Adam Saponara
2020-10-26Hold only a const version of Settings in ProcessChristian Göttsche
2020-10-19Cache PAGE_SIZEChristian Göttsche
man:sysconf(3) states: The values obtained from these functions are system configuration constants. They do not change during the lifetime of a process.
2020-10-18Make all required includes explicitBenny Baumann
Information as seen by IWYU 0.12 + clang 9 on Linux
2020-10-16Rename StringUtils.[ch] to XUtils.[ch]Benny Baumann
2020-10-16Refactor generating starttime string into Process classChristian Göttsche