Table of Contents

Interface ITimerHandle

Namespace
DotCompute.Abstractions.Interfaces.Telemetry
Assembly
DotCompute.Abstractions.dll

Handle for controlling an active timing operation.

public interface ITimerHandle : IDisposable
Inherited Members
Extension Methods

Properties

Elapsed

Gets the elapsed time since the operation started.

TimeSpan Elapsed { get; }

Property Value

TimeSpan

OperationId

Gets the unique identifier for this operation instance.

string OperationId { get; }

Property Value

string

OperationName

Gets the name of the operation being timed.

string OperationName { get; }

Property Value

string

StartTime

Gets the time when the operation started.

DateTime StartTime { get; }

Property Value

DateTime

Methods

AddCheckpoint(string)

Adds a checkpoint with a name and the current elapsed time.

TimeSpan AddCheckpoint(string checkpointName)

Parameters

checkpointName string

Name of the checkpoint

Returns

TimeSpan

Elapsed time at the checkpoint

GetCheckpoints()

Gets all checkpoints recorded for this operation.

IDictionary<string, TimeSpan> GetCheckpoints()

Returns

IDictionary<string, TimeSpan>

Dictionary mapping checkpoint names to their elapsed times

StopTimer(IDictionary<string, object>?)

Stops the timer and records the operation duration.

TimeSpan StopTimer(IDictionary<string, object>? metadata = null)

Parameters

metadata IDictionary<string, object>

Optional metadata to associate with the timing record

Returns

TimeSpan

The total duration of the operation