Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How system.diagnostics trace affects .net performance?

When I enable trace, e.g.:

<system.diagnostics>
    <sources>
        <source name="System.ServiceModel" switchValue="Warning">
            <listeners>
                <add name="_listener0" />
            </listeners>
        </source>
    </sources>
    <sharedListeners>
        <add name="_listener0" type="System.Diagnostics.XmlWriterTraceListener"
         initializeData="logs\ServiceModel.svclog" traceOutputOptions="DateTime, ProcessId, ThreadId, Callstack" />
    </sharedListeners>
    <trace autoflush="true" />
</system.diagnostics>

How badly this affects application performance?

like image 398
dnk.nitro Avatar asked Feb 12 '26 12:02

dnk.nitro


1 Answers

As with most questions, the answer is "It depends". Are you turning on Tracing for WCF components, or using your own trace calls? Is there a trace listener attached (e.g. writing to a file? Or is a DebugView tool opened to watch the system debug console)? Does your code make heavy use of tracing in tight loops, or does it do more moderate tracing only on non-recursive functions and the like?

You can try it and see, but for most apps, you will notice.

like image 141
EricLaw Avatar answered Feb 15 '26 04:02

EricLaw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!