Show / Hide Table of Contents

Class Duration

Representation of a duration using thread cycle time and wall clock time.

Inheritance
System.Object
Duration
Implements
System.IEquatable<Duration>
Namespace: Reaqtive.Scheduler
Assembly: Reaqtive.Scheduler.dll
Syntax
public sealed class Duration : ValueType, IEquatable<Duration>

Properties

CycleTime

Gets the thread cycle time spent.

Declaration
public long CycleTime { get; }
Property Value
Type Description
System.Int64
Remarks

This value is computed using the Win32 QueryThreadCycleTime function and includes cycles spent in user mode and in kernel mode. The measurement excludes cycles when the thread wasn't running, e.g. due to blocking or context switching. The value returned can only be used for relative measurements and comparisons with other scheduling entities. It cannot be converted to wall clock time.

ElapsedTime

Gets the elapsed wall clock time.

Declaration
public TimeSpan ElapsedTime { get; }
Property Value
Type Description
System.TimeSpan
Remarks

This value is computed using the System.Diagnostics.Stopwatch type and reports the total wall clock time spent on executing work. The measurement includes time when the thread wasn't running, e.g. due to blocking or context switching. While the value returned can be used to account for absolute values of wall clock time spent by a scheduler, it's recommended to use relative measurements and comparisons with other equal priority scheduling entities in order to distribute the cost of context switching and blocking which may be induced by the runtime environment.

TickCount

Gets the elapsed wall clock time in ticks.

Declaration
public long TickCount { get; }
Property Value
Type Description
System.Int64

Methods

Add(Duration)

Returns a Duration whose value represents the sum of the specified duration and the current value.

Declaration
public Duration Add(Duration duration)
Parameters
Type Name Description
Duration duration

The duration to add.

Returns
Type Description
Duration

A duration representing the sum of the current duration and the specified duration.

Equals(Duration)

Checks whether the current duration and the specified duration are equal.

Declaration
public bool Equals(Duration other)
Parameters
Type Name Description
Duration other

The duration to check the current duration against for equality.

Returns
Type Description
System.Boolean

true if this duration is equal to the specified duration; otherwise, false.

Equals(Object)

Checks whether the current object and the specified object are equal.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The object to check the current object against for equality.

Returns
Type Description
System.Boolean

true if this object is equal to the specified object; otherwise, false.

GetHashCode()

Gets a hash code for the current object.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

A hash code for the current object.

Subtract(Duration)

Returns a Duration whose value represents the subtraction of the specified duration and the current value.

Declaration
public Duration Subtract(Duration duration)
Parameters
Type Name Description
Duration duration

The duration to substract.

Returns
Type Description
Duration

A duration representing the subtraction of the current duration and the specified duration.

Operators

Addition(Duration, Duration)

Adds two durations using pairwise addition of timing values.

Declaration
public static Duration operator +(Duration left, Duration right)
Parameters
Type Name Description
Duration left

The first duration to add.

Duration right

The second duration to add.

Returns
Type Description
Duration

A duration representing the sum of the given durations.

Equality(Duration, Duration)

Checks whether the specified durations are equal.

Declaration
public static bool operator ==(Duration left, Duration right)
Parameters
Type Name Description
Duration left

The first duration to compare.

Duration right

The second duration to compare.

Returns
Type Description
System.Boolean

true if the durations are equal; otherwise, false.

Inequality(Duration, Duration)

Checks whether the specified durations are not equal.

Declaration
public static bool operator !=(Duration left, Duration right)
Parameters
Type Name Description
Duration left

The first duration to compare.

Duration right

The second duration to compare.

Returns
Type Description
System.Boolean

true if the durations are not equal; otherwise, false.

Subtraction(Duration, Duration)

Subtracts two durations using pairwise subtraction of timing values.

Declaration
public static Duration operator -(Duration left, Duration right)
Parameters
Type Name Description
Duration left

The first duration to subtract.

Duration right

The second duration to subtract.

Returns
Type Description
Duration

A duration representing the subtraction of the given durations.

Implements

System.IEquatable<>
In This Article
Back to top Generated by DocFX