Пример #1
0
        private OperationStatistics GetOperationStatistics(ActivityOperationType activityOperationType, string instance)
        {
            OperationKey key = new OperationKey(activityOperationType, instance);
            Func <OperationKey, OperationStatistics> valueFactory = (OperationKey operationKey) => OperationStatistics.GetInstance(operationKey);

            return(this.statistics.GetOrAdd(key, valueFactory));
        }
Пример #2
0
        public static void AddOperation(IActivityScope scope, ActivityOperationType operation, string instance, float value = 0f, int count = 1)
        {
            bool           flag          = false;
            IActivityScope activityScope = ActivityContext.globalScope;

            TimeInResourcePerfCounter.AddOperation(operation, value);
            if (scope != null && scope.Status == ActivityContextStatus.ActivityStarted)
            {
                flag = scope.AddOperation(operation, instance, value, count);
            }
            if (!ActivityContext.IsGlobalScopeEnabled)
            {
                return;
            }
            if (flag)
            {
                activityScope.AddOperation(operation, "INSTR", value, count);
                return;
            }
            if (scope != null || SingleContext.Singleton.LocalId != null)
            {
                activityScope.AddOperation(operation, "MISSED", value, count);
                return;
            }
            if (DebugContext.GetDebugProperty(DebugProperties.ActivityId) == null)
            {
                activityScope.AddOperation(operation, "UNINSTR", value, count);
                return;
            }
            activityScope.AddOperation(operation, "SUPPR", value, count);
        }
Пример #3
0
        public bool AddOperation(ActivityOperationType activityOperationType, string instance, float value = 0f, int count = 1)
        {
            if (ExTraceGlobals.ActivityContextTracer.IsTraceEnabled(TraceType.DebugTrace))
            {
                ExTraceGlobals.ActivityContextTracer.TraceDebug((long)this.LocalId.GetHashCode(), "ActivityScopeImpl.AddOperation - activityOperationType = {0}, instance = {1}, value = {2}. Key = {3}", new object[]
                {
                    activityOperationType,
                    instance ?? "<null>",
                    value,
                    this.LocalId
                });
            }
            if (!this.VerifyIsStarted())
            {
                return(false);
            }
            OperationStatistics operationStatistics = this.GetOperationStatistics(activityOperationType, instance);

            if (this.Status == ActivityContextStatus.ActivityStarted)
            {
                operationStatistics.AddCall(value, count);
                return(true);
            }
            return(false);
        }
Пример #4
0
        internal static void AddOperation(ActivityOperationType activityOperationType, float value)
        {
            MSExchangeActivityContextInstance instance = TimeInResourcePerfCounter.GetInstance(activityOperationType);

            if (instance != null)
            {
                instance.TimeInResourcePerSecond.IncrementBy((long)value);
            }
        }
Пример #5
0
        private AggregatedOperationStatistics TakeADObjToExchObjStatisticsSnapshot()
        {
            AggregatedOperationStatistics result = new AggregatedOperationStatistics
            {
                Type = AggregatedOperationType.ADObjToExchObjLatency
            };

            foreach (KeyValuePair <OperationKey, OperationStatistics> keyValuePair in this.statistics)
            {
                ActivityOperationType activityOperationType = keyValuePair.Key.ActivityOperationType;
                if (activityOperationType == ActivityOperationType.ADObjToExchObjLatency)
                {
                    AverageOperationStatistics averageOperationStatistics = (AverageOperationStatistics)keyValuePair.Value;
                    result.Count             += (long)averageOperationStatistics.Count;
                    result.TotalMilliseconds += (double)((float)averageOperationStatistics.Count * averageOperationStatistics.CumulativeAverage);
                }
            }
            return(result);
        }
        private string ActivityOperationToString(ActivityOperationType operationType)
        {
            string str = string.Empty;
            switch (operationType)
            {
                case ActivityOperationType.Execute:
                    return "Execute";

                case ActivityOperationType.Cancel:
                    return "Cancel";

                case ActivityOperationType.Compensate:
                    return "Compensate";

                case ActivityOperationType.HandleFault:
                    return "HandleFault";
            }
            return str;
        }
        private string ActivityOperationToString(ActivityOperationType operationType)
        {
            string str = string.Empty;

            switch (operationType)
            {
            case ActivityOperationType.Execute:
                return("Execute");

            case ActivityOperationType.Cancel:
                return("Cancel");

            case ActivityOperationType.Compensate:
                return("Compensate");

            case ActivityOperationType.HandleFault:
                return("HandleFault");
            }
            return(str);
        }
Пример #8
0
        private static MSExchangeActivityContextInstance GetInstance(ActivityOperationType operation)
        {
            MSExchangeActivityContextInstance result = null;

            switch (operation)
            {
            case ActivityOperationType.ADRead:
            case ActivityOperationType.ADSearch:
            case ActivityOperationType.ADWrite:
                result = TimeInResourcePerfCounter.adInstance;
                break;

            case ActivityOperationType.MailboxCall:
                result = TimeInResourcePerfCounter.mailboxInstance;
                break;

            case ActivityOperationType.ExRpcAdmin:
                result = TimeInResourcePerfCounter.exRpcAdminInstance;
                break;
            }
            return(result);
        }
        private string ActivityOperationToString(ActivityOperationType operationType)
        {
            string retVal = string.Empty;

            switch (operationType)
            {
            case ActivityOperationType.Execute:
                retVal = "Execute";
                break;

            case ActivityOperationType.Cancel:
                retVal = "Cancel";
                break;

            case ActivityOperationType.HandleFault:
                retVal = "HandleFault";
                break;

            case ActivityOperationType.Compensate:
                retVal = "Compensate";
                break;
            }
            return(retVal);
        }
Пример #10
0
        public static void AddOperation(ActivityOperationType operation, string instance, float value = 0f, int count = 1)
        {
            IActivityScope currentActivityScope = ActivityContext.GetCurrentActivityScope();

            ActivityContext.AddOperation(currentActivityScope, operation, instance, value, count);
        }
 public ActivityExecutorOperation(Activity activity, ActivityOperationType opt, int contextId)
     : base(contextId, activity.QualifiedName)
 {
     this.activityName = activity.QualifiedName;
     this.operation = opt;
 }
 private string ActivityOperationToString(ActivityOperationType operationType)
 {
     string retVal = string.Empty;
     switch (operationType)
     {
         case ActivityOperationType.Execute:
             retVal = "Execute";
             break;
         case ActivityOperationType.Cancel:
             retVal = "Cancel";
             break;
         case ActivityOperationType.HandleFault:
             retVal = "HandleFault";
             break;
         case ActivityOperationType.Compensate:
             retVal = "Compensate";
             break;
     }
     return retVal;
 }
Пример #13
0
 public OperationKey(ActivityOperationType activityOperationType, string instance)
 {
     this.ActivityOperationType = activityOperationType;
     this.Instance = instance;
 }
 public ActivityExecutorOperation(Activity activity, ActivityOperationType opt, int contextId, Exception e)
     : this(activity, opt, contextId)
 {
     this.exceptionToDeliver = e;
 }
 public ActivityExecutorOperation(Activity activity, ActivityOperationType opt, int contextId)
     : base(contextId, activity.QualifiedName)
 {
     this.activityName = activity.QualifiedName;
     this.operation    = opt;
 }
Пример #16
0
 public bool AddOperation(ActivityOperationType operation, string instance, float value = 0f, int count = 1)
 {
     return(this.activityScopeImpl.AddOperation(operation, instance, value, count));
 }
 public ActivityExecutorOperation(Activity activity, ActivityOperationType opt, int contextId, Exception e)
     : this(activity, opt, contextId)
 {
     this.exceptionToDeliver = e;
 }