DotNetDupe
4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Toggle main menu visibility
Loading...
Searching...
No Matches
Stopwatch.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
Common.h
"
4
#include "
System/Object.h
"
5
#include "
System/TimeSpan.h
"
6
#include "
System/TimeProvider.h
"
7
#include "
System/SmartPointer.h
"
8
9
namespace
DotNetDupe
{
10
namespace
System
{
11
namespace
Diagnostics
{
12
using
TimeProviderPtr
=
SmartPointer<TimeProvider>
;
13
21
class
Stopwatch
:
public
Object
{
22
public
:
24
DOTNETDUPE_API
Stopwatch
();
25
28
DOTNETDUPE_API
Stopwatch
(
const
TimeProviderPtr
& timeProvider);
29
31
DOTNETDUPE_API
~Stopwatch
()
override
;
32
34
DOTNETDUPE_API
void
Start
();
35
37
DOTNETDUPE_API
void
Stop
();
38
40
DOTNETDUPE_API
void
Reset
();
41
43
DOTNETDUPE_API
void
Restart
();
44
47
DOTNETDUPE_API
bool
IsRunning
()
const
;
48
51
DOTNETDUPE_API
TimeSpan
Elapsed
()
const
;
52
55
DOTNETDUPE_API
long
long
ElapsedMilliseconds
()
const
;
56
59
DOTNETDUPE_API
long
long
ElapsedTicks
()
const
;
60
63
DOTNETDUPE_API
static
Stopwatch
StartNew
();
64
68
DOTNETDUPE_API
static
Stopwatch
StartNew
(
const
TimeProviderPtr
& timeProvider);
69
72
DOTNETDUPE_API
static
long
long
GetTimestamp
();
73
75
DOTNETDUPE_API
static
const
long
long
Frequency
;
76
78
DOTNETDUPE_API
static
const
bool
IsHighResolution
;
79
80
private
:
81
struct
Impl;
82
DotNetDupe::System::SmartPointer<Impl>
m_pImpl;
83
84
long
long
GetRawElapsedTicks()
const
;
85
};
86
}
87
}
88
}
Common.h
Defines common cross-platform macros, export decorators, and fundamental types.
DOTNETDUPE_API
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition
Common.h:20
Object.h
Base object class for DotNetDupe mirroring .NET System.Object.
SmartPointer.h
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
TimeProvider.h
Provides an abstraction for time, timestamps, and elapsed time calculation.
TimeSpan.h
Represents a time interval.
DotNetDupe::System::Diagnostics::Stopwatch::IsRunning
bool IsRunning() const
Gets a value indicating whether the Stopwatch timer is running.
Definition
Stopwatch.cpp:76
DotNetDupe::System::Diagnostics::Stopwatch::Elapsed
TimeSpan Elapsed() const
Gets the total elapsed time measured by the current instance.
Definition
Stopwatch.cpp:80
DotNetDupe::System::Diagnostics::Stopwatch::ElapsedMilliseconds
long long ElapsedMilliseconds() const
Gets the total elapsed time measured by the current instance, in milliseconds.
Definition
Stopwatch.cpp:85
DotNetDupe::System::Diagnostics::Stopwatch::ElapsedTicks
long long ElapsedTicks() const
Gets the total elapsed time measured by the current instance, in timer ticks.
Definition
Stopwatch.cpp:90
DotNetDupe::System::Diagnostics::Stopwatch::IsHighResolution
static const bool IsHighResolution
Indicates whether the timer is based on a high-resolution performance counter.
Definition
Stopwatch.h:78
DotNetDupe::System::Diagnostics::Stopwatch::Reset
void Reset()
Stops time measurement and resets the elapsed time to zero.
Definition
Stopwatch.cpp:62
DotNetDupe::System::Diagnostics::Stopwatch::StartNew
static Stopwatch StartNew()
Initializes a new Stopwatch instance, sets the elapsed time property to zero, and starts measuring el...
Definition
Stopwatch.cpp:104
DotNetDupe::System::Diagnostics::Stopwatch::Frequency
static const long long Frequency
Gets the frequency of the timer as the number of ticks per second.
Definition
Stopwatch.h:75
DotNetDupe::System::Diagnostics::Stopwatch::Restart
void Restart()
Stops time measurement, resets the elapsed time to zero, and starts measuring elapsed time.
Definition
Stopwatch.cpp:69
DotNetDupe::System::Diagnostics::Stopwatch::GetTimestamp
static long long GetTimestamp()
Gets the current number of ticks in the timer mechanism.
Definition
Stopwatch.cpp:118
DotNetDupe::System::Diagnostics::Stopwatch::Stop
void Stop()
Stops measuring elapsed time for an interval.
Definition
Stopwatch.cpp:53
DotNetDupe::System::Diagnostics::Stopwatch::~Stopwatch
~Stopwatch() override
Destructor releasing stopwatch resources.
DotNetDupe::System::Diagnostics::Stopwatch::Stopwatch
Stopwatch()
Initializes a new instance of the Stopwatch class.
Definition
Stopwatch.cpp:33
DotNetDupe::System::Diagnostics::Stopwatch::Start
void Start()
Starts, or resumes, measuring elapsed time for an interval.
Definition
Stopwatch.cpp:45
DotNetDupe::System::Object
Supports all classes in the DotNetDupe class hierarchy.
Definition
Object.h:18
DotNetDupe::System::SmartPointer
A unified smart pointer that supports both unique and shared ownership semantics.
Definition
SmartPointer.h:72
DotNetDupe::System::TimeSpan
Represents a time interval (duration of time or elapsed time) measured as a positive or negative numb...
Definition
TimeSpan.h:20
DotNetDupe::System::Diagnostics
Definition
ActiveUserSession.h:11
DotNetDupe::System::Diagnostics::TimeProviderPtr
SmartPointer< TimeProvider > TimeProviderPtr
Definition
Stopwatch.h:12
DotNetDupe::System
Definition
Action.h:11
DotNetDupe
Definition
IServiceCollection.h:7
Include
System
Diagnostics
Stopwatch.h
Generated by
1.18.0