示例#1
0
        private LatencyTracker.LatencyInfo GetCurrentLatencyInfo()
        {
            AggregatedOperationStatistics adlatency = new AggregatedOperationStatistics
            {
                Type              = AggregatedOperationType.ADCalls,
                Count             = 0L,
                TotalMilliseconds = 0.0
            };
            AggregatedOperationStatistics rpcLatency = new AggregatedOperationStatistics
            {
                Type              = AggregatedOperationType.StoreRPCs,
                Count             = 0L,
                TotalMilliseconds = 0.0
            };
            AggregatedOperationStatistics adobjToExchObjLatency = new AggregatedOperationStatistics
            {
                Type              = AggregatedOperationType.ADObjToExchObjLatency,
                Count             = 0L,
                TotalMilliseconds = 0.0
            };

            if (this.activityScopeGetter != null)
            {
                IActivityScope activityScope = this.activityScopeGetter();
                if (activityScope != null)
                {
                    adlatency             = activityScope.TakeStatisticsSnapshot(AggregatedOperationType.ADCalls);
                    rpcLatency            = activityScope.TakeStatisticsSnapshot(AggregatedOperationType.StoreRPCs);
                    adobjToExchObjLatency = activityScope.TakeStatisticsSnapshot(AggregatedOperationType.ADObjToExchObjLatency);
                }
            }
            return(new LatencyTracker.LatencyInfo
            {
                ElapsedTime = this.stopWatch.ElapsedMilliseconds,
                ADLatency = adlatency,
                RpcLatency = rpcLatency,
                ADObjToExchObjLatency = adobjToExchObjLatency
            });
        }