mardi 15 septembre 2015

Check if process has performance counters enabled?

In C# or else VB.Net, and having only a PID of a process, I wonder if it can be possibly to check at execution time whether the associated process has performance counters enabled.

I'll mean when the performanceCounters setting is enabled in its app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
...
  <system.net>
    <settings>
      <performanceCounters enabled="true"/>
    </settings>
  </system.net>
...
</configuration>

However, I'm asking about the possible existance of a proper/built-in solution using reflection, or other .Net Framework members than doing a primitive check for an app.config file and then parsing the file to find the setting, I'm aware of that, its what I'm trying to avoid.

As a secondary question I will ask:

How I could check for the same thing in the current process?, I ask this because maybe the methodology to determine whether performance counters are enabled in the current process could be easier than determining it in an external process (but again I'm asking this for a solution to avoid parsing the app.config file).





Aucun commentaire:

Enregistrer un commentaire