/// <summary> /// This is the priority based on the elapsed poll tick time and the overall priority. /// It is used to ensure that clients with the overall same base priority are accessed /// so the one polled last is then polled first the next time. /// </summary> /// <param name="queueLength">This contains the current queue length for the underlying fabric.</param> /// <param name="context">This is the metrics context.</param> /// <param name="timeStamp">This is an optional parameter that defaults to the current tick count. You can set this value for unit testing.</param> /// <returns>Returns the new priority.</returns> public override long PriorityRecalculate(long?queueLength, ClientPriorityHolderMetrics context, int?timeStamp = null) { if (!timeStamp.HasValue) { timeStamp = Environment.TickCount; } long newPriority = 0xFFFFFFFFFFFF; try { if (context.PriorityTickCount.HasValue) { newPriority += ConversionHelper.CalculateDelta(timeStamp.Value, context.PriorityTickCount.Value); } context.PriorityTickCount = timeStamp.Value; //Add the queue length to add the listener with the greatest number of messages. context.PriorityQueueLength = queueLength; newPriority += context.PriorityQueueLength ?? 0; newPriority = (long)((decimal)newPriority * context.PriorityWeighting); } catch (Exception ex) { } context.PriorityCalculated = newPriority; return(newPriority); }
/// <summary> /// This method is used to decrement the active count and submits the processing time. /// </summary> /// <param name="start">The tick count when the process started.</param> public virtual int ActiveDecrement(int start) { int delta = ConversionHelper.CalculateDelta(Environment.TickCount, start); ActiveDecrementInternal(delta); return(delta); }
/// <summary> /// This method is used to signal a retry to a dependency. /// </summary> /// <param name="name">The name.</param> /// <param name="profileId">The profile id.</param> /// <param name="start">The start time.</param> /// <param name="reason">The retry reason.</param> internal void Retry(string name, Guid profileId, int start, ResourceRetryReason reason) { ErrorIncrement(); int delta = ConversionHelper.CalculateDelta(Environment.TickCount, start); ResourceRequestTrack outValue; if (!mActive.TryGetValue(profileId, out outValue)) { return; } outValue.RetrySignal(delta, reason); }
/// <summary> /// Initializes a new instance of the <see cref="TransmissionPayloadTraceEventArgs"/> class. /// </summary> /// <param name="start">The tick-count start.</param> /// <param name="message">The message.</param> /// <param name="source">The optional source parameter.</param> public TransmissionPayloadTraceEventArgs(int start, string message = null, string source = null) { Extent = ConversionHelper.CalculateDelta(Environment.TickCount, start); Source = source; Message = message; }