Answer the question
In order to leave comments, you need to log in
Windows NT performance counters. If you try to delete the counters when starting Windows?
If they are deleted, is it possible later that an exception will be thrown, that something is wrong in the registry and it will not be possible to create the same counters again? I read on MSDN that it is not recommended to create counters when Windows starts .
Or maybe, when the counters are not yet initialized, they cannot be deleted? As I understand it, the following may have happened: the OS loaded, my application tried to delete the counters at the start of the service (my application), and it turned out to be done, but, apparently, somehow not completely?
This is the error that occurs when trying to delete performance counters.
25 Jun 2016 10:00:00.5727|Error|Monitoring|||Execute|Параметр реестра имеет неверное значение| в System.Diagnostics.PerformanceCounterLib.RegisterFiles(String arg0, Boolean unregister)
в System.Diagnostics.PerformanceCounterLib.UnregisterCategory(String categoryName)
в System.Diagnostics.PerformanceCounterCategory.Delete(String categoryName)
в PerformanceMonitor.PerformanceCategory.DeleteIfExists()
в PerformanceMonitor.MonitoringDispatcher.Initialize(Boolean recreateExistingCategories)
в CustomServer.Threads.Monitoring.Execute()
_
public bool DeleteIfExists()
{
if (PerformanceCounterCategory.Exists(Name))
{
PerformanceCounterCategory.Delete(Name);
return true;
}
return false;
}
public bool CreateIfNotExists()
{
if (!PerformanceCounterCategory.Exists(Name))
{
var counters = new CounterCreationDataCollection();
foreach (PerformanceSet set in this.counterSets)
{
foreach (CounterCreationDataExt creationData in set.CounterCreationData)
{
counters.Add(creationData);
}
}
PerformanceCounterCategory.Create(Name, Description, CategoryType, counters);
return true;
}
return false;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question