怎样获得cpu占用率,资源占用率,内存访问速度,硬盘访问速度, 网络访问速度(200分)

  • 主题发起人 主题发起人 Jetshot
  • 开始时间 开始时间
J

Jetshot

Unregistered / Unconfirmed
GUEST, unregistred user!
急!!!
谢谢能给于得到的方法!
 
我有cpu占用率,资源占用率的源码,还要找找:)
 
谢谢你,我有急用!!
 
var
driver:pchar;
sec1, byt1, cl1, cl2:longword;
begin
driver:='c:/';//要显示的驱动器名
GetDiskFreeSpace(driver, sec1, byt1, cl1, cl2);
cl1 := cl1 * sec1 * byt1;
cl2 := cl2 * sec1 * byt1;
Label1.Caption := '该驱动器总共容量' +
Formatfloat('###,##0',cl2) + '字节';
Label2.Caption := '该驱动器可用容量' +
Formatfloat('###,##0',cl1) + '字节';
end;
 
在Windows单元中有你要的函数,另外研究一下DELPHI的库很能提高你的水平
 
DFFDSAFDASDFSADF
 
内存信息
Structure of TMemoryStatus:
TMemoryStatus = record
dwLength: DWORD;
dwMemoryLoad: DWORD;
dwTotalPhys: DWORD;
dwAvailPhys: DWORD;
dwTotalPageFile: DWORD;
dwAvailPageFile: DWORD;
dwTotalVirtual: DWORD;
dwAvailVirtual: DWORD;
Function called to populate TMemoryStatus:
procedure GlobalMemoryStatus(var lpBuffer: TMemoryStatus);
stdcall;
WINAPI help for said function:
VOID GlobalMemoryStatus(
// pointer to the memory status structure
LPMEMORYSTATUS lpBuffer
);

Code for populating a TMemo with Information about system resources:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
MemoryStatus: TMemoryStatus;
begin

Memo1.Lines.Clear;
MemoryStatus.dwLength := SizeOf(MemoryStatus);
GlobalMemoryStatus(MemoryStatus);
with MemoryStatusdo
begin
// Size of MemoryStatus record
Memo1.Lines.Add(IntToStr(dwLength) +
' Size of ''MemoryStatus'' record');
// Per-Cent of Memory in use by your system
Memo1.Lines.Add(IntToStr(dwMemoryLoad) +
'% memory in use');
// The amount of Total Physical memory allocated to your system.
Memo1.Lines.Add(IntToStr(dwTotalPhys) +
' Total Physical Memory in bytes');
// The amount available of physical memory in your system.
Memo1.Lines.Add(IntToStr(dwAvailPhys) +
' Available Physical Memory in bytes');
// The amount of Total Bytes allocated to your page file.
Memo1.Lines.Add(IntToStr(dwTotalPageFile) +
' Total Bytes of Paging File');
// The amount of available bytes in your page file.
Memo1.Lines.Add(IntToStr(dwAvailPageFile) +
' Available bytes in paging file');
// The amount of Total bytes allocated to this program
// (generally 2 gigabytes of virtual space).
Memo1.Lines.Add(IntToStr(dwTotalVirtual) +
' User Bytes of Address space');
// The amount of avalable bytes that is left to your program to use.
Memo1.Lines.Add(IntToStr(dwAvailVirtual) +
' Available User bytes of address space');
end;
// with
end;
// procedure
end.

 
其实还是不够的!
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
768
import
I
后退
顶部