-
Notifications
You must be signed in to change notification settings - Fork 1.4k
PerfCounter target
PerformanceCounterTarget updates specified Windows Performance Counter on each write.
Platforms Supported: Limited - Windows only and requires nuget-package NLog.PerformanceCounter with NLog 5.0
<targets>
<target xsi:type="PerfCounter"
counterName="String"
categoryName="String"
instanceName="String"
counterHelp="String"
counterType="Enum"
autoCreate="Boolean"
incrementValue="Layout"
/>
</targets>
The actual Performance Counter can be created by Installing target, or by using autoCreate="true"
.
Read more about using the Configuration File.
-
counterName - Name of the performance counter. Required.
-
categoryName - Name of the performance counter category. Required.
-
instanceName - Performance counter instance name.
-
counterHelp - Counter help text.
-
counterType - Performance counter type. Default:
NumberOfItems32
Possible values:- AverageBase
- AverageCount64
- AverageTimer32
- CounterDelta32
- CounterDelta64
- CounterMultiBase
- CounterMultiTimer
- CounterMultiTimer100Ns
- CounterMultiTimer100NsInverse
- CounterMultiTimerInverse
- CounterTimer
- CounterTimerInverse
- CountPerTimeInterval32
- CountPerTimeInterval64
- ElapsedTime
- NumberOfItems32
- NumberOfItems64
- NumberOfItemsHEX32
- NumberOfItemsHEX64
- RateOfCountsPerSecond32
- RateOfCountsPerSecond64
- RawBase
- RawFraction
- SampleBase
- SampleCounter
- SampleFraction
- Timer100Ns
- Timer100NsInverse
-
autoCreate - Indicates whether performance counter should be automatically created. Default: false.
-
incrementValue - The value by which to increment the counter. Layout. Default: 1.
Introduced in NLog v4.2
Alternative one can use NLog.ETW for writing to ETW EventCounter using EtwEventCounter
-Target.
- Troubleshooting Guide - See available NLog Targets and Layouts: https://nlog-project.org/config
- Getting started
- How to use structured logging
- Troubleshooting
- FAQ
- Articles about NLog
-
All targets, layouts and layout renderers
Popular: - Using NLog with NLog.config
- Using NLog with appsettings.json