summaryrefslogtreecommitdiffstats
path: root/Process.h
AgeCommit message (Collapse)Author
2021-09-05Add a Process_printPercentage helper routineHisham Muhammad
Replace several open-coded variants of percentage formatting. This function has been ported from Hishams old 'next' branch.
2021-09-02Process: drop unused merged-command bit fieldsChristian Göttsche
2021-08-13PCP: support for 'dynamic columns' added at runtimeSohaib Mohamed
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.
2021-07-17Respect "Show custom thread names" settingBenny Baumann
2021-07-15Pointer indication aligned to typenameBenny Baumann
2021-06-09Check processes for using deleted shared librariesChristian Göttsche
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.
2021-05-25Move CWD field handling to platform-neutral codeBenny Baumann
2021-05-23Add ELAPSED process columnChristian Göttsche
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
2021-05-23Process: add convenience helper functions to update merged command line ↵Christian Göttsche
related data
2021-05-23Drop mc->maxLen fieldBenny Baumann
2021-05-23Move PROC_COMM/PROC_EXE column handling to global Process implementationBenny Baumann
2021-05-23Move Process_makeCommandStr to global Process implementationBenny Baumann
2021-05-23Move LinuxProcess_getCommandStr to Process_getCommandStrBenny Baumann
2021-05-23Move kernel/userland thread handling to platform-independent implementationBenny Baumann
2021-05-23Move mergeCommand to global process structBenny Baumann
2021-05-23Rename cmdlineBasenameOffset to cmdlineBasenameEnd to properly indicate the ↵Benny Baumann
fields purpose
2021-05-23Move procCmdlineBasenameOffset as cmdlineBasenameStart to global Process ↵Benny Baumann
structure
2021-05-23Move procExeBasenameOffset to main Process structureBenny Baumann
This drops procExeLen, as that field is implicit by strlen(Process->procExe)
2021-05-23Move procExeDeleted flag to main Process structureBenny Baumann
2021-05-23Rename basenameOffset to cmdlineBasenameOffsetBenny Baumann
2021-05-23Move procComm and procExe to main Process structureBenny Baumann
2021-05-23Process: Put the time field more to the endBenny Baumann
2021-05-23Rename command line field from comm to cmdlineBenny Baumann
2021-05-23Refactor makeCommandStrBenny Baumann
2021-04-26Rework process field print functionsChristian Göttsche
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
2021-04-14Rework TTY columnChristian Göttsche
* 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.
2021-04-05Request the realtime and monotonic clock times once per sampleNathan Scott
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
2021-01-30Linux: silence UBSAN implicit conversionsChristian Göttsche
pgrp and session might be -1 linux/LinuxProcessList.c:312:20: runtime error: implicit conversion from type 'unsigned long' of value 18446744073709551615 (64-bit, unsigned) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:312:20 in linux/LinuxProcessList.c:314:23: runtime error: implicit conversion from type 'unsigned long' of value 18446744073709551615 (64-bit, unsigned) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:314:23 in
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-30Overhaul sorting of state process columnChristian Göttsche
Do not sort by ascii value of the state identifier, sort by relevance
2021-01-30Process: document process fieldsChristian Göttsche
Drop unused fields 'flags' and 'exit_signal'
2021-01-21Sort out the mess around column sorting that had accumulated over timeDaniel Lange
2021-01-11Process: drop commLenChristian Göttsche
It is only used on Linux to optimize memory handling in case the command changes to a smaller-or-equal string. This "optimization" however causes more code bloat and maintenance cost on string handling issues than it gains.
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-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-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-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-16Move macro definitions close to usageChristian Göttsche
2020-12-16Use common naming for bare enum typesChristian Göttsche
2020-12-06Use size_t as type for buffer length in ProcessChristian Göttsche
2020-12-06IWYU updateChristian Göttsche
2020-12-02Implement sorting in tree modeMaxim Zhiburt
2020-11-26Calculate library size (M_LRS column) from maps fileFynn Wulf
2020-11-26Fix crash when getCommandStr not overloaded for a platform processChristian Göttsche
Closes: #343
2020-11-24Cleanup some documentationNarendran Gopalakrishnan
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