如何在Visual Studio Performance Analyzer中查看毫秒而不是%示例 [英] How to see milliseconds in Visual Studio Performance Analyzer instead of % samples

查看:124
本文介绍了如何在Visual Studio Performance Analyzer中查看毫秒而不是%示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Visual Studio Performance Analyzer分析程序,但是我是这个工具的新手.

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

如果我在分析器中启动程序,则会得到一个报告,在该报告中可以看到函数花费的总分析时间的百分比.但是总时间可能在5秒到500秒之间变化,那么如何查看我的优化是否有效果?

If I start my program in the analyzer I get a report where I see the % of the total analyzing time a function took. But the total time can vary between 5 sec and 500 sec, so how can I see if my optimizations have had any effect?

如果以毫秒为单位,则不会出现此问题,但是找不到以毫秒为单位显示"之类的功能.这样的功能存在吗?

If it was in milliseconds I would not have this problem, but I cannot find any function like "show in milliseconds" or similar. Does such a function exist?

推荐答案

Visual Studio Profiler中有两种不同的CPU分析方法:采样& 仪器.

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

采样分析方法以设置的时间间隔中断计算机处理器并收集函数调用堆栈.正在执行的函数的独占样本计数增加,并且调用堆栈上的所有调用函数的独占计数增加.抽样报告显示了概要分析的模块,功能,源代码行和指令的总数.

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.

仪器配置文件分析方法收集配置文件应用程序中函数调用的详细计时.如何?它注入代码,以捕获所检测文件中每个功能以及这些功能所进行的每个功能调用的时序信息.工具还可以识别函数何时调用操作以进行诸如写入文件之类的操作.

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.

在报告中,您将看到应用程序时间"(花费在执行一段代码上的总时间,但不包括调用操作系统,ado.net,服务调用等的时间)和经过的时间" (花费在执行一段代码上的总时间).

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.

这篇关于如何在Visual Studio Performance Analyzer中查看毫秒而不是%示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆