IT박스

가장 좋아하는 프로파일 링 도구는 무엇입니까 (C ++ 용)

itboxs 2020. 10. 8. 07:48
반응형

가장 좋아하는 프로파일 링 도구는 무엇입니까 (C ++ 용)


지금까지는 Rational Quantify 만 사용했습니다. Intel의 VTune에 대해 좋은 소식을 들었지만 사용해 본 적이 없습니다!

편집 : 나는 대부분 코드를 계측 할 소프트웨어를 찾고 있는데, 이것이 매우 좋은 결과를 얻는 유일한 방법이라고 생각합니다.


또한보십시오:

Windows에서 네이티브 C ++를위한 좋은 프로파일 러는 무엇입니까?


Linux 개발 용 (이러한 도구 중 일부는 다른 플랫폼에서 작동 할 수 있음). 이것들은 내가 아는 두 가지 큰 이름입니다. 한동안 활발한 발전을 보지 못한 다른 작은 이름이 많이 있습니다.


Linux : Google Perftools

  • valgrind보다 빠름 (아직 미세하지 않음)
  • 코드 계측이 필요하지 않습니다.
  • 멋진 그래픽 출력 (-> kcachegrind)
  • 메모리 프로파일 링, CPU 프로파일 링, 누출 검사를 수행합니다.

IMHO, 디버거를 사용한 샘플링 이 가장 좋은 방법입니다. 프로그램을 중지 할 수있는 IDE 또는 디버거 만 있으면됩니다. 프로파일 러를 설치하기 전에 성능 문제를 해결합니다.


C ++ 코드를 프로파일 링하는 유일한 경험은 AutomatedQA (현재 SmartBear Software)의 AQTime 입니다. 여러 유형의 프로파일 러 (성능, 메모리, Windows 핸들, 예외 추적, 정적 분석 등)가 내장되어 있으며 결과를 얻기 위해 코드를 계측합니다.

나는 그것을 사용하는 것을 즐겼습니다. 코드를 조금만 변경해도 성능이 크게 향상 될 수있는 지점을 찾는 것은 항상 재미있었습니다.


저는 과거에 Glowcode를 광범위하게 사용 했으며 긍정적 인 경험 만했습니다. Visual Studio 통합은 정말 훌륭하며 지금까지 사용해 본 것 중 가장 효율적이고 직관적 인 프로파일 러입니다 (관리 코드 용 프로파일 러와 비교해도).

분명히 Windows에서 실행하지 않으면 쓸모가 없지만 질문으로 인해 요구 사항이 정확히 무엇인지 명확하지 않습니다.


Visual Studio 2008 의 프로파일 러 는 매우 훌륭합니다. 빠르고 사용자 친화적이며 명확하며 IDE에 잘 통합되어 있습니다.


나는 전에 프로파일 링을 한 적이 없습니다. 어제 저는 시간 저장을 위해 정적 타임 테이블 (map <std :: string, long long>)이있는 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");

이 줄은 어떤 함수가 많은 시간이 걸리는지 추측해야하므로 프로파일 링하려는 모든 함수를 추가하기에는 약간 번거 롭습니다. 그러나 그것은 잘 작동하고 인쇄 기능은 소비 시간을 %로 표시합니다.

(유사한 "집에서 만든 프로파일 링"으로 작업하는 다른 사람이 있습니까? 아니면 그냥 어리석은 일입니까? 그러나 재미 있습니다! 개선 제안이있는 사람이 있습니까?

모든 기능에 자동으로 행을 추가하는 것이 있습니까?)


의심 할 여지없이 oprofile; 간단하고 신뢰할 수 있으며 작업을 수행하며 모든 종류의 멋진 데이터 분석을 제공 할 수 있습니다.


Windows의 경우 Xperf를 확인하십시오 . 샘플링 된 프로필을 사용하고 유용한 UI가 있으며 계측이 필요하지 않습니다. 성능 문제를 추적하는 데 매우 유용합니다. 다음과 같은 질문에 답할 수 있습니다.

  • 누가 가장 많은 CPU를 사용하고 있습니까? 호출 스택을 사용하여 함수 이름으로 드릴 다운합니다.
  • 누가 가장 많은 메모리를 할당하고 있습니까?
  • 누가 레지스트리 쿼리를 가장 많이 수행합니까?
  • 디스크 쓰기? 기타

예상했던 곳이 아닐 수 있으므로 병목 현상을 발견하면 상당히 놀랄 것입니다!


프로파일 링에는 다양한 요구 사항이 있습니다. 인스트루먼트 된 코드가 정상입니까, 아니면 최적화 된 코드 (또는 이미 컴파일 된 코드)를 프로파일 링해야합니까? 라인 별 프로필 정보가 필요하십니까? 어떤 OS를 실행하고 있습니까? 공유 라이브러리도 프로파일 링해야합니까? 시스템 호출에 대한 추적은 어떻습니까?

개인적으로 저는 제가하는 모든 일에 oprofile을 사용하지만 모든 경우에 이것이 최선의 선택이 아닐 수도 있습니다. Vtune과 Shark도 훌륭합니다.


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.


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.


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.


I use devpartner for the pc platform.


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


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.


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.


ElectricFence works nicely for malloc debugging


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.


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.


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/

참고URL : https://stackoverflow.com/questions/26663/whats-your-favorite-profiling-tool-for-c

반응형