Exemple #1
0
        private void RegisterCounter(
            string originalString,
            string reportAs,
            PerformanceCounterStructure pc,
            bool isCustomCounter,
            bool usesInstanceNamePlaceholder,
            out string error)
        {
            error = null;

            try
            {
                this.RegisterPerformanceCounter(
                    originalString,
                    reportAs,
                    pc.CategoryName,
                    pc.CounterName,
                    pc.InstanceName,
                    usesInstanceNamePlaceholder,
                    isCustomCounter);

                PerformanceCollectorEventSource.Log.CounterRegisteredEvent(
                    PerformanceCounterUtility.FormatPerformanceCounter(pc));
            }
            catch (InvalidOperationException e)
            {
                PerformanceCollectorEventSource.Log.CounterRegistrationFailedEvent(
                    e.Message,
                    PerformanceCounterUtility.FormatPerformanceCounter(pc));
                error = e.Message;
            }
        }
 public PerformanceCounterData(
     string originalString,
     string reportAs,
     bool usesInstanceNamePlaceholder,
     bool isInBadState,
     PerformanceCounterStructure counter)
 {
     this.OriginalString = originalString;
     this.ReportAs       = reportAs;
     this.UsesInstanceNamePlaceholder = usesInstanceNamePlaceholder;
     this.IsInBadState       = isInBadState;
     this.PerformanceCounter = counter;
 }