summaryrefslogtreecommitdiffstats
path: root/linux/LinuxProcessList.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Request the realtime and monotonic clock times once per sampleNathan Scott2021-04-051-9/+1
| | | | | | | | | | | | | | | | 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
* Merging all the points related to calculating time in one placeSohaib2021-04-051-5/+9
| | | | | | | | | | | | | | 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
* Use `#if defined()` syntax when `#elif defined()` is presentBenny Baumann2021-03-211-1/+1
| | | | | | | This prefers the `#if defined()` syntax over the `#ifdef` variant whenever there's also a `#elif defined()` clause, thus making the multiple branching structure more obvious and the overall use more consistent.
* Use unsigned types for CPU counts and associated variablesChristian Göttsche2021-03-191-14/+13
|
* LinuxProcessList: drop unnecessary parenthesisChristian Göttsche2021-03-171-1/+1
|
* Linux: individually show shared memoryChristian Göttsche2021-03-151-1/+6
| | | | | | | | Shmem: Total memory used by shared memory (shmem) and tmpfs Source: https://www.kernel.org/doc/Documentation/filesystems/proc.txt Closes: #556
* LinuxProcessList: refactor /proc/stat parsingChristian Göttsche2021-03-121-71/+59
| | | | | | | | | | Combine reading CPU count and CPU usage, only open the file once. Do not separately initialize totalPeriod and totalTime, cause the value 0 is handled in Platform_setCPUValues(). Take the number of currently running process from the entry procs_running in /proc/stat instead of counting all scanned process with state 'R', to include hidden tasks, e.g. threads.
* Enclose macro argument in parenthesesChristian Göttsche2021-03-021-1/+1
|
* Correctly detect failure to initialize boottimeNathan Scott2021-02-151-2/+2
| | | | | | | A zero value for btime (boottime) in /proc/stat is a real situation that happens, so deal with this case. Resolves https://github.com/htop-dev/htop/issues/527
* Linux: overhaul memory partitionChristian Göttsche2021-02-071-37/+55
| | | | | | | Use similar calculation than procps. Show AvailableMemory in text mode. Use total minus available memory instead of manually computed used- memory as fraction part in bar mode (if available).
* Merge branch 'comm' of cgzones/htopDaniel Lange2021-02-021-0/+6
|\ | | | | | | Already in Debian so making sure upstream has it, too
| * Reset cache values when setting comm valueChristian Göttsche2021-01-121-0/+6
| | | | | | | | Maybe fixes #361
* | Linux: silence UBSAN implicit conversionsChristian Göttsche2021-01-301-2/+2
| | | | | | | | | | | | | | | | | | 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
* | Linux: document /proc/PID/stat field parsingChristian Göttsche2021-01-301-6/+47
| |
* | Linux: overhaul io process fieldsChristian Göttsche2021-01-301-20/+17
| | | | | | | | | | | | | | | | - 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
* | Process: document process fieldsChristian Göttsche2021-01-301-4/+8
| | | | | | | | Drop unused fields 'flags' and 'exit_signal'
* | Linux: individual huge page values in the huge page meterDavid Zarzycki2021-01-191-2/+7
| |
* | Linux: handle hugepagesChristian Göttsche2021-01-191-0/+52
| | | | | | | | | | | | | | Subtract hugepages from normal memory. Add a HugePageMeter. Closes: #447
* | Define PATH_MAX for GNU/hurdDaniel Lange2021-01-161-0/+1
| | | | | | | | | | Otherwise fails with "> linux/LinuxProcessList.c:889:20: error: ‘PATH_MAX’ undeclared (first use in this function)"
* | Linux: fall back to cpuinfo on slow scaling_cur_freq readChristian Göttsche2021-01-151-0/+30
|/ | | | | | | | | | | On some AMD and Intel CPUs read()ing scaling_cur_freq is quite slow (> 1ms). This delay accumulates for every core. If the read on CPU 0 takes longer than 500us bail out and fall back to reading the frequencies from /proc/cpuinfo. Once the condition has been met, bail out early for the next couple of scans. Closes: #471
* Linux: Add SwapCached to the swap meterDavid Zarzycki2021-01-111-1/+2
| | | | | | | According to the Linux kernel documentation, "SwapCached" tracks "memory that once was swapped out, is swapped back in but still also is in the swapfile (if memory is needed it doesn't need to be swapped out AGAIN because it is already in the swapfile. This saves I/O)."
* Mark several non-modified pointer variables constChristian Göttsche2021-01-111-7/+7
|
* Remove dead codeChristian Göttsche2021-01-111-4/+1
|
* Process: drop commLenChristian Göttsche2021-01-111-23/+7
| | | | | | | | 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.
* Add wrapper function for free and strdupChristian Göttsche2021-01-111-14/+7
| | | | Reduces code in callers and helps avoiding memory leaks.
* Drop always false conditionChristian Göttsche2021-01-111-1/+1
| | | | | The previous if conditional branch would have been taken in case this condition would be true,
* Hashtable: use more distinct typename for key typeChristian Göttsche2021-01-061-1/+1
|
* XUtils: check for multiplication overflow in allocation sizeChristian Göttsche2021-01-021-2/+2
|
* Only initialize and gather delay accounting data if a related column is enabledChristian Göttsche2021-01-011-12/+21
| | | | | Avoid creating and communicating over a netlink socket by default, which triggers cap_net_admin checks as root.
* Linux: accept clock CPU frequencyChristian Göttsche2020-12-231-1/+3
| | | | | | | | | processor : 0 cpu : POWER8 (architected), altivec supported clock : 4024.000000MHz revision : 2.0 (pvr 004d 0200) Closes: #424
* Make remaining number literals use uppercaseBenny Baumann2020-12-201-1/+1
|
* Use upper case numeric literalsChristian Göttsche2020-12-201-2/+2
| | | | See https://rules.sonarsource.com/c/RSPEC-818
* Handle absence of package CPU temperatureChristian Göttsche2020-12-141-36/+1
| | | | Resolves: #389
* Harden the extraction of boot time for the Linux platformNathan Scott2020-12-141-12/+11
| | | | | | | | | There is a possible path - albeit theoretical really - through the btime initialization code in Linux ProcessList_new(), when String_startsWith() is always false, which can result in btime not being initialized. This commit refactors the code to remove that possibility.
* Cleanup initialization of jiffies on the Linux platformNathan Scott2020-12-141-15/+15
| | | | | | | | | | 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
* Simplify initialization of the Linux haveSmapsRollup variableNathan Scott2020-12-141-8/+2
|
* Define O_PATH if not already definedChris Burr2020-12-131-0/+6
|
* Cull the definitions of pageSize and pageSizeKB from CRT.cNathan Scott2020-12-101-2/+11
| | | | | | | | | | | | | | | 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.
* IWYU updateChristian Göttsche2020-12-061-3/+2
|
* Initialize buffer for retrieved pathBenny Baumann2020-12-061-1/+2
| | | | | | This avoids a warning on GCC 11. Fixes #369
* LinuxProcessList: add underscore suffix for raw struct nameChristian Göttsche2020-12-051-1/+1
| | | | Fit the general coding style
* Linux: avoid float division by 0 after system sleepChristian Göttsche2020-12-031-2/+3
| | | | | linux/LinuxProcessList.c:1403:63: runtime error: division by zero SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:1403:63 in
* Add Linux cwd process columnChristian Göttsche2020-12-031-0/+29
|
* Dynamically load libsensors at runtimeChristian Göttsche2020-12-021-40/+6
|
* Add xReadfile wrapper for reading small to medium size filesChristian Göttsche2020-12-021-77/+16
| | | | | | Inspired by proposed Linux syscall Avoid file descriptor leaks like 4af8c63f
* Use String_eq for readability and consistencyChristian Göttsche2020-12-021-3/+3
|
* Add cast to unsigned char to avoid signed char misuseChristian Göttsche2020-12-021-1/+1
|
* Merge identical conditional branchesChristian Göttsche2020-12-021-3/+1
|
* Linux: fix process parsing for hidden pid directoriesChristian Göttsche2020-11-291-2/+2
|
* Fix reading of device nodes > 2 chars from memory mapsDaniel Lange2020-11-281-4/+4
|

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