The documentation is quite terse. Is the purpose to benchmark the logging itself, or to benchmark my code? Do I need to put the PERF target inside another target? Or it is the other way around? Can someone give an example of how I should use it?
Asked
Active
Viewed 371 times
1 Answers
2
Never tried using it myself, but I can see there are two options in NLog for dealing with Windows Performance Counters:
- PerfCounter-Target - Allows you generate Performance Counter Values, that can be picked up by an external Windows Performance Counter Monitor Application.
- PerformanceCounter-Renderer - Allows you to capture the value of an existing Windows Performance Counter in the log-output.
Have updated the PerfCounter-Target-Wiki about using install to create the performance counter. Found some example code here: PerformanceCounterTarget Class
Here is someone that actually have used the PerCounter-Target: Performance Counters with NLog

Rolf Kristensen
- 17,785
- 1
- 51
- 70
-
I'm still confused. Why would you write log statements into a performance counter? Is this related to the `QueryPerformanceCounter` API in windows? – John Henckel Aug 03 '17 at 16:36
-
1@JohnHenckel I also find that NLog is not the right tool for creating Windows Performance Counters, but maybe someone needed to add instrumentation to an existing application? The QueryPerformanceCounter is completely different animal in the Windows API it allows you to capture high-precision timestamps. – Rolf Kristensen Aug 03 '17 at 17:10