public void CounterCreatedThroughFactoryCanBeIncremented() { EnterpriseLibraryPerformanceCounter counter = factory.CreateCounter(categoryName, counterName, new string[] { "foo", "bar" }); counter.Clear(); counter.Increment(); Assert.AreEqual(1L, counter.Counters[0].RawValue); Assert.AreEqual(1L, counter.Counters[1].RawValue); }
public void CounterCanBeIncremented() { EnterpriseLibraryPerformanceCounter counter = counterFactory.CreateCounter(counterCategoryName, counterName, new string[] { "Total" }); counter.Clear(); counter.Increment(); long expected = 1; Assert.AreEqual(expected, counter.Value); }
public void SecurityCacheReadPerformed(object sender, SecurityCacheOperationEventArgs e) { if (PerformanceCountersEnabled) { securityCacheReadPerformedCounter.Increment(); } if (WmiEnabled) { FireManagementInstrumentation(new SecurityCacheReadPerformedEvent(instanceName, e.ItemType.ToString(), (e.Token == null) ? string.Empty : e.Token.Value)); } }
public void HashMismatchDetected(object sender, EventArgs e) { if (PerformanceCountersEnabled) { hashMismatchDetectedCounter.Increment(); } if (WmiEnabled) { ManagementInstrumentation.Fire(new HashMismatchDetectedEvent(instanceName)); } }
public void CanIncrementDifferentInstancesOfSameCounter() { EnterpriseLibraryPerformanceCounter counter = counterFactory.CreateCounter(counterCategoryName, counterName, new string[] { "ctr1", "ctr2" }); counter.Clear(); counter.Increment(); long expected = 1; Assert.AreEqual(expected, counter.GetValueFor("ctr1")); Assert.AreEqual(expected, counter.GetValueFor("ctr2")); }
public void AuthorizationCheckPerformed(object sender, AuthorizationOperationEventArgs e) { if (PerformanceCountersEnabled) { authorizationCheckPerformedCounter.Increment(); } if (WmiEnabled) { FireManagementInstrumentation(new AuthorizationCheckPerformedEvent(instanceName, e.Identity, e.RuleName)); } }
public void CommandFailed(object sender, CommandFailedEventArgs e) { if (PerformanceCountersEnabled) { commandFailedCounter.Increment(); } if (WmiEnabled) { FireManagementInstrumentation(new CommandFailedEvent(instanceName, e.ConnectionString, e.CommandText, e.Exception.ToString())); } }
///<summary> ///</summary> ///<param name="typeBeingValidated"></param> public void NotifyConfigurationCalled(Type typeBeingValidated) { if (typeBeingValidated == null) { throw new ArgumentNullException("typeBeingValidated"); } if (PerformanceCountersEnabled) { //increment counter specific to this type/ruleSet string instanceName = CreateInstanceName(typeBeingValidated.Name); validationCall.Increment(instanceName); validationCallPerSecond.Increment(instanceName); percentageValidationSuccessesBase.Increment(instanceName); //increment totals validationCall.Increment(); validationCallPerSecond.Increment(); percentageValidationSuccessesBase.Increment(); } }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Default handler for the <see cref="NewDataInstrumentationProvider.FireCommandFailedEvent"/> event. /// </summary> /// <remarks> /// Increments the "Commands Failed/sec" performance counter and writes /// an error entry to the event log. /// </remarks> /// <param name="commandText">The text of the command that failed its execution.</param> /// <param name="connectionString">The connection string of the <see cref="Database"/> that executed the failed command, with credentials removed.</param> /// <param name="exception">The exception thrown when the command failed.</param> public void FireCommandFailedEvent(string commandText, string connectionString, Exception exception) { if (exception == null) { throw new ArgumentNullException("exception"); } if (PerformanceCountersEnabled) { commandFailedCounter.Increment(); totalCommandsFailedCounter.Increment(); } }
private void IncrementAverageCounter(bool shouldIncrement, long amount, string averageCounterName, string baseCounterName, string[] instances) { if (shouldIncrement) { EnterpriseLibraryPerformanceCounter counter = counterFactory.CreateCounter( category, averageCounterName, instances); EnterpriseLibraryPerformanceCounter baseCounter = counterFactory.CreateCounter( category, baseCounterName, instances); counter.IncrementBy(amount); baseCounter.Increment(); } }
public void CacheAccessed(object sender, CacheAccessedEventArgs e) { if (PerformanceCountersEnabled) { cacheAccessAttemptsCounter.Increment(); if (e.Hit) { cacheHitRatioCounter.Increment(); cacheHitsCounter.Increment(); } else { cacheMissesCounter.Increment(); } } }
public void IncrementingDifferentCounterInstancesCausesBaseToIncrementSeparatelyFromChildCounters() { EnterpriseLibraryPerformanceCounter counter1 = counterFactory.CreateCounter(counterCategoryName, counterName, new string[] { "Base", "A" }); EnterpriseLibraryPerformanceCounter counter2 = counterFactory.CreateCounter(counterCategoryName, counterName, new string[] { "Base", "B" }); counter1.Clear(); counter2.Clear(); counter1.Increment(); counter2.Increment(); long expected = 2; Assert.AreEqual(expected, counter1.GetValueFor("Base")); Assert.AreEqual(expected, counter2.GetValueFor("Base")); expected = 1; Assert.AreEqual(expected, counter1.GetValueFor("A")); Assert.AreEqual(expected, counter2.GetValueFor("B")); }
/// <summary> /// Fires the CacheAccessed event - reported when an item is retrieved from the /// cache, or if an item was requested but not found. /// </summary> /// <param name="key">The key which was used to access the cache.</param> /// <param name="hit"><code>true</code> if accessing the cache was successful</param> public void FireCacheAccessed(string key, bool hit) { if (PerformanceCountersEnabled) { cacheAccessAttemptsCounter.Increment(); if (hit) { cacheHitRatioCounter.Increment(); cacheHitsCounter.Increment(); totalCacheHitsCounter.Increment(); } else { cacheMissesCounter.Increment(); totalCacheMissesCounter.Increment(); } } }
public void Raise() { rawFraction.Increment(); rawBase.Increment(); }
public void Raise() { firstCounter.Increment(); secondCounter.Increment(); }
public void Raise() { counter.Increment(); }