summaryrefslogtreecommitdiffstats
path: root/linux/LinuxProcess.c
Commit message (Collapse)AuthorAgeFilesLines
* IWYU updateChristian Göttsche2021-08-251-2/+0
|
* Add columns for process autogroup identifier and nice valueNathan Scott2021-08-091-0/+56
| | | | | | | | | | | | Adds AGRP (autogroup) and ANI (autogroup nice) columns that report the information from /proc/PID/autogroup, as well as handlers for '{' and '}' to change the autogroup nice value. This is guarded by /proc/sys/kernel/sched_autogroup_enabled such that sampling and/or changing values wont be attempted unless the kernel feature is enabled. Fixes: #720
* Split statements that should go onto multiple linesBenny Baumann2021-07-151-1/+2
|
* Move CWD field handling to platform-neutral codeBenny Baumann2021-05-251-18/+1
|
* Add ELAPSED process columnChristian Göttsche2021-05-231-0/+1
| | | | | | | | | 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
* Linux: drop obsolete code now in Process_writeFieldChristian Göttsche2021-05-231-54/+0
|
* Move PROC_COMM/PROC_EXE column handling to global Process implementationBenny Baumann2021-05-231-40/+0
|
* Move Process_makeCommandStr to global Process implementationBenny Baumann2021-05-231-354/+2
|
* Move LinuxProcess_getCommandStr to Process_getCommandStrBenny Baumann2021-05-231-12/+0
|
* Move kernel/userland thread handling to platform-independent implementationBenny Baumann2021-05-231-10/+6
|
* Move mergeCommand to global process structBenny Baumann2021-05-231-11/+8
|
* Rename cmdlineBasenameOffset to cmdlineBasenameEnd to properly indicate the ↵Benny Baumann2021-05-231-15/+15
| | | | fields purpose
* Move procCmdlineBasenameOffset as cmdlineBasenameStart to global Process ↵Benny Baumann2021-05-231-1/+1
| | | | structure
* Remove duplicate field LinuxProcess->procCmdlineBasenameEndBenny Baumann2021-05-231-1/+1
| | | | This field held practically the same value as cmdlineBasenameEnd
* Move procExeBasenameOffset to main Process structureBenny Baumann2021-05-231-5/+5
| | | | This drops procExeLen, as that field is implicit by strlen(Process->procExe)
* Move procExeDeleted flag to main Process structureBenny Baumann2021-05-231-3/+3
|
* Move procComm and procExe to main Process structureBenny Baumann2021-05-231-12/+10
|
* Rename command line field from comm to cmdlineBenny Baumann2021-05-231-2/+2
|
* Refactor makeCommandStrBenny Baumann2021-05-231-127/+109
|
* platform-dependent files included relative to main source directorymayurdahibhate2021-05-101-1/+2
|
* cleaned up includes with iwyumayurdahibhate2021-05-101-0/+1
|
* Linux: update IO fieldsChristian Göttsche2021-04-261-11/+11
| | | | | | | | | | | | | | - fix header width of IO_READ_RATE - save data in bytes (not kilobytes) to better compute rate - fix rate data: multiply with 1000 to compensate time difference in milliseconds - rename unit less variable now into realtimeMs - use Process_printBytes(..., data * pageSize, ...) instead of Process_printKBytes(..., data * pageSizeKB, ...) to avoid wrapper
* Rework process field print functionsChristian Göttsche2021-04-261-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* LinuxProcess: 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: - SECATTR - CGROUP - CTID
* Rework TTY columnChristian Göttsche2021-04-141-10/+1
| | | | | | | | | | * 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.
* LinuxProcess: Drop dead assignmentChristian Göttsche2021-03-021-1/+1
| | | | | Modern compilers are very good at finding uninitialized paths, lets rely on them.
* Fix typo, align with man page, drop dotsDaniel Lange2021-02-021-2/+2
|
* DiD: Avoid negative cmdlineBasenameOffsetBenny Baumann2021-02-011-0/+3
|
* Linux: overhaul io process fieldsChristian Göttsche2021-01-301-16/+23
| | | | | | | | - 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
* Refactor to tty_nr process field displayChristian Göttsche2021-01-301-7/+6
| | | | | | | 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.
* Implement stable tie-breaker and add more defaultSortDesc fields as per ↵Daniel Lange2021-01-221-24/+24
| | | | cgzones' suggestions, simplify Process_compare flow from BenBE
* Sort out the mess around column sorting that had accumulated over timeDaniel Lange2021-01-211-43/+43
|
* Linux: use correct column alignment for wide fieldsChristian Göttsche2021-01-111-12/+19
| | | | | | | 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-9/+9
| | | | Fixes: #459
* Declare for loop variables inside the loopChristian Göttsche2021-01-061-2/+1
|
* Object: return int on comparisonChristian Göttsche2021-01-021-1/+1
| | | | | Comparisons do, due to the new introduced shaceship-comparisons, only return -1, 0, 1 or the result of strcmp().
* Only initialize and gather delay accounting data if a related column is enabledChristian Göttsche2021-01-011-3/+3
| | | | | Avoid creating and communicating over a netlink socket by default, which triggers cap_net_admin checks as root.
* Resolve clang-analyzer signed/unsigned comparison CI failureNathan Scott2020-12-221-2/+2
|
* DiD: Ensure string offsets are inside string boundariesBenny Baumann2020-12-211-0/+6
|
* Avoid NULL dereference on zombie processesBenny Baumann2020-12-211-2/+9
| | | | Fixes #361
* Merge Process_pidColumns into Process_fields and rework auto-fit for ↵Christian Göttsche2020-12-191-22/+9
| | | | PID-like columns
* Rework enum ProcessFieldChristian Göttsche2020-12-191-4/+3
| | | | | | 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
* LinuxProcess: drop dead Process columnsChristian Göttsche2020-12-191-18/+0
|
* Split boilerplate and platform-independent field comparisonBenny Baumann2020-12-191-1/+1
| | | | | | | | 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.
* Invert Process_compare resolution so that superclass matches run firstHisham Muhammad2020-12-191-15/+8
| | | | | | | | | | * 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.
* Move macro definitions close to usageChristian Göttsche2020-12-161-0/+5
|
* Cleanup initialization of jiffies on the Linux platformNathan Scott2020-12-141-1/+0
| | | | | | | | | | Small cleanups - add error handling, remove a local static variable and refactor LinuxProcess_adjustTime (also rename it, as its in LinuxProcessList.c not LinuxProcess.c) - and while there, move the related 'btime' global variable into LinuxProcessList.c so it can be made static. Resolves https://github.com/htop-dev/htop/issues/384
* Cull the definitions of pageSize and pageSizeKB from CRT.cNathan Scott2020-12-101-5/+7
| | | | | | | | | | | | | | | 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.
* Additional code simplificationBenny Baumann2020-12-081-1/+2
| | | | Additional correction for #375
* Split RichString_(append|appendn|write) into wide and asciiChristian Göttsche2020-12-081-3/+3
| | | | | | | | 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.

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