TimeMeasureOptions Class
Definition
- Namespace
- Cuemon.Diagnostics
- Assemblies
- Cuemon.Diagnostics.dll
Specifies options that is related to TimeMeasure operations.
public class TimeMeasureOptions : ProfilerOptions, IParameterObject
- Inheritance
-
objectTimeMeasureOptions
- 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
| Name | Description |
|---|---|
| TimeMeasureOptions() | Initializes a new instance of the TimeMeasureOptions class. |
Properties
| Name | Description |
|---|---|
| DefaultTimeMeasureCompletedThreshold | Gets or sets the default time measuring threshold before the CompletedCallback is invoked, |
| TimeMeasureCompletedThreshold | Gets or sets the time measuring threshold before the CompletedCallback is invoked. |