summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2021-05-10cleaned up includes with iwyumayurdahibhate
2021-05-10Enclose macro argumentChristian Göttsche
Also enclosing is unnecessary in declaration as in int (VAR);
2021-05-10Align parameter name of Generic_gettime_realtimeChristian Göttsche
Align with name in implementation.
2021-05-10Sort include headersChristian Göttsche
2021-05-10Ignore IDE configuration filesChristian Göttsche
[skip ci]
2021-04-26Linux: update IO fieldsChristian Göttsche
- 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
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-26LinuxProcess: print default buffer in asciiChristian Göttsche
`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
2021-04-26Process: print default buffer in asciiChristian Göttsche
`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
2021-04-26Use RichString_appendnAscii where possibleChristian Göttsche
`RichString_appendnAscii()` avoids a `strlen(3)` call over ` RichString_appendAscii()`. Use the former where the length is available from a previous checked `snprintf(3)` call. Keep `RichString_appendAscii()` when passing a string literal and rely on compilers to optimize the `strlen(3)` call away.
2021-04-22ZfsCompressedArcMeter: avoid division by 0Christian Göttsche
On systems not using ZFS `this->values[0]` is zero.
2021-04-22Linux: handle Shmem being part of CachedChristian Göttsche
See https://lore.kernel.org/patchwork/patch/648763/ Do not show twice by subtracting from Cached. Closes: #591
2021-04-22Update FUNDING.yaml to use open_collective directly (thanks cgzones)Nathan Scott
2021-04-21Document '?' key to reach the help screenBenny Baumann
2021-04-21Add assert for unreachable switch caseChristian Göttsche
Like the default case in Process_writeField()
2021-04-21Avoid implicit pointer to bool conversion in assignmentChristian Göttsche
Improve readability
2021-04-21Drop ProcessList_get and ProcessList_sizeChristian Göttsche
Only used inside ProcessList.c and only once each.
2021-04-21Make MainPanel_pidSearch a static functionChristian Göttsche
Not used elsewhere.
2021-04-21Linux: use more robust pid parsingChristian Göttsche
Also add comment to condition
2021-04-21Add github funding link to htop opencollective pageNathan Scott
2021-04-18don't include offline CPUs in summary for OpenBSDStuart Henderson
By default, OpenBSD disables SMT (hyperthreading) cpu pseudo-cores. This can be changed at runtime by setting the hw.smt sysctl so they may become active later, therefore they are still present in cpu stat structures but are marked as offline. As done with native top(1), this drops them from the cpu summary graphs.
2021-04-14DragonFlyBSD: resolve sign comparisonChristian Göttsche
Compat.c: In function 'Compat_faccessat': Compat.c:46:14: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare] 46 | if (dirfd != AT_FDCWD || mode != F_OK) { | ^~
2021-04-14FreeBSD: silence unsigned integer underflowChristian Göttsche
freebsd/FreeBSDProcessList.c:252:47: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int' #0 0x397c32 in FreeBSDProcessList_scanCPU /root/workspace/htop/htop/freebsd/FreeBSDProcessList.c:252:47 #1 0x38fe76 in ProcessList_goThroughEntries /root/workspace/htop/htop/freebsd/FreeBSDProcessList.c:438:4 #2 0x35ef9a in ProcessList_scan /root/workspace/htop/htop/ProcessList.c:618:4 #3 0x31ee9e in main /root/workspace/htop/htop/htop.c:468:4 #4 0x26bbcf in _start /usr/src/lib/csu/amd64/crt1.c:76:7
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-14Add read-only optionChristian Göttsche
Add command line option to disable all system and process changing features.
2021-04-14Rename drop-capabilities options none to offChristian Göttsche
None might be ambiguous whether we are dropping none or whether we keep none. Rename to off to make more clear this option does not drop any.
2021-04-14LinuxProcessList_recurseProcTree(): drop non necessary parameterChristian Göttsche
2021-04-10Convert process time to days if applicableDavid Zarzycki
With big multicore machines, it's easy to accumulate process time.
2021-04-09Merge pull request #593 from natoscott/init-pl-timeNathan Scott
Update timestamps for the special process scans at startup also
2021-04-09Update timestamps for the special process scans at startup alsoNathan Scott
Resolves https://github.com/htop-dev/htop/issues/592
2021-04-07Merge branch 'smalinux-CtrTime'Nathan Scott
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-04-05Merging all the points related to calculating time in one placeSohaib
The end goal is to consolidate all the points in htop that can only work in live-only mode today, so that will be able to inject PCP archive mode and have a chance at it working. The biggest problem we've got at this moment is all the places that are independently asking the kernel to 'give me the time right now'. Each of those needs to be audited and ultimately changed to allow platforms to manage their own idea of time. So, all the calls to gettimeofday(2) and time(2) are potential problems. Ultimately I want to get these down to just one or two. Related to https://github.com/htop-dev/htop/pull/574
2021-04-04Merge branch 'illumos-compile-fix' of BenBE/htopDaniel Lange
2021-04-03Include signal.h, reorder headersBenny Baumann
2021-03-31Reorder the header update and process scanningNathan Scott
BenBE points out that some header meters use values calculated during process scanning - make sure we scan processes first in order that current values are displayed. Related to https://github.com/htop-dev/htop/pull/574
2021-03-31TaskMeter: always show number of threadsChristian Göttsche
Always show the number of kernel and userland threads, even when they are disabled to not be shown in the process list. The data is already available and might improve understanding the system utilization. Use a shadow color in case the kind of thread is hidden, else the normal meter one.
2021-03-30FreeBSD: improve actual processor calculation logicAlexander Nedotsukov
2021-03-28Linux: handle garbage in /proc/loadavgChristian Göttsche
When parsing the content of /proc/loadavg via fscanf(3), ensure client passed parameters are set to sanitized values. Related to: #581
2021-03-25Merge pull request #575 from natoscott/refactor-command-lineNathan Scott
Abstract htop main function to allow for a platform binary
2021-03-25Abstract htop main function to allow for a platform binaryNathan Scott
One review request relating to the PCP platform is to have a clearly separate binary from the regular htop so that we have no confusion as to what is being requested to run, to aid debugging, and a bunch of other good reasons. This commit renames htop.c to CommandLine.c and provides a minimal htop main function for 'native' platforms to use. The PCP version of this will setup libpcp.so and then call the same CommandLine_run function as regular htop. Related to https://github.com/htop-dev/htop/pull/536
2021-03-24Drop always true conditionChristian Göttsche
The variable 'dir' is checked in line 645: if (!dir) return AC_ERROR;
2021-03-24Add MEMORY_SHARED to help screenDavid Zarzycki
2021-03-24Correct spelling in commentChristian Göttsche
2021-03-24Drop unused attributes of actually used function parametersChristian Göttsche
These parameters were once unused, but not anymore.
2021-03-22Linux: fix --drop-capabilitiesChristian Göttsche
Do not return false (= argument not handled) when actually handled
2021-03-22Merge pull request #564 from natoscott/platform-optionsNathan Scott
Move libcap use to (Linux) platform-specific code
2021-03-22Use a platform-specific routine for long option usageNathan Scott
Related to https://github.com/htop-dev/htop/pull/564
2021-03-22Each platform defines its own long opt macro, prefer printfNathan Scott
Follow up on the two items of feedback from cgzones review, and resolve a build failure picked up by CI on Mac OS X. Related to https://github.com/htop-dev/htop/pull/564
2021-03-22Move libcap use to (Linux) platform-specific codeNathan Scott
The libcap code is Linux-specific so move it all below the linux/ platform subdirectory. As this feature has custom command-line long options I provide a mechanism whereby each platform can add custom long options that augment the main htop options. We'll make use this of this with the pcp/ platform in due course to implement the --host and --archive options there. Related to https://github.com/htop-dev/htop/pull/536