How to see milliseconds in Visual Studio Performance Analyzer instead of % samples

后端 未结 1 1806
谎友^
谎友^ 2021-02-07 04:48

I\'m trying to analyze my program with the Visual Studio Performance Analyzer, but I\'m new to this tool.

If I start my program in the analyzer I get a report where I se

1条回答
  •  别跟我提以往
    2021-02-07 05:11

    There are two different CPU profiling methods in Visual Studio Profiler: Sampling & Instrumentation.

    Sampling (Default)

    The sampling profiling method interrupts the computer processor at set intervals and collects the function call stack. Exclusive sample counts are incremented for the function that is executing and inclusive counts are incremented for all of the calling functions on the call stack. Sampling reports present the totals of these counts for the profiled module, function, source code line, and instruction.

    The sampling method is lightweight (no changes in your binaries) and has little effect on the execution of the application methods: it collects only statistical data about the work that is performed by an application during a profiling session.

    It's good for initial explorations. A high % can means a slow function or a function that is called too often.

    Instrumentation

    The instrumentation profiling method collects detailed timing for the function calls in a profiled application. How? It injects code that captures timing information for each function in the instrumented file and each function call that is made by those functions. Instrumentation also identifies when a function calls into the operating for operations such as writing to a file.

    In reports, you will see Application Time (total time that is spent executing a piece of code, but excluding time that is spent in calls to the operating system, ado.net, service calls, ... ) and Elapsed Time (total time that is spent executing a piece of code).

    This profiling mode also has higher runtime overhead. This inevitably changes the performance characteristics of your application a little bit, but it's quite minimal.

    Only this option allows you to see milliseconds. So change the profiling method in the wizard of in the performance explorer. Also note that this option is sometimes not available, such as when profiling Unit Tests.

    0 讨论(0)
提交回复
热议问题