summaryrefslogtreecommitdiffstats
path: root/Process.c
Commit message (Collapse)AuthorAgeFilesLines
...
* cleaned up includes with iwyumayurdahibhate2021-05-101-2/+1
|
* Rework process field print functionsChristian Göttsche2021-04-261-33/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make functions formatting data for a process field column less error prone, unify interfaces and improve some internals. * Process_printBytes - rename from Process_humanNumber - take number in bytes, not kilobytes - handle petabytes - increase buffer to avoid crashes when the passed value is ~ ULLONG_MAX * Process_printKBytes - add wrapper for Process_printBytes taking kilobytes keeping -1 as special value * Process_printCount - rename from Process_colorNumber * Process_printTime - add coloring parameter as other print functions - improve coloring and formatting for larger times * Process_printRate - rename from Process_outputRate - use local buffer instead of passed one; this function prints to the RichString after all
* Process: print default buffer in asciiChristian Göttsche2021-04-261-1/+1
| | | | | | | | | | | `RichString_appendWide()` is more expensive than `RichString_appendAscii()` due to the calls to `mbstowcs(3)` and `iswprint(3)`. Use the latter to print the process field buffer by default. For the following fields this theoretically can corrupt the output: - TTY
* Add assert for unreachable switch caseChristian Göttsche2021-04-211-1/+2
| | | | Like the default case in Process_writeField()
* Rework TTY columnChristian Göttsche2021-04-141-9/+9
| | | | | | | | | | * Rename internal identifier from TTY_NR to just TTY * Unify column header on platforms * Use devname(3) on BSD derivate to show the actual terminal, simplifies current FreeBSD implementation. * Use 'unsigned long int' as id type, to fit dev_t on Linux. Only on Solaris the terminal path is not yet resolved.
* Add read-only optionChristian Göttsche2021-04-141-0/+3
| | | | | Add command line option to disable all system and process changing features.
* Convert process time to days if applicableDavid Zarzycki2021-04-101-1/+5
| | | | With big multicore machines, it's easy to accumulate process time.
* Request the realtime and monotonic clock times once per sampleNathan Scott2021-04-051-3/+3
| | | | | | | | | | | | | | | | Refactor the sample time code to make one call to gettimeofday (aka the realtime clock in clock_gettime, when available) and one to the monotonic clock. Stores each in more appropriately named ProcessList fields for ready access when needed. Every platform gets the opportunity to provide their own clock code, and the existing Mac OS X specific code is moved below darwin instead of in Compat. A couple of leftover time(2) calls are converted to use these ProcessList fields as well, instead of yet again sampling the system clock. Related to https://github.com/htop-dev/htop/pull/574
* RichString: do not unnecessarily clean whole bufferChristian Göttsche2021-03-171-1/+0
| | | | | | | The local stack buffer does not need to be cleaned to zeros when - just initialized, cause the length is set to 0 and the first character is set to '\0', so all printing functions will safely stop - no further used, i.e. the variable goes out of scope
* Process: do not access RichString internalsChristian Göttsche2021-03-121-1/+1
| | | | Use wrapper macro to encapsulate the RichString structure
* Process_compare: reorder checksChristian Göttsche2021-03-121-4/+1
| | | | | Check for result being 0 first, before checking if the result might be negated, so we do not need to negate 0.
* Use uppercase floating point literal suffixChristian Göttsche2021-03-021-5/+5
|
* Refactor to remove no-op callsBenny Baumann2021-02-171-6/+2
| | | | This removes the call-sites of the removed setuid feature
* Linux: overhaul io process fieldsChristian Göttsche2021-01-301-9/+8
| | | | | | | | - 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
* Update generic process field displayChristian Göttsche2021-01-301-83/+93
| | | | | | | | | | - 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
* Overhaul sorting of state process columnChristian Göttsche2021-01-301-1/+39
| | | | Do not sort by ascii value of the state identifier, sort by relevance
* Refactor to tty_nr process field displayChristian Göttsche2021-01-301-1/+11
| | | | | | | 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.
* Use typedef names instead of raw struct onesChristian Göttsche2021-01-261-1/+1
|
* Implement stable tie-breaker and add more defaultSortDesc fields as per ↵Daniel Lange2021-01-221-10/+7
| | | | cgzones' suggestions, simplify Process_compare flow from BenBE
* Sort out the mess around column sorting that had accumulated over timeDaniel Lange2021-01-211-7/+7
|
* RichString: refactor writing limited amount of columnsChristian Göttsche2021-01-151-2/+3
| | | | Closes: #468
* RichString_appendChr: add parameter to set attributesChristian Göttsche2021-01-131-1/+1
| | | | | | | Allows to set attributes when padding process fields in non-wide ncurses mode. Closes: #475
* Linux: use correct column alignment for wide fieldsChristian Göttsche2021-01-111-2/+6
| | | | | | | This affects: - PROC_COMM, PROC_EXE and CWD on Linux - JAIL on FreeBSD and DragonFlyBSD - ZONE on Solaris
* RichString_setAttrn: refactor to take a length instead of a stop indexChristian Göttsche2021-01-101-6/+6
| | | | Fixes: #459
* Declare for loop variables inside the loopChristian Göttsche2021-01-061-2/+2
|
* Object: return int on comparisonChristian Göttsche2021-01-021-4/+4
| | | | | Comparisons do, due to the new introduced shaceship-comparisons, only return -1, 0, 1 or the result of strcmp().
* Process: use correct column aligning on wide usernameChristian Göttsche2020-12-231-7/+6
| | | | Closes: #421
* Merge Process_pidColumns into Process_fields and rework auto-fit for ↵Christian Göttsche2020-12-191-17/+9
| | | | PID-like columns
* Rework enum ProcessFieldChristian Göttsche2020-12-191-1/+1
| | | | | | 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
* Split boilerplate and platform-independent field comparisonBenny Baumann2020-12-191-3/+14
| | | | | | | | 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.
* Separate tree and list sort ordersHisham Muhammad2020-12-191-5/+2
| | | | | | | | | | | | 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. :)
* Add "Tree view is always sorted by PID" option to mimic htop 2 behaviorHisham Muhammad2020-12-191-1/+6
|
* Invert Process_compare resolution so that superclass matches run firstHisham Muhammad2020-12-191-1/+1
| | | | | | | | | | * 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.
* ProcessList: save scan time in millisecondChristian Göttsche2020-12-181-1/+1
| | | | | The delay is saved in deciseconds, use a bigger resolution to avoid timing irregularities.
* Cull the definitions of pageSize and pageSizeKB from CRT.cNathan Scott2020-12-101-2/+2
| | | | | | | | | | | | | | | 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.
* Process: simplifyChristian Göttsche2020-12-081-2/+3
|
* Additional code simplificationBenny Baumann2020-12-081-1/+2
| | | | Additional correction for #375
* Fix broken tree display on inverted sort orderBenny Baumann2020-12-081-1/+1
| | | | Fixes #375
* Split RichString_(append|appendn|write) into wide and asciiChristian Göttsche2020-12-081-38/+36
| | | | | | | | 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.
* Use size_t as type for buffer length in ProcessChristian Göttsche2020-12-061-3/+3
|
* Print G in gigabyte colorChristian Göttsche2020-11-291-1/+2
| | | | When printing a size like 27.2G print the G like the 27 in the gigabyte color.
* Replace more snprintfs, reduce buffer sizes to what is printedDaniel Lange2020-11-281-19/+19
|
* Use 'N/A' instead of 'no perm' for more consistencyBenny Baumann2020-11-281-6/+9
|
* Minor indentation fixBenny Baumann2020-11-241-1/+1
|
* Improving Command display/sortNarendran Gopalakrishnan2020-11-241-1/+6
|
* Rename virtual memory column from M_SIZE to M_VIRTChristian Göttsche2020-11-211-3/+3
| | | | Closes: #325
* IWYU update (Linux)Christian Göttsche2020-11-191-1/+2
|
* Add process column for normalized CPU usageChristian Göttsche2020-11-161-6/+12
| | | | Shows the process CPU usage divided by the number of CPU cores
* Merge branch 'hili-new-old' of adsr/htop into highlight-new-old-processesDaniel Lange2020-11-161-14/+34
|\
| * Address items from reviewAdam Saponara2020-10-311-6/+6
| |

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