Class TimeMeasureOptions
- Namespace
- Cuemon.Diagnostics
- Assembly
- Cuemon.Diagnostics.dll
Specifies options that is related to TimeMeasure operations.
public class TimeMeasureOptions : ProfilerOptions, IParameterObject
- Inheritance
-
TimeMeasureOptions
- Implements
- Derived
- Inherited Members
Examples
The following example demonstrates how to configure TimeMeasureOptions for use with the TimeMeasure class.
using System;
using System.Threading;
using Cuemon.Diagnostics;
namespace MyApp.Examples;
public class TimeMeasureOptionsExample
{
public void Demonstrate()
{
// Configure options with a threshold
var options = new TimeMeasureOptions
{
TimeMeasureCompletedThreshold = TimeSpan.FromMilliseconds(100)
};
// Use with TimeMeasure to profile an action
var profiler = TimeMeasure.WithAction(() =>
{
// Simulate work
Thread.Sleep(50);
}, setup: o =>
{
o.TimeMeasureCompletedThreshold = TimeSpan.FromMilliseconds(100);
});
// The CompletedCallback will be invoked if elapsed time >= threshold
Console.WriteLine($"Elapsed: {profiler.Elapsed}");
}
}
Constructors
TimeMeasureOptions()
Initializes a new instance of the TimeMeasureOptions class.
public TimeMeasureOptions()
Remarks
The following table shows the initial property values for an instance of TimeMeasureOptions.
| Property | Initial Value |
|---|---|
| TimeMeasureCompletedThreshold | Zero |
Properties
DefaultTimeMeasureCompletedThreshold
Gets or sets the default time measuring threshold before the CompletedCallback is invoked,
public static TimeSpan DefaultTimeMeasureCompletedThreshold { get; set; }
Property Value
- TimeSpan
The default time measuring threshold before the CompletedCallback is invoked.
TimeMeasureCompletedThreshold
Gets or sets the time measuring threshold before the CompletedCallback is invoked.
public TimeSpan TimeMeasureCompletedThreshold { get; set; }
Property Value
- TimeSpan
The time measuring threshold before the CompletedCallback is invoked.