Пример #1
0
 public void Shutdown()
 {
     for (int i = 0; i < this.agentRecords.Length; i++)
     {
         MExCounters.RemoveInstance(this.agentRecords[i].Name);
     }
 }
Пример #2
0
        internal void AgentInvokeEndHandler(object dispatcher, MExSession context)
        {
            MExCountersInstance instance = MExCounters.GetInstance(context.CurrentAgent.Name);
            long timestamp = Stopwatch.GetTimestamp();

            instance.AverageAgentDelay.IncrementBy(timestamp - context.BeginInvokeTicks);
            instance.AverageAgentDelayBase.Increment();
            instance.TotalAgentInvocations.Increment();
        }
Пример #3
0
 public MExPerfCounters(ProcessTransportRole processRole, AgentRecord[] agentRecords)
 {
     this.agentRecords = agentRecords;
     MExCounters.SetCategoryName(MExPerfCounters.GetPerformanceCounterCategory(processRole));
     this.synchronousAgentProcessorUsageSlidingCounters  = new SlidingAverageCounter[this.agentRecords.Length];
     this.asynchronousAgentProcessorUsageSlidingCounters = new SlidingAverageCounter[this.agentRecords.Length];
     for (int i = 0; i < this.agentRecords.Length; i++)
     {
         MExCounters.GetInstance(this.agentRecords[i].Name);
         this.synchronousAgentProcessorUsageSlidingCounters[this.agentRecords[i].SequenceNumber]  = new SlidingAverageCounter(MExPerfCounters.slidingWindowLengthForAgentProcessorUsageCounters, MExPerfCounters.bucketLengthForAgentProcessorUsageCounters);
         this.asynchronousAgentProcessorUsageSlidingCounters[this.agentRecords[i].SequenceNumber] = new SlidingAverageCounter(MExPerfCounters.slidingWindowLengthForAgentProcessorUsageCounters, MExPerfCounters.bucketLengthForAgentProcessorUsageCounters);
     }
 }
Пример #4
0
        internal void AgentInvokeReturnsHandler(object dispatcher, MExSession context)
        {
            MExCountersInstance instance = MExCounters.GetInstance(context.CurrentAgent.Name);

            if (context.IsAsyncAgent)
            {
                SlidingAverageCounter slidingAverageCounter = this.asynchronousAgentProcessorUsageSlidingCounters[context.CurrentAgent.SequenceNumber];
                slidingAverageCounter.AddValue(context.TotalProcessorTime);
                long rawValue2;
                long rawValue = slidingAverageCounter.CalculateAverageAcrossAllSamples(out rawValue2);
                instance.AverageAgentProcessorUsageAsynchronousInvocations.RawValue = rawValue;
                instance.AsynchronousAgentInvocationSamples.RawValue = rawValue2;
            }
            else
            {
                SlidingAverageCounter slidingAverageCounter2 = this.synchronousAgentProcessorUsageSlidingCounters[context.CurrentAgent.SequenceNumber];
                slidingAverageCounter2.AddValue(context.TotalProcessorTime);
                long rawValue4;
                long rawValue3 = slidingAverageCounter2.CalculateAverageAcrossAllSamples(out rawValue4);
                instance.AverageAgentProcessorUsageSynchronousInvocations.RawValue = rawValue3;
                instance.SynchronousAgentInvocationSamples.RawValue = rawValue4;
            }
            context.CleanupCpuTracker();
        }