summaryrefslogtreecommitdiffstats
path: root/CPUMeter.c
Commit message (Collapse)AuthorAgeFilesLines
* Update license headers to explicitly say GPLv2+Daniel Lange2021-09-221-1/+1
|
* Header: do not let multi-column meters expand to empty neighborsChristian Göttsche2021-09-181-0/+11
| | | | | | | | | | Extending to right neighbors is intended for text meters with an overlong content, so the whole text is shown if possible. Multi column meters, like the combined memory and swap meter, position its text depending on the given total width; keep the position to the original assigned header slot. Short term resolution for #796
* CPUMeter: use correct buffer sizeChristian Göttsche2021-09-021-2/+2
|
* IWYU updateChristian Göttsche2021-08-251-1/+0
|
* CPUMeter: show if a CPU is offline in text modeChristian Göttsche2021-08-101-1/+7
| | | | | Related to #729 as the text mode displays all zero values for offline CPUs.
* Rework CPU countingChristian Göttsche2021-07-181-9/+12
| | | | | | | | | | | Currently htop does not support offline CPUs and hot-swapping, e.g. via echo 0 > /sys/devices/system/cpu/cpu2/online Split the current single cpuCount variable into activeCPUs and existingCPUs. Supersedes: #650 Related: #580
* Add a new DynamicMeter class for runtime Meter extensionNathan Scott2021-07-071-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is based on exploratory work by Sohaib Mohamed. The end goal is two-fold - to support addition of Meters we build via configuration files for both the PCP platform and for scripts ( https://github.com/htop-dev/htop/issues/526 ) Here, we focus on generic code and the PCP support. A new class DynamicMeter is introduced - it uses the special case 'param' field handling that previously was used only by the CPUMeter, such that every runtime-configured Meter is given a unique identifier. Unlike with the CPUMeter this is used internally only. When reading/writing to htoprc instead of CPU(N) - where N is an integer param (CPU number) - we use the string name for each meter. For example, if we have a configuration for a DynamicMeter for some Redis metrics, we might read and write "Dynamic(redis)". This identifier is subsequently matched (back) up to the configuration file so we're able to re-create arbitrary user configurations. The PCP platform configuration file format is fairly simple. We expand configs from several directories, including the users homedir alongside htoprc (below htop/meters/) and also /etc/pcp/htop/meters. The format will be described via a new pcp-htop(5) man page, but its basically ini-style and each Meter has one or more metric expressions associated, as well as specifications for labels, color and so on via a dot separated notation for individual metrics within the Meter. A few initial sample configuration files are provided below ./pcp/meters that give the general idea. The PCP "derived" metric specification - see pmRegisterDerived(3) - is used as the syntax for specifying metrics in PCP DynamicMeters.
* Use RichString_appendnAscii where possibleChristian Göttsche2021-04-261-26/+28
| | | | | | | | | | `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.
* Use unsigned types for CPU counts and associated variablesChristian Göttsche2021-03-191-6/+6
|
* Merge branch 'richstring_memset' of cgzones/htopDaniel Lange2021-03-191-1/+0
|\
| * 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
* | Merge pull request #436 from cgzones/freebsdGraham Inggs2021-03-181-2/+2
|\ \ | |/ |/| | | FreeBSD: add support for CPU frequency and temperature Tested on two physical systems running FreeBSD 12.1
| * FreeBSD: add support for CPU frequency and temperatureChristian Göttsche2021-02-051-2/+2
| |
* | CPUMeter_init: compactify branchesChristian Göttsche2021-03-121-3/+3
| |
* | Separate data-update and drawing of headerChristian Göttsche2021-03-041-0/+21
| |
* | Save text buffer in MeterChristian Göttsche2021-03-041-3/+3
|/
* Mark several non-modified pointer variables constChristian Göttsche2021-01-111-2/+2
|
* CPUMeter: drop minimum width of CPU usage in bar modeChristian Göttsche2020-12-201-1/+1
| | | | | The usage percentage is the first text, no need to set a minimum width. The BarMeter does already add padding.
* Split RichString_(append|appendn|write) into wide and asciiChristian Göttsche2020-12-081-25/+25
| | | | | | | | 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 len type for Meter_UpdateValuesChristian Göttsche2020-12-061-1/+1
| | | | Most of the time the parameter is passed to snprintf type functions
* Dynamically load libsensors at runtimeChristian Göttsche2020-12-021-2/+2
|
* IWYU update (FreeBSD)Christian Goettsche2020-11-191-1/+1
|
* IWYU update (Linux)Christian Göttsche2020-11-191-0/+3
|
* Show CPU temperature in CPU meterChristian Göttsche2020-11-161-10/+45
| | | | | Show the CPU temperature in the CPU meter, like CPU frequency, instead of using an extra Meter.
* Embracing branchesBenny Baumann2020-11-021-0/+3
|
* Spacing around operatorsBenny Baumann2020-11-021-7/+7
|
* Use integer type for item count instead of charChristian Göttsche2020-10-311-2/+1
|
* Make all required includes explicitBenny Baumann2020-10-181-5/+8
| | | | Information as seen by IWYU 0.12 + clang 9 on Linux
* Rename StringUtils.[ch] to XUtils.[ch]Benny Baumann2020-10-161-1/+1
|
* Move xAsprintf, xSnprintf and xStrdup to StringUtils.hBenny Baumann2020-10-161-0/+1
|
* CPUMeter: avoid crashes and leaks in case the CPU count changesChristian Göttsche2020-10-121-19/+38
| | | | | | | E.g. if the HT/SMT mode changes Use separate data for sub-meters Do not reuse drawData for maintainability
* Mark Object pointer to _display function constChristian Göttsche2020-10-101-2/+2
|
* Mark Object instances constChristian Göttsche2020-10-071-13/+13
|
* Mark Object classes and Object class fields constChristian Göttsche2020-10-071-1/+1
|
* Update License consistently to GPLv2 as per COPYING fileDaniel Lange2020-10-051-1/+1
|
* Covert Meter attributes to file-local constant arraysChristian Göttsche2020-09-291-2/+9
|
* CPUMeter: add octuple-column CPU meters.multi2020-09-281-0/+69
| | | | | | | This is a straightforward extension of the existing multi-column CPU meter code, which now allows for up CPU meters to be displayed in up to 16 columns. This also adds the meter declarations to all the platform-specific code.
* CPUMeter: refactor common CPU meter rendering code.multi2020-09-281-65/+69
| | | | | | | | | Instead of scanning the meter name to determine the number of columns in a CPU meter, move the common code behind some wrapper functions, and specify the number of columns as an explicit parameter when called from the wrappers. While this does add a bit of code for all the necessary wrapper functions, this should be less brittle in case of future changes to the CPU meter code.
* Read CPU frequency from sysfs by defaultChristian Göttsche2020-09-241-1/+1
| | | | | | | | | Use the more portable sysfs node /sys/devices/system/cpu/cpuX/cpufreq/scaling_cur_freq to get the CPU frequency. In case of an error fall back to /proc/cpuinfo . Also use a fixed width of 4 for the frequency to avoid position jumps in case the frequency moves in the range 900-1100 MHz.
* Update CPU freq display to use NAN on errorBenny Baumann2020-09-241-1/+1
|
* Use threshold for display of guest/steal/irq metersBenny Baumann2020-09-241-3/+3
|
* align cpu id to rightChristian Hesse2020-09-241-1/+1
|
* Merge branch 'master' of https://github.com/rgouicem/htop into rgouicem-masterNathan Scott2020-09-091-7/+1
|\
| * fix unit (GHz -> MHz)Redha Gouicem2020-08-311-1/+1
| |
| * fixed compilation errorRedha Gouicem2020-08-311-1/+1
| |
| * remove unused variableRedha Gouicem2020-08-311-1/+0
| |
| * always display frequency in MHzRedha Gouicem2020-08-281-6/+1
| |
* | Consolidate repeated macro definitions into one headerNathan Scott2020-09-091-7/+0
| | | | | | | | | | | | | | | | The MIN, MAX, CLAMP, MINIMUM, and MAXIMUM macros appear throughout the codebase with many re-definitions. Make a single copy of each in a common header file, and use the BSD variants of MINIMUM/MAXIMUM due to conflicts in the system <sys/param.h> headers.
* | Axe automated header generation.Zev Weiss2020-09-031-18/+0
|/ | | | | | | | | | | | | | Reasoning: - implementation was unsound -- broke down when I added a fairly basic macro definition expanding to a struct initializer in a *.c file. - made it way too easy (e.g. via otherwise totally innocuous git commands) to end up with timestamps such that it always ran MakeHeader.py but never used its output, leading to overbuild noise when running what should be a null 'make'. - but mostly: it's just an awkward way of dealing with C code.
* Merge branch 'hishamhm-pull-1012'Nathan Scott2020-08-201-8/+85
|\

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