internal InstanceEntry(MSExchangeStoreDriverSubmissionDatabaseInstance perfCounterInstance)
 {
     this.PerfCounterInstance       = perfCounterInstance;
     this.SubmissionAttemptsCounter = new SlidingAverageCounter(StoreDriverSubmissionDatabasePerfCounters.SlidingWindowLength, StoreDriverSubmissionDatabasePerfCounters.SlidingBucketLength);
     this.SubmissionFailuresCounter = new SlidingAverageCounter(StoreDriverSubmissionDatabasePerfCounters.SlidingWindowLength, StoreDriverSubmissionDatabasePerfCounters.SlidingBucketLength);
     this.SkippedSubmissionsCounter = new SlidingAverageCounter(StoreDriverSubmissionDatabasePerfCounters.SlidingWindowLength, StoreDriverSubmissionDatabasePerfCounters.SlidingBucketLength);
 }
        private static StoreDriverSubmissionDatabasePerfCounters.InstanceEntry CreateInstanceEntry(string mdbName)
        {
            MSExchangeStoreDriverSubmissionDatabaseInstance msexchangeStoreDriverSubmissionDatabaseInstance = null;

            try
            {
                if (mdbName != null)
                {
                    msexchangeStoreDriverSubmissionDatabaseInstance = MSExchangeStoreDriverSubmissionDatabase.GetInstance(mdbName);
                }
            }
            catch (InvalidOperationException arg)
            {
                TraceHelper.StoreDriverSubmissionTracer.TraceFail <string, InvalidOperationException>(TraceHelper.MessageProbeActivityId, 0L, "Get StoreDriverSubmission PerfCounters Instance {0} failed due to: {1}", mdbName, arg);
            }
            if (msexchangeStoreDriverSubmissionDatabaseInstance == null)
            {
                return(null);
            }
            return(new StoreDriverSubmissionDatabasePerfCounters.InstanceEntry(msexchangeStoreDriverSubmissionDatabaseInstance));
        }
        internal MSExchangeStoreDriverSubmissionDatabaseInstance(string instanceName, MSExchangeStoreDriverSubmissionDatabaseInstance autoUpdateTotalInstance) : base(instanceName, "MSExchange Submission Store Driver Database")
        {
            bool flag = false;
            List <ExPerformanceCounter> list = new List <ExPerformanceCounter>();

            try
            {
                this.SubmissionAttempts = new ExPerformanceCounter(base.CategoryName, "Submission attempts per minute over the last 5 minutes", instanceName, (autoUpdateTotalInstance == null) ? null : autoUpdateTotalInstance.SubmissionAttempts, new ExPerformanceCounter[0]);
                list.Add(this.SubmissionAttempts);
                this.SubmissionFailures = new ExPerformanceCounter(base.CategoryName, "Submission failures per minute over the last 5 minutes", instanceName, (autoUpdateTotalInstance == null) ? null : autoUpdateTotalInstance.SubmissionFailures, new ExPerformanceCounter[0]);
                list.Add(this.SubmissionFailures);
                this.SkippedSubmissions = new ExPerformanceCounter(base.CategoryName, "Submissions skipped per minute over the last 5 minutes", instanceName, (autoUpdateTotalInstance == null) ? null : autoUpdateTotalInstance.SkippedSubmissions, new ExPerformanceCounter[0]);
                list.Add(this.SkippedSubmissions);
                long num = this.SubmissionAttempts.RawValue;
                num += 1L;
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    foreach (ExPerformanceCounter exPerformanceCounter in list)
                    {
                        exPerformanceCounter.Close();
                    }
                }
            }
            this.counters = list.ToArray();
        }