简体   繁体   中英

How can I determine how much run time is spent doing GC in C#. Solution using Visual Studio 2015 preferred

I'm working on a data analysis program that currently takes ~15m to run. Ssing VS2015's diagnostic tools, I can see that it is doing a lot of GC collections.

I'd like to see how that is impacting the total performance of the application. Is there any way to see what the % of time in GC is?

Using C# in Visual Studio 2015.

Try using the Stopwatch class using System Diagnostics. Put the Start New method before your code and call the Stop property after your code. Finally, store the duration with the Elapsed Milliseconds property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM