summaryrefslogtreecommitdiffstats
path: root/CPUMeter.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
|\
| * fixed x/y coordinate mixupChristoph Budziszewski2020-06-121-3/+4
| |
| * adding support for more than 2 smaller cpumeter columnsChristoph Budziszewski2020-06-111-8/+84
| |
| * removed whitespace from end of linesChristoph Budziszewski2020-06-111-7/+7
| |
* | Merge branch 'hishamhm-pull-932'Nathan Scott2020-08-201-2/+26
|\ \
| * | Move sysfs-reading code to LinuxProcessList.c and add average frequency.Arnavion2019-08-101-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This way the frequency is read from sysfs only once per update cycle instead of every time the UI is redrawn. This also changes the code to read from /proc/cpuinfo instead. This is because reading from scaling_cur_freq stalls for 10ms if the previous read for the file was more than one second ago. [1] Since htop's update cycle is longer than that, it would cause the read of each CPU's scaling_cur_freq file to block the UI for 20ms. This easily led to a noticeable half-second lag on a 20+ CPU machine. /proc/cpuinfo also has a 10ms delay, but this applies for the whole file so the delay does not scale with the number of CPUs. [2] [1]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=4815d3c56d1e10449a44089a47544d9ba84fad0d [2]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7d5905dc14a87805a59f3c5bf70173aac2bb18f8
| * | Fix typo.Arnavion2019-08-101-1/+1
| | |
| * | Show N/A instead of 0KHz when CPU frequency is not available.Arnavion2019-08-101-9/+15
| | |
| * | Add a display option to hide CPU usage number from CPU meter.Arnavion2019-08-101-2/+8
| | |
| * | Divide by 1000, not 1024, and show more decimals.Arnavion2019-08-091-6/+6
| | |
| * | Add new display option to also show CPU frequency in CPU meters.Arnavion2019-08-091-2/+18
| |/ | | | | | | | | | | | | | | The option is only implemented on Linux. On other platforms, and on Linuxes that do not expose the relevant sysfs file, the frequency will be 0. The "CPU average" meter does not show a frequency, only the individual per-CPU meters.
* | Merge branch 'hishamhm-pull-960'Nathan Scott2020-08-201-7/+7
|\ \
| * | Clean up existing whitespaceDaniel Flanagan2019-10-311-7/+7
| |/
* | Merge branch 'hishamhm-pull-914'Nathan Scott2020-08-201-3/+3
|\ \ | |/ |/|
| * CPU_KERNEL redefinedsenjan2019-05-261-3/+3
|/
* Security review: check results of snprintf.Hisham Muhammad2017-07-271-14/+14
| | | | | Calls marked with xSnprintf shouldn't fail. Abort program cleanly if any of them does.
* Replace all uses of sprintf with snprintfTomasz Kramkowski2016-12-291-12/+12
| | | | | | | | | | | | In all the cases where sprintf was being used within htop, snprintf could have been used. This patch replaces all uses of sprintf with snprintf which makes sure that if a buffer is too small to hold the resulting string, the string is simply cut short instead of causing a buffer overflow which leads to undefined behaviour. `sizeof(variable)` was used in these cases, as opposed to `sizeof variable` which is my personal preference because `sizeof(variable)` was already used in one way or another in other parts of the code.
* Rename Meter.setValues() functions to updateValues()Explorer092016-05-041-2/+2
| | | | | | | | | | | | Rationale (copied from htop issue #471): The function name "setValues" is misleading. For most OOP (object- oriented programming) contexts, setXXX functions mean they will change some member variables of an object into something specified in function arguments. But in the *Meter_setValues() case, the new values are not from the arguments, but from a hard-coded source. The caller is not supposed to change the values[] to anything it likes, but rather to "update" the values from the source. Hence, updateValues is a better name for this family of functions.

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