public void WillFormatNameWithAppDomainNamePrefix() { AppDomainNameFormatter nameFormatter = new AppDomainNameFormatter(); string createdName = nameFormatter.CreateName("MyInstance"); Assert.IsTrue(createdName.EndsWith(" - MyInstance")); Assert.IsTrue(createdName.Length <= 128); }
public void SetUp() { formatter = new AppDomainNameFormatter(); formattedInstanceName = formatter.CreateName(instanceName); instrumentationProvider = new AuthorizationProviderInstrumentationProvider(); enabledInstrumentationListener = new AuthorizationProviderInstrumentationListener(instanceName, true, true, true, formatter); disabledInstrumentationListener = new AuthorizationProviderInstrumentationListener(instanceName, false, false, false, formatter); }
public void SetUp() { nameFormatter = new AppDomainNameFormatter(applicationInstanceName); instrumentationProvider = new HashAlgorithmInstrumentationProvider(instanceName, true, true, nameFormatter); formattedInstanceName = nameFormatter.CreateName(instanceName); totalHashComparisonPerformedPerformanceCounter = new EnterpriseLibraryPerformanceCounter(HashAlgorithmInstrumentationProvider.counterCategoryName, HashAlgorithmInstrumentationProvider.TotalHashComparisonPerformedPerformanceCounterName, formattedInstanceName); totalHashMismatchesPerformedPerformanceCounter = new EnterpriseLibraryPerformanceCounter(HashAlgorithmInstrumentationProvider.counterCategoryName, HashAlgorithmInstrumentationProvider.TotalHashMismatchesPerformedPerformanceCounterName, formattedInstanceName); totalHashOperationPerformedPerformanceCounter = new EnterpriseLibraryPerformanceCounter(HashAlgorithmInstrumentationProvider.counterCategoryName, HashAlgorithmInstrumentationProvider.TotalHashOperationPerformedPerformanceCounterName, formattedInstanceName); }
public void SetUp() { formatter = new AppDomainNameFormatter(); formattedInstanceName = formatter.CreateName(instanceName); enabledInstrumentationProvider = new SecurityCacheProviderInstrumentationProvider(instanceName, true, true, formatter); disabledInstrumentationProvider = new SecurityCacheProviderInstrumentationProvider(instanceName, false, false, formatter); totalSecurityCacheReadPerformedCounter = new EnterpriseLibraryPerformanceCounter(SecurityCacheProviderInstrumentationProvider.PerfomanceCountersCategoryName, SecurityCacheProviderInstrumentationProvider.TotalSecurityCacheReadPerformedCounterName, formattedInstanceName); ClearCounters(); }
public void SetUp() { nameFormatter = new AppDomainNameFormatter(applicationInstanceName); instrumentationProvider = new LoggingInstrumentationProvider(instanceName, true, true, applicationInstanceName); tracerInstrumentationProvider = new TracerInstrumentationProvider(true, false, string.Empty); formattedInstanceName = nameFormatter.CreateName(instanceName); totalLoggingEventsRaised = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalLoggingEventsRaised, formattedInstanceName); totalTraceListenerEntriesWritten = new EnterpriseLibraryPerformanceCounter(counterCategoryName, TotalTraceListenerEntriesWritten, formattedInstanceName); // Use AppDomainFriendlyName for the instance name nameFormatter = new AppDomainNameFormatter(); formattedInstanceName = nameFormatter.CreateName(instanceName); totalTraceOperationsStartedCounter = new EnterpriseLibraryPerformanceCounter(TracerInstrumentationProvider.counterCategoryName, TracerInstrumentationProvider.TotalTraceOperationsStartedCounterName, formattedInstanceName); }
private int GetCounterValue(string counterName, string operation) { string instanceName = new AppDomainNameFormatter().CreateName(operation); return (int)CommonUtil.GetPerformanceCounterValue(performanceCounterCategory, instanceName, counterName); }
private int GetCounterValue(string counterName) { string categoryName = "Enterprise Library Logging Counters"; string instanceName = new AppDomainNameFormatter().CreateName("Total"); if (PerformanceCounterCategory.InstanceExists(instanceName, categoryName)) { using (PerformanceCounter counter = new PerformanceCounter()) { counter.CategoryName = categoryName; counter.CounterName = counterName; counter.InstanceName = instanceName; return (int)counter.RawValue; } } return 0; }