Утилита диагностики компьютера
Рефераты >> Программирование и компьютеры >> Утилита диагностики компьютера

// it is 16 byte aligned !!!

nop

nop

nop

nop

nop

nop

end;

function TProcessorClockCounter.GetClock: Int64; register;

asm

push edx

push ebx

push eax

mov ebx,eax

xor eax,eax // EAX & EDX are initialized to zero for

mov edx,eax // testing counter support

DW $310f // This instruction will make exception

sub eax,dword ptr [ebx+FStartValue] // or do nothing on processors wthout

sbb edx,dword ptr [ebx+FStartValue+4] // counter support

sub eax,dword ptr [ebx+FCalibration]

sbb edx,dword ptr [ebx+FCalibration+4]

mov dword ptr [esp + $10],eax

mov dword ptr [esp + $14],edx

pop eax

pop ebx

pop edx

ret

end;

procedure TProcessorClockCounter.PrecizeStartInCache; register;

asm

//this address should be 16 byte aligned

push edx

push ebx

push eax

mov ebx,eax

push eax

mov dword ptr [ebx + FStarted],1 // started:=true

DW $310f //START

mov dword ptr [ebx + FStartValue],eax // startvalue:=counter

mov dword ptr [ebx + FStartValue + 4],edx

mov edx,[ebx + FPrecizeProc + 4] //time equvialent

mov ebx,ebx

nop

nop

nop

call ProcedureWithoutInstruction // call procedure with immediate back

DW $310f //STOP

mov dword ptr [ebx + FStopValue],eax // stopvalue:=counter

mov dword ptr [ebx + FStopValue + 4],edx

sub eax,dword ptr [ebx + FStartValue]

sbb edx,dword ptr [ebx + FStartValue + 4]

mov dword ptr [ebx + FPrecizeCalibration],eax // calibration:=stopvalue - startvalue

mov dword ptr [ebx + FPrecizeCalibration + 4],edx

nop // need for proper align !!!

nop

nop

nop

nop

nop

nop

nop

nop

nop

nop

nop

DW $310f //START

mov dword ptr [ebx + FStartValue],eax // startvalue:=counter

mov dword ptr [ebx + FStartValue + 4],edx

mov eax,[ebx + FPrecizeProc + 4]

mov edx,ebx

call [ebx + FPrecizeProc]

DW $310f //STOP

pop ebx

mov dword ptr [ebx + FStopValue],eax // stopvalue:=counter

mov dword ptr [ebx + FStopValue + 4],edx

sub eax,dword ptr [ebx + FStartValue]

sbb edx,dword ptr [ebx + FStartValue + 4]

sub eax,dword ptr [ebx + FPrecizeCalibration]

sbb edx,dword ptr [ebx + FPrecizeCalibration + 4]

mov dword ptr [ebx + FDeltaValue],eax // deltavalue:=stopvalue - startvalue - calibration

mov dword ptr [ebx + FDeltaValue + 4],edx

pop eax

pop ebx

pop edx

ret

nop

nop

nop

nop

nop

nop

nop

nop

nop

nop

nop

nop

end;

procedure TProcessorClockCounter.PrecizeStart; register;

asm

//this address should be 16 byte aligned

push edx

push ebx

push eax

call EraseCache // fill cache with NOPs while executing it

mov ebx,eax

push eax

mov dword ptr [ebx + FStarted],1 // started:=true

nop // need for proper align

nop

nop

nop

nop

nop

nop

nop

nop

nop

nop

DW $310f //START

mov dword ptr [ebx + FStartValue],eax // startvalue:=counter

mov dword ptr [ebx + FStartValue + 4],edx

mov edx,[ebx + FPrecizeProc + 4] //time equvivalent

mov ebx,ebx

nop

nop

nop

call ProcedureWithoutInstruction // call procedure with immediate back

DW $310f //STOP

mov dword ptr [ebx + FStopValue],eax // stopvalue:=counter

mov dword ptr [ebx + FStopValue + 4],edx

sub eax,dword ptr [ebx + FStartValue]

sbb edx,dword ptr [ebx + FStartValue + 4]

mov dword ptr [ebx + FPrecizeCalibration],eax // calibration:=stopvalue - startvalue

mov dword ptr [ebx + FPrecizeCalibration + 4],edx

mov eax,ebx

call EraseCache; // fill cache with NOPs while executing it

nop // need for proper align !!!

nop

nop

nop

nop

DW $310f //START

mov dword ptr [ebx + FStartValue],eax // startvalue:=counter

mov dword ptr [ebx + FStartValue + 4],edx

mov eax,[ebx + FPrecizeProc + 4]

mov edx,ebx

call [ebx + FPrecizeProc]

DW $310f //STOP

pop ebx

mov dword ptr [ebx + FStopValue],eax // stopvalue:=counter

mov dword ptr [ebx + FStopValue + 4],edx

sub eax,dword ptr [ebx + FStartValue]

sbb edx,dword ptr [ebx + FStartValue + 4]

sub eax,dword ptr [ebx + FPrecizeCalibration]

sbb edx,dword ptr [ebx + FPrecizeCalibration + 4]

mov dword ptr [ebx + FDeltaValue],eax // deltavalue:=stopvalue - startvalue - calibration

mov dword ptr [ebx + FDeltaValue + 4],edx

pop eax

pop ebx

pop edx

end;

end.

//модуль диагностики

unit Systeminfo;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,

Dialogs,extctrls;

type TDialupAdapterInfo = record //Информация о Dialup адаптере

alignment:dword;

buffer:dword;

bytesrecieved:dword;

bytesXmit:dword;

ConnectSpeed:dword;

CRC:dword;

framesrecieved:dword;

FramesXmit:dword;

Framing:dword;

runts:dword;

Overrun:dword;

timeout:dword;

totalbytesrecieved:dword;

totalbytesXmit:dword;

end;

type TKernelInfo = record

CpuUsagePcnt:dword;

Numthreads:dword;

NumVMS:dword;

end;

type TFATInfo = record

BreadsSec:dword;

BwritesSec:dword;

Dirtydata:dword;

ReadsSec:dword;

WritesSec:dword;

end;

type TVMMInfo = record

CDiscards:dword;

CInstancefaults:dword;

CPageFaults:dword;

cPageIns:dword;

cPageOuts:dword;

cpgCommit:dword;

cpgDiskCache:dword;

cpgDiskCacheMac:dword;

cpgDiskCacheMid:dword;

cpgDiskCacheMin:dword;

cpgfree:dword;

cpglocked:dword;

cpglockedNoncache:dword;

cpgother:dword;

cpgsharedpages:dword;

cpgswap:dword;

cpgswapfile:dword;

cpgswapfiledefective:dword;

cpgswapfileinuse:dword;

end;

type

TSysInfo = class(TComponent)

private

fDialupAdapterInfo:TDialupAdapterInfo;

fKernelInfo:TKernelInfo;

fVCACHEInfo:TVCACHEInfo;

fFATInfo:TFATInfo;

fVMMInfo:TVMMInfo;

ftimer:TTimer;

fupdateinterval:integer;

tmp:dword;

vsize:dword;

pkey:hkey;

regtype:pdword;

fstopped:boolean;

procedure fupdatinginfo(sender:tobject);

procedure fsetupdateinterval(aupdateinterval:integer);

protected

fsysInfoChanged:TNotifyEvent;

public

constructor Create(Aowner:Tcomponent);override;

destructor Destroy;override;

property DialupAdapterInfo: TDialupAdapterInfo read fDialupAdapterInfo;

property KernelInfo: TKernelInfo read fKernelInfo;

property VCACHEInfo: TVCACHEInfo read fVCACHEInfo;

property FATInfo: TFATInfo read fFATInfo;

property VMMInfo: TVMMInfo read fVMMInfo;

procedure StartRecievingInfo;

procedure StopRecievingInfo;

published

property SysInfoChanged:TNotifyEvent read fsysInfoChanged write

fsysInfoChanged;//Это событие вызывается после определённого интервала времени.

property UpdateInterval:integer read fupdateInterval write


Страница: