Autor Beitrag
hui1991
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Di 23.01.07 22:33 
Hallo,

wie kann ich nachschauen wie viel KB/s auf einer Partition gelesen oder geschrieben wird?
Ist das überhaupt möglich?

MfG
hui1991
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 24.01.07 00:08 
Moin!

Mach einen Filestream auf und schreib/lies Dummy-Werte, dann noch schnell die Zeit gemessen, fertig. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 24.01.07 00:41 
Ich vermute mal, es sind die aktuellen Performance-Werte gemeint und nicht ein Benchmark... ;-)

Sieh dir hier mal "Performance Data Helper" an, das kennt diese und noch viel mehr solche Performance-Werte. Was du davon meinst ist in der Demo in der Liste "Physical Disk" und darunter unter der entsprechenden Platte "Disk Read Bytes/sec". Einfach mal doppelklicken, dann siehst du das auf der rechten Seite.
www.wilsonc.demon.co.uk/delphi3.htm
Wie ich festgestellt habe, brauchst du auf noch von weiter oben in der Liste den "Delphi 3.0/4.0 Lan Manager" um die Demo zu kompilieren.

Ach so: Ich habe es mit Delphi 2006 Professional getestet, deshalb: es geht nicht nur mit Delphi 3 und 4 ;-). Allerdings gibts ein paar Kompilierfehler, die ich halt schnell beheben musste, aber das sind nicht viele, das dauert nur ein paar Sekunden.
"absolute 0" einfach durch "= 0" ersetzen und den C++-Quelltext in der einen Datei, der nicht kompiliert werden kann, einfach auskommentieren ;-).
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Mi 24.01.07 22:31 
Danke für eure Antworten,

ich werde es morgen nach der Schule, nach den zwei Schulaufgaben dann probieren.
Ich werde dann mein Ergebniss dann hier bekannt geben sobald ich eins habe.

MfG
hui1991
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Do 25.01.07 16:45 
Also ich habe mir mal das Runtergeladen. Dann ausführen wollen, dann zeigt es mir erstmal an, dann die pdh.dcu nicht gefunden ist. Dann hab ich mir gedacht, ich Compiliere sie zu dcu. Aber ich weis nicht wie.
Wie bekomme ich da jetzt die DCU raus.
Weit kam ich auch nicht :(

MfG
hui1991
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 25.01.07 21:50 
Mit WMI kann man sich das anzeigen lassen:

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

arrComputers = Array("SIMCHA")
For Each strComputer In arrComputers
   WScript.Echo
   WScript.Echo "=========================================="
   WScript.Echo "Computer: " & strComputer
   WScript.Echo "=========================================="

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
   Set colItems = objWMIService.ExecQuery("SELECT * FROM 

Win32_PerfFormattedData_PerfDisk_PhysicalDisk", "WQL", _
                                          wbemFlagReturnImmediately + 

wbemFlagForwardOnly)

   For Each objItem In colItems
      WScript.Echo "AvgDiskBytesPerRead: " & objItem.AvgDiskBytesPerRead
      WScript.Echo "AvgDiskBytesPerTransfer: " & objItem.AvgDiskBytesPerTransfer
      WScript.Echo "AvgDiskBytesPerWrite: " & objItem.AvgDiskBytesPerWrite
      WScript.Echo "AvgDiskQueueLength: " & objItem.AvgDiskQueueLength
      WScript.Echo "AvgDiskReadQueueLength: " & objItem.AvgDiskReadQueueLength
      WScript.Echo "AvgDisksecPerRead: " & objItem.AvgDisksecPerRead
      WScript.Echo "AvgDisksecPerTransfer: " & objItem.AvgDisksecPerTransfer
      WScript.Echo "AvgDisksecPerWrite: " & objItem.AvgDisksecPerWrite
      WScript.Echo "AvgDiskWriteQueueLength: " & objItem.AvgDiskWriteQueueLength
      WScript.Echo "Caption: " & objItem.Caption
      WScript.Echo "CurrentDiskQueueLength: " & objItem.CurrentDiskQueueLength
      WScript.Echo "Description: " & objItem.Description
      WScript.Echo "DiskBytesPersec: " & objItem.DiskBytesPersec
      WScript.Echo "DiskReadBytesPersec: " & objItem.DiskReadBytesPersec
      WScript.Echo "DiskReadsPersec: " & objItem.DiskReadsPersec
      WScript.Echo "DiskTransfersPersec: " & objItem.DiskTransfersPersec
      WScript.Echo "DiskWriteBytesPersec: " & objItem.DiskWriteBytesPersec
      WScript.Echo "DiskWritesPersec: " & objItem.DiskWritesPersec
      WScript.Echo "Frequency_Object: " & objItem.Frequency_Object
      WScript.Echo "Frequency_PerfTime: " & objItem.Frequency_PerfTime
      WScript.Echo "Frequency_Sys100NS: " & objItem.Frequency_Sys100NS
      WScript.Echo "Name: " & objItem.Name
      WScript.Echo "PercentDiskReadTime: " & objItem.PercentDiskReadTime
      WScript.Echo "PercentDiskTime: " & objItem.PercentDiskTime
      WScript.Echo "PercentDiskWriteTime: " & objItem.PercentDiskWriteTime
      WScript.Echo "PercentIdleTime: " & objItem.PercentIdleTime
      WScript.Echo "SplitIOPerSec: " & objItem.SplitIOPerSec
      WScript.Echo "Timestamp_Object: " & objItem.Timestamp_Object
      WScript.Echo "Timestamp_PerfTime: " & objItem.Timestamp_PerfTime
      WScript.Echo "Timestamp_Sys100NS: " & objItem.Timestamp_Sys100NS
      WScript.Echo
   Next
Next


Moderiert von user profile iconraziel: Code-Tags hinzugefügt.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 26.01.07 08:50 
user profile iconhui1991 hat folgendes geschrieben:
Also ich habe mir mal das Runtergeladen. Dann ausführen wollen, dann zeigt es mir erstmal an, dann die pdh.dcu nicht gefunden ist. Dann hab ich mir gedacht, ich Compiliere sie zu dcu. Aber ich weis nicht wie.
Wie bekomme ich da jetzt die DCU raus.

Du fügst die .pas einfach deinem Projekt hinzu oder den Ordner deinem Suchpfad. Die Komponente hast du aber installiert?
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Fr 26.01.07 14:23 
Nein die Komponente habe ich auf der Seite nirgends gefunden :(
Hab nur so eine Datei runtergeladen.
Weis aber net weiter, was ich sonst noch machen soll.
Achso hathor, ich weis leider nicht was ich mit deinem Code anstellen los.
Das sieht nicht nach Delphi aus. Kenne mich damit nicht aus wie du das eingefügt hast aus.

MfG
hui1991
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 27.01.07 21:18 
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Sa 27.01.07 23:02 
WMI ist ja richtig schwer.
Hab dazu sogut wie garnichts gefunden.
Immer hat mir was gefehlt.
Bei jaenicke kommen dauernt Fehlermeldungen
Und das von hathor fehlen mir dateien.
Gibt es nirgends eine einfache lösung.
Oder soll ich das gleich in den Sand setzten :(

MfG
hui1991
Passi077
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 125

Win XP
D7 Pers
BeitragVerfasst: So 28.01.07 02:36 
user profile iconhui1991 hat folgendes geschrieben:
Nein die Komponente habe ich auf der Seite nirgends gefunden :(
Hab nur so eine Datei runtergeladen.
Weis aber net weiter, was ich sonst noch machen soll.

MfG
hui1991


Hier gibt's doch die fehlende Unit:
vvv.truls.org/pascal/UNITS.W32/Pdh.pas

Einfach in den selben Ordner wie das Projekt speichern, und dann neu kompilieren.
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: So 28.01.07 10:53 
Naja das habe ich ja dann hingekriegt. Blos ich hab ein anderes Beispiel gefunden.
Da steige ich, aber nicht so durch :(
Hab so ein Performance Programm gefunden. Der Zeichnet die Festplattennutzung auf.
Blos das ist viel zu groß.
Brauch das ganz klein.
Und nur die Werte.
Das ist, aber sehr schwer sich damit zu beschäftigen.
Vorallem mir fehlt da noch igendwie so eine WMI dcu zeug da noch.
Das finde ich auch nirgends.

MfG
hui1991
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 28.01.07 11:04 
Was du machen musst für WMI steht z.B. hier, da ist weiter unten ein längerer Beitrag mit Quelltext und dem Hinweis was du machen musst, damit WMI in Delphi geht:
forum.dsdt.info/view...582db472948751bc0f24
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: So 28.01.07 13:12 
Ich bin ein schritt weiter.
Habe das hier ausprobiert, aber leider ist kein Wert drin:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActiveX, WbemScripting_TLB, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  aLoc: ISWbemLocator;
  aSrv: ISWbemServices;
  aObjSet: ISWbemObjectSet;
  pEnum: IEnumVARIANT;
  vOut: OleVariant;
  dwRetrieved: LongWord;
  hRes: HResult;
  cWQL, sWQL: string;
  st: TStringList;


implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  st := TStringList.Create;
  try
    cWQL := 'select * from Win32_PerfFormattedData_PerfDisk_PhysicalDisk';
    aLoc := CoSWbemLocator.Create;
    aSrv := aLoc.ConnectServer('.', 'root\cimv2', '', '', '', '', 0, nil);
    aSrv.Security_.ImpersonationLevel := wbemImpersonationLevelImpersonate;
    aObjSet := aSrv.ExecQuery(cWQL, 'WQL', 0, nil);
    pEnum := aObjSet.Get__NewEnum as IEnumVARIANT;
    while (TRUE) do
    begin
      hRes := pEnum.Next(1, vOut, dwRetrieved);
      if hRes <> S_OK then Break;
      st.add(vOut.caption + ' mit ' + FloatToStr(vOut.AvgDiskBytesPerRead));
      st.add(vOut.caption + ' mit ' + FloatToStr(vOut.AvgDiskBytesPerTransfer));
      st.add(vOut.caption + ' mit ' + FloatToStr(vOut.AvgDiskBytesPerWrite));
      st.add(vOut.caption + ' mit ' + FloatToStr(vOut.AvgDiskQueueLength));
      st.add(vOut.caption + ' mit ' + FloatToStr(vOut.AvgDiskReadQueueLength));
      st.add(vOut.caption + ' mit ' + FloatToStr(vOut.AvgDisksecPerRead));
      st.add(vOut.caption + ' mit ' + FloatToStr(vOut.AvgDisksecPerTransfer));
      st.add(vOut.caption + ' mit ' + FloatToStr(vOut.AvgDisksecPerWrite));
    end;
    Memo1.Lines.Assign(st);
  finally
    st.free;
  end;
end;

end.


Was muss ich da ändern damit das richtig ist?

MfG
hui1991
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 31.01.07 22:46 
Es gibt verschiedene "performance data", die von WMI zur Verfügung gestellt werden (können). Leider hat MS auch hier geschludert !!!

Folgender Code liefert bei mir Daten:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ActiveX, WbemScripting_TLB, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Button3: TButton;
    Memo2: TMemo;
    procedure PerfDisk(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Button3Click(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// formatiert die strings
function ATS (const S: string): string;
var
    LS, L2, I : Integer;
    Temp : string;
begin
    result := S ;
    LS := Length (S);
    if LS <= 3 then exit ;
    L2 := (LS - 1) div 3;
    Temp := '';
    for I := 1 to L2 do
       Temp := ThousandSeparator + Copy (S, LS - 3 * I + 1, 3) + Temp;
    Result := Copy (S, 1, (LS - 1) mod 3 + 1) + Temp;
end;

function GetWMIstring (wmiHost, wmiClass, wmiProperty : string):string;
var
  Locator:  ISWbemLocator;
  Services: ISWbemServices;
  SObject:  ISWbemObject;
  ObjSet:   ISWbemObjectSet;
  SProp:    ISWbemProperty;
  Enum:     IEnumVariant;
  Value:    Cardinal;
  TempObj:  OleVariant;
  SN: string;
begin
  try
  Locator := CoSWbemLocator.Create;
  Services :=  Locator.ConnectServer(wmiHost, 'root\cimv2', '', '', '','', 0, nil);
  ObjSet := Services.ExecQuery('SELECT * FROM '+wmiClass, 'WQL',
  wbemFlagReturnImmediately and wbemFlagForwardOnly , nil);
  Enum :=  (ObjSet._NewEnum) as IEnumVariant;
  while (Enum.Next(1, TempObj, Value) = S_OK) do
  begin
    SObject := IUnknown(tempObj) as ISWBemObject;
    SProp := SObject.Properties_.Item(wmiProperty, 0);
    if VarIsNull(SProp.Get_Value) then
      result := ''
    else
    begin
      SN := SProp.Get_Value;
      result :=  SN;
    end;
  end;
  except
   on exception do
    result := '';
   end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
PerfDisk(Self);
end;

procedure TForm1.FormShow(Sender: TObject);
begin
Memo2.Clear;
end;

procedure TForm1.PerfDisk(Sender: TObject);
var wmi1,wmi11,wmi12,wmi13,wmi14,wmi15,wmi16,wmi17,wmi18 : string;
begin
//wmi1:= 'Win32_PerfFormattedData_PerfDisk_PhysicalDisk';
//Win32_PerfRawData_PerfDisk_PhysicalDisk
//Win32_PerfRawData_PerfDisk_LogicalDisk http://msdn2.microsoft.com/en-us/library/aa394307.aspx

wmi1:= 'Win32_PerfRawData_PerfDisk_LogicalDisk';

wmi11:= 'AvgDiskBytesPerRead';
wmi12:= 'AvgDiskBytesPerTransfer';
wmi13:= 'AvgDiskBytesPerWrite';
wmi14:= 'AvgDiskQueueLength';
wmi15:= 'AvgDiskReadQueueLength';
wmi16:= 'AvgDisksecPerRead';
wmi17:= 'AvgDisksecPerTransfer';
wmi18:= 'AvgDisksecPerWrite';

Memo2.Lines.Add('AvgDiskBytesPerRead : '+ATS(getWMIstring('',wmi1,wmi11)));
Memo2.Lines.Add('AvgDiskBytesPerTransfer : '+ATS(getWMIstring('',wmi1,wmi12)));
Memo2.Lines.Add('AvgDiskBytesPerWrite : '+ATS(getWMIstring('',wmi1,wmi13)));
Memo2.Lines.Add('AvgDiskQueueLength : '+ATS(getWMIstring('',wmi1,wmi14)));
Memo2.Lines.Add('AvgDiskReadQueueLength : '+ATS(getWMIstring('',wmi1,wmi15)));
Memo2.Lines.Add('AvgDisksecPerRead : '+ATS(getWMIstring('',wmi1,wmi16)));
Memo2.Lines.Add('AvgDisksecPerTransfer : '+ATS(getWMIstring('',wmi1,wmi17)));
Memo2.Lines.Add('AvgDisksecPerWrite : '+ATS(getWMIstring('',wmi1,wmi18)));
Memo2.Lines.Add('*');

end;

end.
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Do 01.02.07 12:42 
Danke für deine Antwort,

ich werde es mal daheim Ausprobiern :)
Ich sag, dann ob es geht oder nicht ^^
Es funktioniert, das mit den BytesProSekunden aber net, man sieht aber wie viel Bytes schon gelesen wurden ^^
Daraus kann man auch Bytes pro Sekunde berechnen ^^

MfG
hui1991