ObjReader Community
Tips & Tricks => Tips & Tricks => Topic started by: Patrice Terrier on April 04, 2020, 04:39:40 pm
-
CPU Meter widget
(http://www.objreader.com/download/images/CPU_Meter.jpg)
Is available for:- PowerBASIC 32-bit
- C++ 64-bit
- WinDev WD17+
Complete source code is provided in the attachment, you must be registered to see it and download the zip files.
The WD17+ version is available from the repository here. (https://repository.windev.com/resource.awp?file_id=281474976710913;cpu-meter)
-
This is version 2.00.
It has been reworked to match the CPU processor percentage computation used in Windows 11.
On previous Windows 10, they were using "Processor(_Total)\\% Processor Time"
The solution is to use PDH (Performance Data Helper) and the Processor Utility request
nStatus = PdhAddEnglishCounter(cpuQuery, L"\\Processor Information(_Total)\\% Processor Utility", NULL, &cpuTotal);
\\Processor Information(_Total)\\% Processor Utility
- Description: This counter measures the percentage of processor utility across all processors.
- Utility: It provides a more detailed and modern view of processor usage, taking into account various factors like the efficiency of processing and modern CPU architectures.
- Availability: This counter is generally available on newer systems with modern processors. It can give a more accurate representation of CPU utilization in multi-core and hyper-threaded environments.
\\Processor(_Total)\\% Processor Time
- Description: This counter measures the percentage of time the processor is busy executing a non-idle thread.
- Utility: It is a more traditional counter that has been available in Windows for a long time. It reflects the CPU load by measuring the active time versus the idle time of the CPU.
- Availability: This counter is widely available across different versions of Windows and provides a consistent measure of CPU usage.
Note:
The project use TCLib.lib to produce a tiny 29 Kb binary executable.