RSS    

   Ðåôåðàò: Óòèëèòà äèàãíîñòèêè êîìïüþòåðà

  REALTIME_PRIORITY_CLASS: FClockPriority:=cpRealTime;

 end;

end;

procedure TProcessorClockCounter.SetClockPriority(Value: TClockPriority);

begin

 if Value<>FClockPriority then

  begin

   FClockPriority:=Value;

   case FClockPriority of

    cpIdle:    begin

               FDesiredProcessPriority:=IDLE_PRIORITY_CLASS;

               FDesiredThreadPriority :=THREAD_PRIORITY_IDLE;

               end;

    cpNormal:  begin

               FDesiredProcessPriority:=NORMAL_PRIORITY_CLASS;

               FDesiredThreadPriority :=THREAD_PRIORITY_NORMAL;

               end;

    cpHigh:    begin

               FDesiredProcessPriority:=HIGH_PRIORITY_CLASS;

               FDesiredThreadPriority :=THREAD_PRIORITY_HIGHEST;

               end;

    cpRealTime:begin

               FDesiredProcessPriority:=REALTIME_PRIORITY_CLASS;

               FDesiredThreadPriority :=THREAD_PRIORITY_TIME_CRITICAL;

               end;

    cpProcessDefined:

               begin

               FDesiredProcessPriority:=FCurrentProcessPriority;

               FDesiredThreadPriority :=FCurrentThreadPriority;

               end;

   end;

   Calibrate;

  end;

end;

procedure TProcessorClockCounter.TestPrecizeProc;

// This procedure is intended for testing small block of

// code when it must be put in the processor cache

begin

FDeltaValue:=0;

if FCounterSupported and assigned(FPrecizeProc) then

 begin

 PrecizeStart;                     // start test

 end;

end;

procedure TProcessorClockCounter.TestPrecizeProcInCache;

// This procedure is intended for testing small block of

// code when it is already in the processor cache

begin

FDeltaValue:=0;

if FCounterSupported and  assigned(FPrecizeProc) then

 begin

 EraseCache;

 PrecizeStartInCache;              // first test will fill processor cache

 PrecizeStartInCache;              // second test

                                   // generate calibration value for

                                   // code already put in the cache

 end;

end;

procedure TProcessorClockCounter.ProcedureWithoutInstruction;

// this is used for calibration! DO NOT CHANGE

asm

 ret

end;

procedure TProcessorClockCounter.EraseCache; register;

asm

  push ebx

  lea ebx,[eax + FCache]

  call ebx               // force call to code in array :)

  pop ebx                // this will fill level2 cache with NOPs (For motherboards with 1 Mb level 2 cache,

  ret                    // size of array should be increased to 1 Mb)

 // next instructions are never executed but need for proper align of 16 byte.

 // Some processors has different execution times when code is not 16 byte aligned

 // Actually, (on some processors), internal mechanism of level 1 cache (cache built

 // in processor) filling is designed to catch memory block faster, when

 // 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;

Ñòðàíèöû: 1, 2, 3, 4, 5, 6, 7, 8


Íîâîñòè


Áûñòðûé ïîèñê

Ãðóïïà âÊîíòàêòå: íîâîñòè

Ïîêà íåò

Íîâîñòè â Twitter è Facebook

                   

Íîâîñòè

© 2010.