Where is my profiling output when using code::Blocks IDE? - c++

I am trying to profile some code of mine for the very first time. I activated profiling in my IDE options and deactivated optimization. However I have no clue about where the file which contains my profiling output is.
Could anybody explain this to me?
The end goal is to know how much time is spent in each function of my code.

Related

Coverage.py not giving valid results

I was hoping someone could explain how coverage.py works since after reading the documentation on it I am still rather confused. I am attempting to figure out code coverage by a TestCase class and the results haven't been very logical, particularly since after commenting out large chunks of tests the percent missing remains the same. I am working in the community version of PyCharm and haven't been able to find any alternatives to coverage.py so if you could recomend another option that would be appreciated too.

Microsoft Visual Studio Express 2012 will not run a single program

Let me apologize in advance for the new-guy quality of this question. I would much rather be asking a question about something more interesting, like a challenging Project Euler question or evolutionary algorithms, but alas I am stuck with major VSE 2012 problems.
Up until around four hours ago, VSE 2012 worked perfectly fine. Now, I can't even run a simple "Hello, World" program. No compile errors, although I did have an issue with symbols not being found at the beginning of this nightmare, but I managed to resolve that. It compiles, but it does not run. The console window appears, but no output is displayed, no prompt for input is displayed, nothing is processed. All that appears is the "Please press any key to continue..."
I'm starting to think that my configuration of VSE is corrupted, that maybe I need to uninstall, reboot, and reinstall it all, but I'm hoping that's not the case. My version of VSE is up to date, as is my redistributable. My specs are pretty normal, XPS 15z run-of-the-mill laptop running Windows 7, handled VSE perfectly fine for several months until now.
Since VSE started to act up I have been operating through the command line, although I'm really starting to miss an IDE for C++, it just isn't the same. If VSE doesn't start looking up, I'll just have to get a plug-in for Eclipse or actually put in the time to learn how to use Emacs (maybe this is a sign? haha).
I'm sorry for the rant. Has anyone experienced problems like this? The problem isn't that my program is running too quickly (at least I don't think), since prompting for user input doesn't work, nor does the dreaded system("pause").
Any help will be greatly, greatly appreciated. Let me know if you need more information.
Reinstall it. If it's compiling and running correctly through the command line then it's a problem with VS.
Considering the issue with the symbols, it sounds like you have the choice of either reinstalling or spending a potential several hours fixing some super specific configuration corruption case.

How can I get code coverage using gtest on Windows?

I am using gtest for testing my code in C++ with Visual studio 2010. But I could not able to makeout that I have reached 100% code coverage. To make sure that I have covered 100% code coverage, I would like to know that, is there any way to find out the code coverage gtest or not? Because I have Googled a lot but I did not find any possible way to get the code coverage result by using gtest in Windows enviornment. If it is possible please let me know.
Thanks A Lot..
You can try OpenCppCoverage: https://github.com/OpenCppCoverage/OpenCppCoverage.
It is open source, designed for Visual Studio C++ and works well with Google Test.
I already used successfully for mid size project (~500 000 lines of code).
Hope that help.
Disclaimer: I am the author of the tool.
Code coverage in C++ can not be handled by the testing framework solely, because a coverage analysis tool has to know the whole extent of the code (wich the testing framework has not) and it has to instrument the code under test somehow to monitor wich parts of the code get executed.
I had the same desire like you once, wanting to measure my test coverage in MSVC. This is what I learned:
MSVC ships with some command line tools for these instrumentations, googling a bit will get you one or two msdn blog posts about how to use them. Frankly, its not very convenient and easy to use. If you look for third party tools, you will probably not find any free ones. Any tools I found at all were enterprise tools with license fees in the range of several hundred to more than a thousand dollars, so not really an option if you are not a company.

Find out where application is hanging

Is there a way to figure out where an application is hanging and not completing its function? I opened the call stack but it is empty. What does this mean. Does anyone have any advice for debugging where an application was the moment it started to hang/become non responsive.
Edit: I am using Visual Studio 2010
When this happens to me, I find attaching the Very Sleepy profiler to the debugee often makes it easy to identify where the hang occurred, even if you attach it after it happened - just look for stackframes that were active for 100% of the profiler sampling session (by sorting the list by the "Inclusive %" column and looking at the top).
Compile your application with all warnings enabled and with the compiler producing debugging information. On Linux, that means g++ -Wall -g. Work on the source code till you got no more warnings. Learn to use a debugger (e.g. gdb on Linux), and use its step by step abilities.
But we can't help you more, because this is system dependent and you did not tell what system you are using and you did not show us the code you are debugging.
Read How To Debug Small Programs
In addition to using the debugger, run a profiler through the code. My VS is rather rusty, so I can't give details on how to do so, but google can help.
It would also help to have many small functions instead of few large ones, as the tightest granularity of the profile is function level.
Put log statements into the code. It is time consuming but some sort of divide and conquer approach should help you solve the problem.

Google Performance Tools (profiler) tutorial

I just downloaded and built the libraries/executables of Google Performance Tools. Before I run the CPU profiler on the application that I want to investigate, I want to learn how to use the tools properly perhaps on a sample application. What would be a good example to run the Google CPU profiler on? Thanks in advance.
The following paragraph appears in the README.windows file distributed with perftools 1.3:
The heap-profiler has had a preliminary port to Windows. It has not been well tested, and probably does not work at all when Frame Pointer Optimization (FPO) is enabled -- that is, in release mode. The other features of perftools, such as the cpu-profiler and leak-checker, have not yet been ported to Windows at all.
In my experience, for performance tuning, stack-sampling is the method of choice.
Google perftools contains a stack-sampler, and I believe its visual analyzer can be made to show the cost of individual statements, not just functions.
What you need to know is the percent of time the stack contains that statement, because that is how much time would be saved if the statement were removed.