Author Topic: CPU Meter  (Read 7200 times)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1987
    • zapsolution
CPU Meter
« on: April 04, 2020, 04:39:40 pm »
CPU Meter widget

 

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.


« Last Edit: April 04, 2020, 07:33:48 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1987
    • zapsolution
Re: CPU Meter
« Reply #1 on: July 08, 2024, 06:16:49 pm »
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.

« Last Edit: July 08, 2024, 07:14:48 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)