System.Diagnostics.TStopwatch

Aus RAD Studio API Documentation
Wechseln zu: Navigation, Suche

Delphi

  TStopwatch = record
  strict private
    class var FFrequency: Int64;
    class var FIsHighResolution: Boolean;
    class var TickFrequency: Double;
  strict private
    FElapsed: Int64;
    FRunning: Boolean;
    FStartTimeStamp: Int64;
    function GetElapsed: TTimeSpan;
    function GetElapsedDateTimeTicks: Int64;
    function GetElapsedMilliseconds: Int64;
    function GetElapsedTicks: Int64;
    class procedure InitStopwatchType; static;
  public
    class function Create: TStopwatch; static;
    class function GetTimeStamp: Int64; static;
    procedure Reset;
    procedure Start;
    class function StartNew: TStopwatch; static;
    procedure Stop;
    property Elapsed: TTimeSpan read GetElapsed;
    property ElapsedMilliseconds: Int64 read GetElapsedMilliseconds;
    property ElapsedTicks: Int64 read GetElapsedTicks;
    class property Frequency: Int64 read FFrequency;
    class property IsHighResolution: Boolean read FIsHighResolution;
    property IsRunning: Boolean read FRunning;
  end;

C++

struct DECLSPEC_DRECORD TStopwatch
{
private:
    static __int64 FFrequency;
    static bool FIsHighResolution;
    static double TickFrequency;
    __int64 FElapsed;
    bool FRunning;
    __int64 FStartTimeStamp;
    System::Timespan::TTimeSpan __fastcall GetElapsed(void);
    __int64 __fastcall GetElapsedDateTimeTicks(void);
    __int64 __fastcall GetElapsedMilliseconds(void);
    __int64 __fastcall GetElapsedTicks(void);
    static void __fastcall InitStopwatchType();
public:
    static TStopwatch __fastcall Create();
    static __int64 __fastcall GetTimeStamp();
    void __fastcall Reset(void);
    void __fastcall Start(void);
    static TStopwatch __fastcall StartNew();
    void __fastcall Stop(void);
    __property System::Timespan::TTimeSpan Elapsed = {read=GetElapsed};
    __property __int64 ElapsedMilliseconds = {read=GetElapsedMilliseconds};
    __property __int64 ElapsedTicks = {read=GetElapsedTicks};
    /* static */ __property __int64 Frequency = {read=FFrequency};
    /* static */ __property bool IsHighResolution = {read=FIsHighResolution};
    __property bool IsRunning = {read=FRunning};
};

Eigenschaften

Typ Sichtbarkeit Quelle Unit Übergeordnet
record
struct
public
System.Diagnostics.pas
System.Diagnostics.hpp
System.Diagnostics System.Diagnostics

Beschreibung

Stellt eine hochauflösende Stoppuhrimplementierung bereit.

Mit TStopwatch greifen Sie auf hochauflösende Zeitgeber zu, mit welchen die zur Durchführung bestimmter Operationen benötigte Zeit überwacht werden kann. TStopwatch verwendet betriebssystemabhängige Funktionen für den Zugriff auf hochauflösende Zeitgeber (sofern verfügbar); ansonsten werden gewöhnliche Zeitgeber verwendet.

TStopwatch ist keine Klasse, benötigt aber trotzdem eine explizite Initialisierung. Mit den Methoden StartNew oder Create initialisieren Sie einen TStopwatch-Wert.

Siehe auch