开发者

What is the .NET equivalent of java's -verbose:gc command line option

开发者 https://www.devze.com 2023-01-19 20:17 出处:网络
I\'m writting an ASP.NET MVC application and I\'m seeing a seemly random performance from a one of my actions. My initial throught is that the garbage collection is kicking in and pausing the app for

I'm writting an ASP.NET MVC application and I'm seeing a seemly random performance from a one of my actions. My initial throught is that the garbage collection is kicking in and pausing the app for a little while, but I can't seem to find a button/switch that will prove or disprove my theory.

For none java people out there -verbose:gc is a command line switch that you can pass to a java application that will make the JVM print out when a GC event happens and how long it takes.

I've attempted to use the vs2010 performance tool and JetBrains dotTrace both of which开发者_如何学JAVA are a little bit like using a thermo nuclear weapon to crack a small nut.


In .NET 4.0 there is Event tracing for Windows (ETW) that provides you with the information you are looking for. Here is a one specific for GC.

FYI ETW is very fast and built into Kernel. With ETW you should be able to get information like this

What is the .NET equivalent of java's -verbose:gc command line option

What is the .NET equivalent of java's -verbose:gc command line option

And to get this information there is a tool from the BCL team which is called PerfMonitor

Here are the steps in using the tool to get the GC Information

  1. Start a cmd or powershell as admin , this required to collect ETW tracing
  2. Start the application that you want to trace
  3. Issue the command “PerfMonitor.exe /process:4180 start” where 4180 is the process id
  4. Do the necessary actions
  5. Then issue “PerfMonitor.exe stop”
  6. The command to get the report “PerfMonitor.exe GCTime”. This will generate a report and open it in the browser

I have also blogged the about the same

HTH


Your first guess should not be the GC. With all normal workloads you don't notice the GC in .NET.

There is no trace-switch for the GC, but you can look at the performance counters if you still think the GC is to blame.

0

精彩评论

暂无评论...
验证码 换一张
取 消