Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Auslastung in Progressbar/gauge (https://www.delphipraxis.net/52842-auslastung-progressbar-gauge.html)

150gozilla 5. Sep 2005 11:46


Auslastung in Progressbar/gauge
 
Hallo :) liebe user
1)
Ich habe folgendes Problem und zwar habe ich bis jetzt so gemacht das meine RAM(Speicher)auslastung in einer Progressbar angezeigt wird.
Ich brauche dafür nur einen Timer und eine Progressbar
Delphi-Quellcode:
procedure TForm1.Timer2Timer(Sender: TObject);
var
  x, y : real;
  memory: TMemoryStatus;
  Auslastung: integer;
begin
  memory.dwLength := SizeOf(memory);
  GlobalMemoryStatus(memory);
  x := memory.dwTotalPhys - memory.dwAvailPhys;
  y := memory.dwTotalPhys;
  Auslastung := round(((x/y)*100));
  progressbar1.Position := Auslastung;
end;
Das kommt natürlich alles in den timer.
Ist es möglich diesen wert in eine gauge umzuschreiben?


2)
Gibts auch eine möglichkeit die CPU auslastung auszulesen ?

Luckie 5. Sep 2005 11:49

Re: Auslastung in Progressbar/gauge
 
1.) Ja. Nimm einfach eein Gauge.
2.) Ja. Benutz dazu bitte die Forensuche.
3.) Bitte erstell in Zukunft für eine neue Frage auch einen neuen Thread. Danke.

Neutral General 5. Sep 2005 11:50

Re: Auslastung in Progressbar/gauge
 
Du schreibst einfach statt

Delphi-Quellcode:
Progressbar1.Position
Delphi-Quellcode:
Gauge1.Progress
Falls die Auslastung ein Integer zwischen 0 und 100 ist ists doch Ideal und einfach.

150gozilla 5. Sep 2005 11:51

Re: Auslastung in Progressbar/gauge
 
Zitat:

Zitat von Luckie
1.) Ja. Nimm einfach eein Gauge.
2.) Ja. Benutz dazu bitte die Forensuche.
3.) Bitte erstell in Zukunft für eine neue Frage auch einen neuen Thread. Danke.

zu 2)
Ich habe leider nix passendes gefunden.

zu 1)

Wenn ich progressbar1.position mit gauge1.position tausche kommt ne fehlermeldung

zur 3) Es gibt viele threads wo nebenbei eine zweite zum passenden thema frage gestellt wird.


\\ edit: danke an Neutral General

Luckie 5. Sep 2005 12:11

Re: Auslastung in Progressbar/gauge
 
Zitat:

Zitat von 150gozilla
zu 2)
Ich habe leider nix passendes gefunden.

Hm: Hier im Forum suchencpu auslastung: 96 Ergebnisse, da wird ja wohl was dabei sein.

Zitat:

zur 3) Es gibt viele threads wo nebenbei eine zweite zum passenden thema frage gestellt wird.
Was hat die CPU Auslastung mit der Benutzung einer Progressbar / Gauge zu tun?

turboPASCAL 5. Sep 2005 12:15

Re: Auslastung in Progressbar/gauge
 
Bitteschön:

Delphi-Quellcode:
procedure TForm1.Timer2Timer(Sender: TObject);
var
  x, y : real;
  memory: TMemoryStatus;
  Auslastung: integer;
begin
  memory.dwLength := SizeOf(memory);
  GlobalMemoryStatus(memory);
  x := memory.dwTotalPhys - memory.dwAvailPhys;
  y := memory.dwTotalPhys;
  Auslastung := round(((x/y)*100));
 
  // Memmory
  Gauge1.Progress := Auslastung;

  // CPU
  Gauge2.Progress := GetCPUUsage;
end;
Das sollte so funktionieren ...

GetCPUUsage gibt es bei den Schweizern (Direcktlink).

Oder: Hier im Forum suchenGetCPUUsage


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:58 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