Search code examples
c#.netperfmon

Can you open perfmon.exe, clear any current counts and add your custom app counters?


Can you open perfmon.exe, clear any current counts and add your custom app counters from C#?

Thinking there about perfmon API but I can't find it.


Solution

  • Performance Counters are, ahem, not very well suited for tracking application-level metrics.

    In Linux/Unix world there's an excellent Graphite and StatsD combination, and we've ported it to .NET: Statsify.

    What it allows you is to collect all kinds of metrics from within your application: number of database queries, time it takes to invoke a Web Service, track number of active connections, etc. -- all with simple API like

    Stats.Increment("db.query.count");