C++ run timing IDE perhaps? - c++

is there an IDE or perhaps a piece of software that could time my C++ programs? I'm currently using Visual Studio 2010 so if there's a functionality to help with that, I'd appreciate it.

You will want to use a Profiler. There are plenty of options out there, but start with what you have natively in VS - please read Find Application Bottlenecks with Visual Studio Profiler
Taken from here
Determining the speed of a particular
operation is often known as profiling.
The term "profiling" can also be used
when other information about an
operation's profile is queried -- such
as the number of calls to a function.
And, as always, MSDN is your friend with Analyzing Application Performance by Using Profiling Tools

Related

Is there a Visual C++ plugin that works like codepad.org or similar services?

I'd love to have a local C++ scratch pad without having to worry about creating projects, solutions, and files until I need that complexity for a particular test case. Interactive debugging on it would be the major advantage of using the IDE instead of a simple GCC/run script from an editor. Codepad and ideone don't allow system calls or filesystem operations, so that's a major drawback. A minor drawback to them is delay in compiling and limit on output, and of course, no chance of interactive debugging.

Is it worth learning Eclipse for C++ development

As far as I know it is hard to learn using Eclipse from scratch. But I will get such benefits as fast source code browsing, call graphs, static code analysis. What other benefits will I get from using Eclipse for C++ (CDT)?
I learned Eclipse for C++. It is flexible and offers many features. I no longer use it for C++.
What I found is that CDT feels like an "add on" rather than an intrinsically supported environment. Perhaps because it is an add on. Eclipse is written in and primarily supports Java development.
It was also rather buggy at the time but that was two years ago. I think today's CDT is probably more refined.
Lastly, it took a long time to start and some editing operations were rather slow. I was able to find a vi plugin for it, but it wasn't free and wasn't a perfect emulation.
Today I use a commercial editor that is fast and doesn't feel like it is out of its element. I would encourage you to try Eclipse and see for yourself if it meets your needs.
I used Eclipse with C++ only for a short time, and rather I could use Eclipse with Java for some months. Now that I'm not using it, I feel that some important features are missing.
Eclipse is pretty heavy, but has some great features that I can't find easily somewhere else.
I can live without code analysis and project management (for small projects), but some features about source code navigation and refactoring are really unique and I really miss them.
IMHO, Eclipse is worth learning, even if it won't become your default IDE.
If you don't want the giant size and lethargic performance of Eclipse, try Code::Blocks, which is a cross-platform C++ IDE actually written in C++. They have just released a spanking new version (10.05).
I've been using Eclipse now for more than 6 years and I couldn't find a (free) IDE which has so many features.
I neside the obvious ones (automatic build, syntax highlighting, indexing of function etc)
you have the plugins.
You are working with a versioning system? No need to learn the command line commands. Just use the appropriate Eclipse Plugin (SVN, C++).
You are using a testing framework? CUTE and ECUT provide you with macros to create the test suites and summarise their results.
Another nice bonus: Eclipse is available for Windows/Linux/OS X although it is slightly superior on Linux (due to the easy availability of other tools)
If Eclipse still does not have keyboard macros I wouldn't touch it with a ten foot poll for development with any language. Better to use vim or emacs IMO, or better yet emacs in viper-mode. :)
Some Points which should be true for most IDEs:
automated generation of build scripts
highligting of compiler errors and warnings in the source
integration with source control svn, git, ... (subversion, egit, ...)
code completion
debugging
other things (plugins)
Eclipse against other IDEs:
Platform independent
Free with complete functionality
I'd say that it is worth the effort to learn it.
Eclipse for C++ isn't as good as for Java, but it still beats not having any IDE.
F3 and Ctrl-Space is a good enough reason to leave any plain text editor behind.
Learning an IDE isn't a waste of your time at all. Try Eclipse, Visual Studio (if you're on that platform), Netbeans and anything you can think of. You might find something you really like.
Edit: Since you specify that you're on Windows, I'd say try out the free Visual Studio version. From my (limited) experience, it feels better suited for c++ on that platform.
It can help make cross-platform development (for Windows and Linux) a lot easier.
Very much depends on what you do.
If you need to work on shared projects that use Eclipse => learn it.
If you just write 10 or 100 lines of code altogether => use text editor.
If you just started coding, go for an IDE that works best for you. This can be Eclipse, but it could be Visual Studio on Windows or Xcode on Mac, especially given the choice of language.
For quite small projects, you can also get away with good editors that support syntax highlighting. Although a complete IDE makes editing, compiling and debugging much easier.
My choice is Xcode on Mac, Visual Studio on Windows. Eclipse only for Java for me on any platform.
Let me be very presumptuous for a moment and tell you what you really want.
You do not want to learn an IDE.
What you want is an easy and efficient tool, that will seamlessly assist you in writing c++ code. C++ is already difficult enough, ideally you should concentrate on it and forget about the IDE.
My advice. Let VI and Emacs to the dinosaurs. If you're on windows go for Visual Studio (the Express edition is freely available for personal use), otherwise Eclipse and Code::Blocks are good choices.
I rarely use an IDE. It is much easier and faster to use a good text editor (VEDIT) and then use make for building. Of course, you can call compilers, make, debugger etc. directly from VEDIT, then browse errors etc.
I have tried Eclipse a few times. The first thing I noticed is that it is really heavy. Cold start takes about 2 minutes on my machine, and subsequent starts around 20 to 30 seconds. (In comparison, with VEDIT, cold start is 1.5 seconds and any subsequent starts about 0.5 seconds.) The UI of Eclipse has lots of unnecessary clutter on screen, so there is not so much room for the code being edited. Eclipse can not edit files larger than a few megabytes, so you need another editor for editing large log files, memory dumps etc. anyway.
A good programmers editor does have fast source code browsing, function lists, call graphs etc, you do not need an IDE for that. The tools for static analysis (such as Lint, Klockworks etc.) are separate tools anyway, but you can call them from a text editor just as well as from IDE. Text editor can be integrated to version control, too (but you may need to do some configuration work yourself).
The advantage of a general purpose text editor is that you can use the same tool for all your text editing, so you will learn to use it effectively.
What is special about IDE is that it is usually more tightly coupled to some specific language. For example, it may contain full on-line help and code completion for the language library, API functions etc. Those may be useful to someone.
To my mind it is worth to learn Eclipse. Or just try it. It is widespread development environment. I saw various fields where Eclipse or IDEs based on it used from embedded development to mobile development.

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

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm looking for a profiler to use with native C++. It certainly does not have to be free, however cost does factor into the purchase decision. This is for commercial work so I can't use personal or academic licensed copies.
The key features I'm looking for are:
Process level metrics
Component level metrics
Line-level metrics
Supports Multi-threaded code
Usability
Cost
Visual Studio 2005 Professional support required (VS 2008 Professional support highly
desirable)
I've used Intel's VTune and Compuware's Devpartner Performance Analysis Community Edition.
VTune seemed very powerful but it has a steep learning curve. It also is very "modular" so you have to figure out what parts are you need to buy.
DevPartner PACE was pretty easy to use and provides all of the key features however it's only a 45-day trial. The licensed version (DevPartner for Visual C++ BoundsChecker Suite) is about $1400 a seat, which is doable but a bit high imo.
What are some good profilers for native C++ and WHY?
See also:
What's Your Favorite Profiling Tool For C++
On Windows, GlowCode is affordable, fairly easy to use, and offers a free trial so you can see if it works for you.
Try Intel Parallel Studio. Currently, it's in beta, but the name Intel says it all.
http://www.intel.com/go/parallel
Many people are not aware but MSFT is making a great progress putting the best possible tools for improving performance in the hands of devlopers for free :-). They are exposing to all of us the internals of Windows tracing: ETW.
perftools
It is part of the new windows SDK for server 2008 and Vista. Simply impressive and must to download if performance analysis and profiling under Windows is your goal (regardless of language).
Check the documentation here before you decide to download it:
msdn doc
Just found Luke StackWalker on SourceForge (http://lukestackwalker.sourceforge.net/).
Unfortunately it does not have a 'focus on sub tree', but it remains handy to use, uses the symbol server (I suggest you set it up immediately if you don't have it yet), offers a graphical visualisation, ...
The down side is that it doesn't show the accumulated times (samples) of the child functions.
Another alternative is "Very Sleepy" (http://www.codersnotes.com/sleepy). It can show the accumulated times of the children, but unfortunately it doesn't use the symbol server.
CodeXL may also be worth looking at, it can run on both Linux and Windows, although it is mainly dedicated to OpenGL/OpenCL debugging and profiling there is a time based sample option for CPUs under the profiling section which maybe helpful. It's also free and works as long as pdb files are available (well on windows, I don't know how it works on Linux) (even for release builds with pdb).
Definitely Visual Studio Team System. By far.
I just finished the first usable version of CxxProf, a portable manual instrumented profiling library for C++.
It fulfills your requirements:
Profiles multithreaded applications
Support for profiling multiple processes throughout the same network is on the way
It is written with the best usability and easiest integration in mind
It's free as in beer and free as in speech
It will work with VS05,08,10,12 and 13. As well as with g++ on Linux. It's currently tested with VS 2013 Express.
See the project wiki for more info.
Disclaimer: Im the main developer of CxxProf
I wrote an open source lightweight win32/64 profiler, support both CPU and memory profiling,
it's kind of similar with VS profiler, but with unique feature like flame graph of CPU and
memory data. it's here: dprofiler

How to measure performance in a C++ (MFC) application?

What good profilers do you know?
What is a good way to measure and tweak the performance of a C++ MFC application?
Is Analysis of algorithms really neccesary? http://en.wikipedia.org/wiki/Algorithm_analysis
I strongly recommend AQTime if you are staying on the Windows platform. It comes with a load of profilers, including static code analysis, and works with most important Windows compilers and systems, including Visual C++, .NET, Delphi, Borland C++, Intel C++ and even gcc. And it integrates into Visual Studio, but can also be used standalone. I love it.
If you're (still) using Visual C++ 6.0, I suggest using the built-in profiler. For more recent versions you could try Compuware DevPartner Performance Analysis Community Edition.
For Windows, check out Xperf which ships free with the Windows SDK. 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!
It's been a while since I profiled unmanaged code, but when I did I had good results with Intel's vtune. I'm sure somebody else will tell us if that's been overtaken.
Algorithmic analysis has the potential to improve your performance more profoundly than anything you'll find with a profiler, but only for certain classes of application. If you operate over reasonably large sets of data, algorithmic analysis might find ways to be more efficient in CPU/Memory/both, but if your app is mainly form-fill with a relational database for storage, it might not offer you much.
Intel Thread Checker via Vtune performance analyzer- Check this picture for the view i use the most that tells me which function eats up the most of my time.
I can further drill down inside and decompose which functions inside them eats up more time etc. There are different views based on what you are watching (total time = time within fn + children), self time (time spent only in code running inside the function etc).
This tool does a lot more than profiling but i haven't explored them all. I would definitely recommend it. The tool is also available for downloading as a fully functional trial version that can run for 30 days. If you have cost constraints, i would say this window is all that you require to pin point your problem.
Trial download here - https://registrationcenter.intel.com/RegCenter/AutoGen.aspx?ProductID=907&AccountID=&ProgramID=&RequestDt=&rm=EVAL&lang=
ps : I have also played with Rational Rational but for some reason I did not take much to it. I suspect Rational might be more expensive than Intel too.
Tools (like true time from DevPartner) that let you see hit counts for source lines let you quickly find algorithms that have bad 'Big O' complexity. You still have to analyse the algorithm to determine how to reduce the complexity.
I second AQTime, having both AQTime and Compuwares DevPartner, for most cases. The reason being that AQTime will profile any executable that has a valid PDB file, whereas TrueTime requires you to make an instrumented build. This greatly speeds up and simplifies ad hoc profiling. DevPartner is also quite a bit more expensive if this is an issue. Where DevPartner comes into its own is with BoundsChecker, which I still rate as a better tool for catching leaks and overwrites than AQTimes execution profiler. TrueTime can be slighly more accurate than AQTime, but I have never found this to be an issue.
Is profiling worthwhile, IMO yes, if you need performance gains on a local application. I think you also learn a lot about how your program and algorithms really work, and the cost implications of using certain types of object classes for storing and iterating through your data.
Glowcode is a very nice profiler (when it works). It can attach to a running program and requires only symbol files - you don't need to rebuild.
Some versions pf visual studio 2005 (and maybe 2008) actually come with a pretty good performance profiler.
if you have it it should be available under the tools menu
or you can search for a way to open the "performance explorer" window to start a new performance session.
A link to MSDN
FYI, Some versions of Visual Studio only come with a non-optimizing compiler. For one of my my MFC apps if I compile it with MINGW/MSYS ( gcc compiler ) with -o3 then it runs about 5-10x as fast as my release compile with Visual Studio.
For example I have an openstreetmap xml compiler and it takes about 3 minutes ( the gcc compiled version) to process a 2.7GB xml file. My visual studio compile of the same code takes about 18 minutes to run.

What's the best free C++ profiler for Windows? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking for a profiler in order to find the bottleneck in my C++ code. I'd like to find a free, non-intrusive, and good profiling tool. I'm a game developer, and I use PIX for Xbox 360 and found it very good, but it's not free. I know the Intel VTune, but it's not free either.
CodeXL has now superseded the End Of Line'd AMD Code Analyst and both are free, but not as advanced as VTune.
There's also Sleepy, which is very simple, but does the job in many cases.
Note: All three of the tools above are unmaintained since several years.
Very Sleepy is a C/C++ CPU profiler for Windows systems (free).
Proffy is quite cool: http://pauldoo.com/proffy/
Disclaimer: I wrote this.
There is an instrumenting (function-accurate) profiler for MS VC 7.1 and higher called MicroProfiler. You can get it here (x64) or here (x86). It doesn't require any modifications or additions to your code and is able of displaying function statistics with callers and callees in real-time without the need of closing application/stopping the profiling process.
It integrates with VisualStudio, so you can easily enable/disable profiling for a project. It is also possible to install it on the clean machine, it only needs the symbol information be located along with the executable being profiled.
This tool is useful when statistical approximation from sampling profilers like Very Sleepy isn't sufficient.
Rough comparison shows, that it beats AQTime (when it is invoked in instrumenting, function-level run). The following program (full optimization, inlining disabled) runs three times faster with micro-profiler displaying results in real-time, than with AQTime simply collecting stats:
void f()
{
srand(time(0));
vector<double> v(300000);
generate_n(v.begin(), v.size(), &random);
sort(v.begin(), v.end());
sort(v.rbegin(), v.rend());
sort(v.begin(), v.end());
sort(v.rbegin(), v.rend());
}
Microsoft has the Windows Performance Toolkit.
It does require Windows Vista, Windows Server 2008, or Windows 7.
Another profiler is Shiny.
​​​​​
I highly recommend Windows Performance Analyzer (WPA) part of the Windows Performance Toolkit. The command line Windows Performance Recorder (WPR) tool records Event Tracing for Windows (ETW) logs that can be analyzed later using the Windows Performance Analyzer tool. There are some great tutorials on learning how to use the tool.
wpr.exe -start CPU
...
wpr.exe -stop output.etl
wpa.exe output.etl
I use AQTime, it is one of the best profiling tools I've ever used.
It isn't free but you can get a 30 day trial, so if you plan on a optimizing and profiling only one project and 30 days are enough for you then I would recommend using this application. (http://www.automatedqa.com/downloads/aqtime/index.asp)
Please try my profiler, called cRunWatch. It is just two files, so it is easy to integrate with your projects, and requires adding exactly one line to instrument a piece of code.
http://ravenspoint.wordpress.com/2010/06/16/timing/
Requires the Boost library.
I used Luke Stackwalker and it did the job for my Visual Studio project.
Other interesting projects are:
Proffy
Dyninst
I've used "TrueTime - part of Compuware's DevPartner suite for years. There's a [free version](you could try Compuware DevPartner Performance Analysis Community Edition.) available.
I use VSPerfMon which is the StandAlone Visual Studio Profiler. I wrote a GUI tool to help me run it and look at the results.
http://code.google.com/p/vsptree/
You can use EmbeddedProfiler, it's free for both Linux and Windwos.
The profiler is intrusive (by functionality) but it doens't require any code modifications. Just add a specific compiler flag (-finstrument-functios for gcc/MinGW or /GH for MSVC) and link the profiler's library. It can provide you a full call tree or just a funciton list. It has it's own analyzer GUI.