public void Add(string key, ImplicitCounterInstance CounterInst) { m_Instances.Add(key, CounterInst); }
private static void CallImplicitCounter(ImplicitCounterInstance instance, Type declaringType) { instance.Counters[declaringType].Increment(); if (declaringType.Equals(typeof (NumberOfCallsPmc))) { CallImplicitCounter(instance, typeof (NumberOfCallsPerSecPmc)); } if (declaringType.Equals(typeof (NumberOfFailurePmc))) { CallImplicitCounter(instance, typeof (NumberOfFailurePerSecPmc)); } if (declaringType.Equals(typeof (NumberOfSuccessPmc))) { CallImplicitCounter(instance, typeof (NumberOfSuccessPerSecPmc)); } }
private static void SetImplicitCounterRawValue(ImplicitCounterInstance instance, Type declaringType, long newValue) { instance.Counters[declaringType].RawValue = newValue; }
private static void AddCategoryInstances(Assembly callingAssembly, MethodBase method) { string text1 = ReflectionHelper.GetAssemblyName(callingAssembly); string text2 = string.Empty; string text3 = string.Empty; PerformanceCounterType type1 = PerformanceCounterType.NumberOfItems32; Type type2 = m_Categories[text1].GetType(); if (type2 == null) { throw new InvalidOperationException("Implicit PMC host category not set"); } PmcCategory category1 = m_Categories[text1]; ImplicitCounterInstance instance1 = new ImplicitCounterInstance(category1, GetPmcInstanceName(method)); if (!category1.CounterInstances.Contains(ReflectionHelper.MethodSignature(method))) { category1.CounterInstances.Add(ReflectionHelper.MethodSignature(method), instance1); } Assembly assembly1 = Assembly.GetAssembly(typeof (PmcManager)); foreach (Type type3 in assembly1.GetTypes()) { if (type3.BaseType == typeof (ImplicitCounter)) { foreach (PmcGeneralAttribute attribute1 in type3.GetCustomAttributes(typeof (PmcGeneralAttribute), false)) { if (attribute1 is PmcNameAttribute) { text2 = (string) attribute1.Value; } else if (attribute1 is PmcHelpAttribute) { text3 = (string) attribute1.Value; } else if (attribute1 is PmcTypeAttribute) { type1 = (PerformanceCounterType) attribute1.Value; } } if (text2.Trim() == "") { throw new InvalidOperationException("PMC name not set"); } if (!instance1.Counters.Contains(type3)) { instance1.Counters.Add(type3, new PmcImplicitCounter(text2, text3, type1, category1, instance1.InstanceName, type3)); if (!category1.Counters.ContainsKey(type3.FullName)) { category1.Counters.Add(type3.FullName, new PmcCounter(text2, text3, type1, type2)); } } } } }