summaryrefslogtreecommitdiffstats
path: root/CPUMeter.c
AgeCommit message (Collapse)Author
2020-12-02Dynamically load libsensors at runtimeChristian Göttsche
2020-11-19IWYU update (FreeBSD)Christian Goettsche
2020-11-19IWYU update (Linux)Christian Göttsche
2020-11-16Show CPU temperature in CPU meterChristian Göttsche
Show the CPU temperature in the CPU meter, like CPU frequency, instead of using an extra Meter.
2020-11-02Embracing branchesBenny Baumann
2020-11-02Spacing around operatorsBenny Baumann
2020-10-31Use integer type for item count instead of charChristian Göttsche
2020-10-18Make all required includes explicitBenny Baumann
Information as seen by IWYU 0.12 + clang 9 on Linux
2020-10-16Rename StringUtils.[ch] to XUtils.[ch]Benny Baumann
2020-10-16Move xAsprintf, xSnprintf and xStrdup to StringUtils.hBenny Baumann
2020-10-12CPUMeter: avoid crashes and leaks in case the CPU count changesChristian Göttsche
E.g. if the HT/SMT mode changes Use separate data for sub-meters Do not reuse drawData for maintainability
2020-10-10Mark Object pointer to _display function constChristian Göttsche
2020-10-07Mark Object instances constChristian Göttsche
2020-10-07Mark Object classes and Object class fields constChristian Göttsche
2020-10-05Update License consistently to GPLv2 as per COPYING fileDaniel Lange
2020-09-29Covert Meter attributes to file-local constant arraysChristian Göttsche
2020-09-28CPUMeter: add octuple-column CPU meters.multi
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.
2020-09-28CPUMeter: refactor common CPU meter rendering code.multi
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.
2020-09-24Read CPU frequency from sysfs by defaultChristian Göttsche
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.
2020-09-24Update CPU freq display to use NAN on errorBenny Baumann
2020-09-24Use threshold for display of guest/steal/irq metersBenny Baumann
2020-09-24align cpu id to rightChristian Hesse
2020-09-09Merge branch 'master' of https://github.com/rgouicem/htop into rgouicem-masterNathan Scott
2020-09-09Consolidate repeated macro definitions into one headerNathan Scott
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.
2020-09-03Axe automated header generation.Zev Weiss
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.
2020-08-31fix unit (GHz -> MHz)Redha Gouicem
2020-08-31fixed compilation errorRedha Gouicem
2020-08-31remove unused variableRedha Gouicem
2020-08-28always display frequency in MHzRedha Gouicem
2020-08-20Merge branch 'hishamhm-pull-1012'Nathan Scott
2020-08-20Merge branch 'hishamhm-pull-932'Nathan Scott
2020-08-20Merge branch 'hishamhm-pull-960'Nathan Scott
2020-08-20Merge branch 'hishamhm-pull-914'Nathan Scott
2020-06-12fixed x/y coordinate mixupChristoph Budziszewski
2020-06-11adding support for more than 2 smaller cpumeter columnsChristoph Budziszewski
2020-06-11removed whitespace from end of linesChristoph Budziszewski
2019-10-31Clean up existing whitespaceDaniel Flanagan
2019-08-10Move sysfs-reading code to LinuxProcessList.c and add average frequency.Arnavion
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
2019-08-10Fix typo.Arnavion
2019-08-10Show N/A instead of 0KHz when CPU frequency is not available.Arnavion
2019-08-10Add a display option to hide CPU usage number from CPU meter.Arnavion
2019-08-09Divide by 1000, not 1024, and show more decimals.Arnavion
2019-08-09Add new display option to also show CPU frequency in CPU meters.Arnavion
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.
2019-05-26CPU_KERNEL redefinedsenjan
2017-07-27Security review: check results of snprintf.Hisham Muhammad
Calls marked with xSnprintf shouldn't fail. Abort program cleanly if any of them does.
2016-12-29Replace all uses of sprintf with snprintfTomasz Kramkowski
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.
2016-05-04Rename Meter.setValues() functions to updateValues()Explorer09
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.
2016-03-11Explicit "maxItems" property of metersExplorer09
Two changes in this commit: - All meters now explicitly specify "maxItems" property, even for just 1 item. (Exception is "container" CPU meter classes, which use CUSTOM_METERMODE.) - "maxItems" being 0 is now allowed. This will let bar meters and graph meters render an empty meter.
2016-02-02Check for failure in allocations.Hisham
2015-10-23Calculate CPU averages on Darwin (See #295).Hisham Muhammad