Provides a set of methods and properties that you can use to accurately measure elapsed time.
Constructors | |
stopwatch ()=default | |
Initializes a new instance of the xtd::diagnostics::stopwatch class. More... | |
Properties | |
time_span | elapsed () const noexcept |
Gets the total elapsed time measured by the current instance. More... | |
int64 | elapsed_milliseconds () const noexcept |
Gets the total elapsed time measured by the current instance, in milliseconds. More... | |
int64 | elapsed_nanoseconds () const noexcept |
Gets the total elapsed time measured by the current instance, in nanoseconds. More... | |
int64 | elapsed_ticks () const noexcept |
Gets the total elapsed time measured by the current instance, in timer ticks. More... | |
bool | is_running () const noexcept |
Gets a value indicating whether the stopwatch timer is running. More... | |
static int64 | frequency () noexcept |
Gets the frequency of the timer as the number of nanoseconds per second. This field is read-only. More... | |
static bool | is_high_resolution () noexcept |
Indicates whether the timer is based on a high-resolution performance counter. This field is read-only. More... | |
Methods | |
void | reset () noexcept |
Stops time interval measurement and resets the elapsed time to zero. More... | |
void | restart () noexcept |
stops time interval measurement, resets the elapsed time to zero, and starts measuring elapsed time. More... | |
void | start () noexcept |
Starts, or resumes, measuring elapsed time for an interval. More... | |
void | stop () noexcept |
Stops measuring elapsed time for an interval. More... | |
static std::chrono::nanoseconds | get_timestamp () noexcept |
Gets the current number of nanoseconds in the timer mechanism. More... | |
static int64 | get_timestamp_milliseconds () noexcept |
Gets the current number of nanoseconds in the timer mechanism, in milliseconds. More... | |
static int64 | get_timestamp_nanoseconds () noexcept |
Gets the current number of nanoseconds in the timer mechanism, in nanoseconds. More... | |
static int64 | get_timestamp_ticks () noexcept |
Gets the current number of nanoseconds in the timer mechanism, in ticks. More... | |
static stopwatch | start_new () noexcept |
Initializes a new xtd::diagnostics::stopwatch instance, sets the xtd::diagnostics::stopwatch::elapsed time property to zero, and starts measuring elapsed time. More... | |
Additional Inherited Members | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. More... | |
bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. More... | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. More... | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. More... | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const noexcept |
Creates a shallow copy of the current object. More... | |
virtual xtd::ustring | to_string () const noexcept |
Returns a sxd::ustring that represents the current object. More... | |
Static Public Member Functions inherited from xtd::object | |
static bool | equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are considered equal. More... | |
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are the same instance. More... | |
|
default |
Initializes a new instance of the xtd::diagnostics::stopwatch class.
|
noexcept |
Gets the total elapsed time measured by the current instance.
|
noexcept |
Gets the total elapsed time measured by the current instance, in milliseconds.
|
noexcept |
Gets the total elapsed time measured by the current instance, in nanoseconds.
|
noexcept |
Gets the total elapsed time measured by the current instance, in timer ticks.
|
staticnoexcept |
Gets the frequency of the timer as the number of nanoseconds per second. This field is read-only.
|
staticnoexcept |
Gets the current number of nanoseconds in the timer mechanism.
|
staticnoexcept |
Gets the current number of nanoseconds in the timer mechanism, in milliseconds.
|
staticnoexcept |
Gets the current number of nanoseconds in the timer mechanism, in nanoseconds.
|
staticnoexcept |
Gets the current number of nanoseconds in the timer mechanism, in ticks.
|
staticnoexcept |
Indicates whether the timer is based on a high-resolution performance counter. This field is read-only.
|
noexcept |
Gets a value indicating whether the stopwatch timer is running.
|
noexcept |
Stops time interval measurement and resets the elapsed time to zero.
|
noexcept |
stops time interval measurement, resets the elapsed time to zero, and starts measuring elapsed time.
|
noexcept |
Starts, or resumes, measuring elapsed time for an interval.
|
staticnoexcept |
Initializes a new xtd::diagnostics::stopwatch instance, sets the xtd::diagnostics::stopwatch::elapsed time property to zero, and starts measuring elapsed time.
|
noexcept |
Stops measuring elapsed time for an interval.