您最喜欢的分析工具是什么(针对 C++)

发布于 2024-07-04 12:49:52 字数 283 浏览 8 评论 0原文

到目前为止,我只使用过 Rational Quantify。 我听说过有关英特尔 VTune 的好消息,但从未尝试过!

编辑:我主要寻找能够检测代码的软件,因为我想这是获得非常好的结果的唯一方法。


另请参阅:

有哪些适合本机 C++ 的优秀分析器Windows?

So far, I've only used Rational Quantify. I've heard great things about Intel's VTune, but have never tried it!

Edit: I'm mostly looking for software that will instrument the code, as I guess that's about the only way to get very fine results.


See also:

What are some good profilers for native C++ on Windows?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(21

我三岁 2024-07-11 12:50:11

让我提供一个 EQATEC 插件...正是我正在寻找的...易于学习和使用,并为我提供快速找到热点所需的信息。 与 Visual Studio 内置的相比,我更喜欢它(尽管公平地说,我还没有尝试过 VS 2010)。

拍摄快照的能力是巨大的。 我经常在等待真正的目标分析运行时完成额外的分析和优化......喜欢它。

哦,它的基础版本是免费的!
http://www.eqatec.com/Profiler/

Let me give a plug for EQATEC... just what I was looking for... simple to learn and use and gives me the info I need to find the hotspots quickly. I much prefer it to the one built in to Visual Studio (though I haven't tried the VS 2010 one yet, to be fair).

The ability to take snapshots is HUGE. I often get an extra analysis and optimization done while waiting for the real target analysis to run... love it.

Oh, and its base version is free!
http://www.eqatec.com/Profiler/

丶情人眼里出诗心の 2024-07-11 12:50:10

Windows 下的 Visual Studio 2010 分析器。 VTune 有一个很棒的调用图工具,但从 Windows Vista/7 开始它就被破坏了。 我不知道他们是否修复了它。

Visual studio 2010 profiler under Windows. VTune had a great call graph tool, but it got broken as of Windows Vista/7. I don't know if they fixed it.

无声无音无过去 2024-07-11 12:50:09

我最喜欢的工具是 Easy Profiler:http://code.google.com/p/easyprofiler/

这是一个编译时分析器:必须使用一组例程手动检测源代码,以便描述目标区域。
然而,一旦应用程序运行,并且测量值自动写入 XML 文件,只需打开 Observer 应用程序并在分析/比较工具上单击几下,您就可以在定性图表中看到结果。

My favorite tool is Easy Profiler : http://code.google.com/p/easyprofiler/

It's a compile time profiler : the source code must be manually instrumented using a set of routines so to describe the target regions.
However, once the application is run, and measures automatically written to an XML file, it is only a matter of opening the Observer application and doing few clicks on the analysis/compare tools, before you can see the result in a qualitative chart.

别念他 2024-07-11 12:50:09

ElectricFence 非常适合 malloc 调试

ElectricFence works nicely for malloc debugging

所谓喜欢 2024-07-11 12:50:08

我在 Windows 和 Linux 下使用 VTune 已经很多年了,效果非常好。 后来的版本变得更糟,当他们将该产品外包给俄罗斯开发人员时,质量和性能都下降了(VTune 崩溃增加,通常需要 15 分钟以上才能打开分析文件)。

关于仪器,您可能会发现它没有您想象的那么有用。 在我研究过的应用程序中,添加仪器通常会降低产品速度,以至于不再工作(真实的故事:启动应用程序,回家,第二天回来,应用程序仍在初始化)。 此外,通过非仪表化分析,您可以对实时问题做出反应。 例如,使用 VTune 远程数据收集器,我可以针对具有数百个同时连接的实时服务器(正在遇到性能问题)启动采样会话,并捕获生产中发生的问题,而这些问题是我在测试环境中永远无法复制的。

I've used VTune under Windows and Linux for many years with very good results. Later versions have gotten worse, when they outsourced that product to their Russian development crew quality and performance both went down (increased VTune crashes, often 15+ minutes to open an analysis file).

Regarding instrumentation, you may find out that it's less useful than you think. In the kind of applications I've worked on adding instrumentation often slows the product down so much that it doesn't work anymore (true story: start app, go home, come back next day, app still initializing). Also, with non instrumented profiling you can react to live problems. For example, with VTune remote date collector I can start up a sampling session against a live server with hundreds of simultaneous connections that is experiencing performance problems and catch issues that happen in production that I'd never be able to replicate in a test environment.

清风疏影 2024-07-11 12:50:07

唯一敏感的答案是来自英特尔的 PTU。 当然,最好在 Intel 处理器上使用它,并且至少在 C2D 机器上获得更有价值的结果,因为架构本身更容易返回有意义的配置文件。

The only sensitive answer is PTU from Intel. Of course its best to use it on an Intel processor and to get even more valuable results at least on a C2D machine as the architecture itself is easier to give back meaningful profiles.

表情可笑 2024-07-11 12:50:07

我尝试过 Quantify 一个 AQTime,Quantify 因其宝贵的“关注子树”和“删除子树”功能而获胜。

I have tried Quantify an AQTime, and Quantify won because of its invaluable 'focus on sub tree' and 'delete sub tree' features.

<逆流佳人身旁 2024-07-11 12:50:05

对于 Windows 开发,我一直在使用 Software Verification 的 性能验证器 - 它很快,相当准确,而且价格合理。 最好的是,它可以检测正在运行的进程,并允许您在运行时手动或基于调用堆栈打开和关闭数据收集 - 非常适合分析较大程序的一小部分。

For Windows development, I've been using Software Verification's Performance Validator - it's fast, reasonably accurate, and reasonably priced. Best yet, it can instrument a running process, and lets you turn data collection on and off at runtime, both manually and based on the callstack - great for profiling a small section of a larger program.

一江春梦 2024-07-11 12:50:05

我在 PC 平台上使用 devpartner

I use devpartner for the pc platform.

烟雨凡馨 2024-07-11 12:50:03

分析有不同的要求。 检测的代码是否可以,或者您是否需要分析优化的代码(甚至已经编译的代码)? 您需要逐行的个人资料信息吗? 您正在运行哪个操作系统? 您还需要分析共享库吗? 跟踪系统调用怎么样?

就我个人而言,我所做的一切都使用 oprofile,但这可能不是所有情况下的最佳选择。 Vtune 和 Shark 也都非常出色。

There are different requirements for profiling. Is instrumented code ok, or do you need to profile optimized code (or even already compiled code)? Do you need line-by-line profile information? Which OS are you running? Do you need to profile shared libraries as well? What about trace into system calls?

Personally, I use oprofile for everything I do, but that might not be the best choice in every case. Vtune and Shark are both excellent as well.

苏佲洛 2024-07-11 12:50:02

对于 Windows,我尝试过 AMD Codeanalyst、Intel VTune 和 Visual Studio Team Edition 中的分析器。

Codeanalyst 存在缺陷(经常崩溃),并且在我的代码中,其结果通常不准确。 它的用户界面不直观。 例如,要在配置文件结果中显示调用堆栈,您必须单击“进程”选项卡,然后单击程序的 EXE 文件名,然后单击带有小字母“CSS”的工具栏按钮。 但它是免费软件,所以您不妨尝试一下,它可以在没有 AMD 处理器的情况下运行(功能较少)。

VTune ($700) 有一个可怕的用户界面IMO; 在大型程序中,很难找到所需的特定调用树,并且一次只能查看程序中的一个“节点”(具有直接调用者和被调用者的函数)——无法查看完整的调用树。调用树。 有一个调用图视图,但我找不到使相对执行时间显示在图表上的方法。 换句话说,无论在图中花费了多少时间,图中的函数看起来都是一样的——就好像它们完全错过了分析的重点一样。

Visual Studio 的探查器具有三者中最好的 GUI,但由于某种原因,它无法从我的大部分代码中收集样本(仅针对我的整个 C++ 程序中的少数函数收集样本)。 另外,我找不到直接购买的价格或方式; 但它附带了我公司的 MSDN 订阅。 Visual Studio 支持托管代码、本机代码和混合代码; 我不确定这方面的其他两个分析器。

总之,我还不知道有什么好的分析器! 我一定会在这里查看其他建议。

For Windows, I've tried AMD Codeanalyst, Intel VTune and the profiler in Visual Studio Team Edition.

Codeanalyst is buggy (crashes frequently) and on my code, its results are often inaccurate. Its UI is unintuitive. For example, to reach the call stack display in the profile results, you have to click the "Processes" tab, then click the EXE filename of your program, then click a toolbar button with the tiny letters "CSS" on it. But it is freeware, so you may as well try it, and it works (with fewer features) without an AMD processor.

VTune ($700) has a terrible user interface IMO; in a large program, it's hard to find the particular call tree you want, and you can only look at one "node" in a program at a time (a function with its immediate callers and callees)--you cannot look at a complete call tree. There is a call graph view, but I couldn't find a way to make the relative execution times appear on the graph. In other words, the functions in the graph look the same regardless of how much time was spent in them--it's as though they totally missed the point of profiling.

Visual Studio's profiler has the best GUI of the three, but for some reason it is unable to collect samples from the majority of my code (samples are only collected for a few functions in my entire C++ program). Also, I couldn't find a price or way to buy it directly; but it comes with my company's MSDN subscription. Visual Studio supports managed, native, and mixed code; I'm not sure about the other two profilers in that regard.

In conclusion, I don't know of a good profiler yet! I'll be sure to check out the other suggestions here.

往事风中埋 2024-07-11 12:50:02

由于你没有提到你正在使用的平台,我会说Linux下的cachegrind。 确实。 它是 Valgrind 工具集的一部分。

http://valgrind.org/info/tools.html

我从未使用过它的子-feature Callgrind,因为我的大部分代码优化都是针对内部函数的。

请注意,有一个可用的前端 KCachegrind。

Since you don't mention the platform you're working on, I'll say cachegrind under Linux. Definitely. It's part of the Valgrind toolset.

http://valgrind.org/info/tools.html

I've never used its sub-feature Callgrind, since most of my code optimization is for inside functions.

Note that there is a frontend KCachegrind available.

偏闹i 2024-07-11 12:50:01

对于 Windows,请查看 Xperf。 它使用采样的配置文件,有一些有用的 UI,& 不需要仪器。 对于跟踪性能问题非常有用。 您可以回答以下问题:

  • 谁使用的 CPU 最多? 使用调用堆栈深入了解函数名称。
  • 谁分配了最多的内存?
  • 谁进行的注册表查询最多?
  • 磁盘写入? 当

你发现瓶颈时你会感到非常惊讶,因为它们可能不是你所期望的!

For Windows, check out Xperf. It uses sampled profile, has some useful UI, & does not require instrumentation. Quite useful for tracking down performance problems. You can answer questions like:

  • Who is using the most CPU? Drill down to function name using call stacks.
  • Who is allocating the most memory?
  • Who is doing the most registry queries?
  • Disk writes? etc.

You will be quite surprised when you find the bottlenecks, as they are probably not where you expected!

兮子 2024-07-11 12:49:59

Visual Studio 2008 中的分析器非常好:快速、用户友好、清晰且与 IDE 集成良好。

The profiler in Visual Studio 2008 is very good: fast, user friendly, clear and well integrated in the IDE.

烟织青萝梦 2024-07-11 12:49:58

毫无疑问,oprofile; 它简单、可靠、能完成工作,并且可以提供各种很好的数据细分。

oprofile, without a doubt; its simple, reliable, does the job, and can give all sorts of nice breakdowns of data.

葬心 2024-07-11 12:49:57

我以前从未做过分析。 昨天,我编写了一个带有静态时间表(map)的 ProfilingTimer 类来存储时间。

构造函数存储起始刻度,析构函数计算经过的时间并将其添加到映射中:

ProfilingTimer::ProfilingTimer(std::string name)
 : mLocalName(name)
{
 sNestedName += mLocalName;
 sNestedName += " > ";

 if(sTimetable.find(sNestedName) == sTimetable.end())
  sTimetable[sNestedName] = 0;

 mStartTick = Platform::GetTimerTicks();
}

ProfilingTimer::~ProfilingTimer()
{
 long long totalTicks = Platform::GetTimerTicks() - mStartTick;

 sTimetable[sNestedName] += totalTicks;

 sNestedName.erase(sNestedName.length() - mLocalName.length() - 3);
}

在我想要分析的每个函数(或 {block})中,我需要添加:

ProfilingTimer _ProfilingTimer("identifier");

这行代码添加到所有函数中有点麻烦我想要分析的函数,因为我必须猜测哪些函数需要花费很多时间。 但它运行良好,并且打印功能以百分比显示消耗的时间。

(还有其他人使用类似的“自制分析”吗?或者它只是愚蠢?但它很有趣!有人有改进建议吗?

是否有某种自动向所有函数添加一行?)

I have never done profiling before. Yesterday I programmed a ProfilingTimer class with a static timetable (a map<std::string, long long>) for time storage.

The constructor stores the starting tick, and the destructor calculates the elapsed time and adds it to the map:

ProfilingTimer::ProfilingTimer(std::string name)
 : mLocalName(name)
{
 sNestedName += mLocalName;
 sNestedName += " > ";

 if(sTimetable.find(sNestedName) == sTimetable.end())
  sTimetable[sNestedName] = 0;

 mStartTick = Platform::GetTimerTicks();
}

ProfilingTimer::~ProfilingTimer()
{
 long long totalTicks = Platform::GetTimerTicks() - mStartTick;

 sTimetable[sNestedName] += totalTicks;

 sNestedName.erase(sNestedName.length() - mLocalName.length() - 3);
}

In every function (or {block}) that I want to profile i need to add:

ProfilingTimer _ProfilingTimer("identifier");

This line is a bit cumbersome to add in all functions I want to profile since I have to guess which functions take a lot of time. But it works well and the print function shows time consumed in %.

(Is anyone else working with any similar "home-made profiling"? Or is it just stupid? But it's fun! Does anyone have improvement suggestions?

Is there some sort of auto-adding a line to all functions?)

忆沫 2024-07-11 12:49:57

我过去曾广泛使用过Glowcode,并且除了积极的体验之外什么也没有。 它的 Visual Studio 集成非常好,并且它是我使用过的最高效/直观的分析器(甚至与托管代码的分析器相比)。

显然,如果您不在 Windows 上运行,那是没有用的,但这个问题让我不清楚您的具体要求是什么。

I've used Glowcode extensively in the past and have had nothing but positive experiences with it. Its Visual Studio integration is really nice, and it is the most efficient/intuitive profiler that I've ever used (even compared to profilers for managed code).

Obviously, thats useless if your not running on Windows, but the question leaves it unclear to me exactly what your requirements are.

掩饰不了的爱 2024-07-11 12:49:56

我对 C++ 代码进行分析的唯一经验是使用 AutomatedQA(现为 SmartBear Software)的 AQTime。 它内置了多种类型的分析器(性能、内存、Windows 句柄、异常跟踪、静态分析等),并对代码进行检测以获得结果。

我喜欢使用它 - 发现代码中的微小变化就可以显着提高性能的地方总是很有趣。

My only experience profiling C++ code is with AQTime by AutomatedQA (now SmartBear Software). It has several types of profilers built in (performance, memory, Windows handles, exception tracing, static analysis, etc.), and instruments the code to get the results.

I enjoyed using it - it was always fun to find those spots where a small change in code could make a dramatic improvement in performance.

月竹挽风 2024-07-11 12:49:55

恕我直言,使用调试器进行采样是最好的方法。 您所需要的只是一个可以让您停止程序的 IDE 或调试器。 在您安装分析器之前,它就可以解决您的性能问题。

IMHO, sampling using a debugger is the best method. All you need is an IDE or debugger that lets you halt the program. It nails your performance problems before you even get the profiler installed.

百思不得你姐 2024-07-11 12:49:55

对于Linux:
Google Perftools

  • 比 valgrind 更快(但不是那么细粒度)
  • 不需要代码检测
  • 漂亮的图形输出(- -> kcachegrind)
  • 进行内存分析、CPU 分析、泄漏检查

For Linux:
Google Perftools

  • Faster than valgrind (yet, not so fine grained)
  • Does not need code instrumentation
  • Nice graphical output (--> kcachegrind)
  • Does memory-profiling, cpu-profiling, leak-checking
蘑菇王子 2024-07-11 12:49:54

用于 Linux 开发(尽管其中一些工具可能适用于其他平台)。 这是我所知道的两个大公司,还有很多其他较小的公司已经有一段时间没有看到积极的发展了。

For linux development (although some of these tools might work on other platforms). These are the two big names I know of, there's plenty of other smaller ones that haven't seen active development in a while.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文