Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   CPU Auslastung unter 64bit (https://www.delphipraxis.net/159284-cpu-auslastung-unter-64bit.html)

Shark99 22. Mär 2011 02:28

CPU Auslastung unter 64bit
 
Ich versuche einen weg zu finden CPU Auslastung unter einem 64 Bit Windows auszulesen.

Der Code soll jedoch mit aktivierten UAC funktionieren, damit fallen also Performance Counters aus, weil die App dazu Admin Rechte braucht.

Ich hab hier einen Code gefunden: http://www.swissdelphicenter.ch/de/showcode.php?id=969

Dieser funktioniert jedoch nur unter 32 Bit (getestet mit Windows 7).

Unter 64 Bit gibt es dieses Problem:

// get new CPU's idle time
status := NtQuerySystemInformation(SystemPerformanceInformat ion, @SysPerfInfo, SizeOf(SysPerfInfo), nil);
if status <> 0 then Exit;

Status liefert hier <> 0 und nach Auswertung des Fehlercodes kommt raus dass dieser record:

TSystem_Performance_Information = packed record
liIdleTime: LARGE_INTEGER; {LARGE_INTEGER}
dwSpare: array[0..75] of DWORD;
end;

eine andere Länge hat als von NtQuerySystemInformation erwartet.

Björn Ole 22. Mär 2011 02:48

AW: CPU Auslastung unter 64bit
 
Mach mal aus dieser Zeile:
Zitat:

Zitat von Shark99 (Beitrag 1090163)
dwSpare: array[0..75] of DWORD;

folgende:
Delphi-Quellcode:
dwSpare: array[0..79] of DWORD;


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:01 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz