示例#1
0
 /// <summary>
 /// Initializes a new instance of <see cref="PrimitiveEventFrequencyCounter"/>.
 /// </summary>
 /// <param name="timeUnit">
 /// The time interval during which the occurrences (events) is counted.
 /// <para>Can't be less than <see cref="MinTimeUnit"/>.</para>
 /// </param>
 public PrimitiveEventFrequencyCounter(TimeSpan timeUnit)
 {
     timeUnit.Arg(nameof(timeUnit)).EnsureNotLessThan(operand : MinTimeUnit);
     //
     _timeUnit            = timeUnit;
     _eventRiseTimepoints = ImmutableList <TimeSpan> .Empty;
 }
示例#2
0
 protected RunControlOperationState(RunControl <TComponent> runControl, TimeSpan beginTimestamp, CancellationToken ct)
 {
     runControl.EnsureNotNull(nameof(runControl));
     beginTimestamp.Arg(nameof(beginTimestamp)).EnsureNotLessThan(operand: TimeSpan.Zero);
     //
     RunControl       = runControl;
     BeginTimestamp   = beginTimestamp;
     Ct               = ct;
     _completionProxy = new AsyncTaskCompletionSource <IRunControlAttemptSuccess>(options: TaskCreationOptions.None);
     _completionProxy.Task.ContinueWith(continuationAction: P_LogAttemptContinuation, continuationOptions: TaskContinuationOptions.ExecuteSynchronously);
 }