Class RuleInstrumentationData
A small model which represents instrumentation data about the execution of a single validation rule.
Inheritance
Inherited Members
Namespace: CSF.Validation
Assembly: CSF.Validation.Abstractions.dll
Syntax
public class RuleInstrumentationData
Remarks
In order to collect this data, you must enable InstrumentRuleExecution.
Constructors
| Improve this Doc View SourceRuleInstrumentationData(Boolean, TimeSpan, Nullable<TimeSpan>)
Initialises a new instance of RuleInstrumentationData.
Declaration
public RuleInstrumentationData(bool parallelizationEnabled, TimeSpan ruleExecutionTime, TimeSpan? messageGenerationTime = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | parallelizationEnabled | Whether or not parallelization was enabled for the rule. |
System.TimeSpan | ruleExecutionTime | The time the rule took to execute. |
System.Nullable<System.TimeSpan> | messageGenerationTime | The time it took to generate the rule's feedback message. |
Properties
| Improve this Doc View SourceMessageGenerationTime
Gets a value indicating how long it took to generate a validation feedback message.
Declaration
public TimeSpan? MessageGenerationTime { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> |
Remarks
Note that this property value will be null if either the generation of messages is disabled via the validation options, or if the associated validation rule result did not have any feedback message applicable (typical of rules which pass).
ParallelizationEnabled
Gets a value indicating whether or not the associated validation rule was executed using a parallel-execution strategy.
Declaration
public bool ParallelizationEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The value of this property is not in fact a 100% guarantee that the associated rule logic executed in parallel with other rules, nor does it give an indication of how many rules executed concurrently with the associated rule.
This property will be set to true if EnableRuleParallelization was true and the rule was marked with ParallelizableAttribute. This will mean that the rule's execution would have been placed into a "task pool" of rules to be executed in parallel. The actual order in which rules run and how many rules may run concurrently is unpredictable though, which is why this value provides no certainty that parallelization actually occurred. The parallel rule-execution algorithm used by CSF.Validation attempts to run as many rules in parallel as possible, when the feature is enabled by the options.
RuleExecutionTime
Gets a value indicating how long this rule took to execute.
Declaration
public TimeSpan RuleExecutionTime { get; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
Remarks
Note that if ParallelizationEnabled is true then this time may have run concurrently with the execution of other rules. That means that the sum of time shown by this property across all rules executed will not be equal to "real world" (or "wall clock") time.