4

I have a simple (not so simple) win32 console application in c++. I would like to profile this application, but when I try to:

DEBUG > Start Performance Analysis

An error occurs: "No launchable projects are available for profiling".
Please note that the project compiles and runs normally. It's jus the profling that is not working.

How can I solve? I am on Windows 8 with Visual Studio Ultimate 2012

Note that I choose for this project a simple:

File > New Project > Win32 > Win32 Console Application (C++)

I would like to obtain something like xcode does.

A simple list for each functions or methods the cumulative time of usage.

This is the error when I try "Start performance analysis"

enter image description here

Note

I have tried both release mode and debug mode with both x64 and or Win32

enter image description here

Note2

In this project I have created two custom property sheet (to include the right opencv libraries)

- OpenCV-Release
- OpenCV-Debug

Note3

enter image description here

dynamic
  • 46,985
  • 55
  • 154
  • 231
  • How was your project file generated? What is your target platform? – David Schwartz Jun 02 '13 at 23:52
  • File > New Project > Win32 > Win32 Console Application – dynamic Jun 02 '13 at 23:53
  • 1
    [*Try this.*](http://stackoverflow.com/a/378024/23771) – Mike Dunlavey Jun 03 '13 at 11:50
  • Wow that's long. I simply would like to display for each function used in my code (or for each method) the cumulative time they took to elaborate. Something like xcode: http://i.stack.imgur.com/Azl3G.png – dynamic Jun 03 '13 at 14:23
  • Take N=10 stack samples. For each function that appears on any sample, let S be the number of samples it appears on. Then its inclusive % is roughly S/N. Its "self time" is the fraction of time it appears at the end of a sample. Functions with small percents are not likely to appear. For performance analysis, chances are you're after the big ones, not the small ones. It also gives you line-level information, variable context, & anything else you might need if you wish to make the program faster. – Mike Dunlavey Jun 03 '13 at 16:02
  • i think its absurd visual studio cant do that list itself... it's even the ultimate version – dynamic Jun 03 '13 at 18:30
  • 1
    You are complaining about something it can't do before you even got started. You do need to get the program running first. Hard to guess what might be wrong, a screenshot would help. Of VS, not some other IDE. Shooting off the hip, I'd guess that the EXE project isn't selected as the startup project. And it needs to be built without errors. Nothing much else to guess at from the provided info. – Hans Passant Jun 09 '13 at 16:30
  • @Hans: I will take a screen tho it's not in english. Anyway the projects builds and runs without any problems. It's just the start performance analysis that doesn't work – dynamic Jun 09 '13 at 17:21
  • @HansPassant: this is the error: http://i.stack.imgur.com/g2wEp.png (there is really not that much to see) – dynamic Jun 09 '13 at 20:28
  • yvette can you be a little more specific? – dynamic Jun 10 '13 at 07:49
  • @Yvette: No I didn't it! I created a project in a folder and then I have added "Existing item" inside my project – dynamic Jun 11 '13 at 15:23
  • I have one .cpp file (the main.cpp) and all other files are .hpp – dynamic Jun 11 '13 at 16:01

1 Answers1

0

Open the projects properties.> Configration Manager > Active Solution Platform > select New > and follow my screen shot. Your perfomance analysis will run after this.

The project is not being recognised, as you have it configured with x64. (As evidenced by your first screenshot under Note)

Win32

As your project is created in the 64bit os, you need to manually link the project with the win32 sys, so the profiler will recognize the project as a win32 project.

http://en.wikipedia.org/wiki/Windows_API

I will leave this here, as it may be useful for some users.

Saving projects in Visual Studio, must be done methodically and consistently.

If a project is created and saved in a folder (for example) Folder A within the C drive and then later the folders are rearranged and the project is then in Folder A, but folder A has been moved to the D drive (or any variation of changes). Visual Studio, will not be able to find the project.

Be sure to check that all your files for this project are in the correct folders. You need to open the sub folder and make sure that all the files for your project are present.

Please see my screen shots. It doesn't matter why my folders are arranged, as they are, suffice to say, I have found it easier to keep them with the program files in the C drive.

Please note the file in the first screen shot extension vspx, is a visual studio performance report.

Visual Studio Project Folder

Visual Studio Sub Folder

This may or may not answer your question. Please advise if you need more assistance.

The short cut-

VS Release

The long steps - which give you more options

VS Debug menu VS Configuration button VS Configuraion Manager Please try this (it is the same answer on both links):

<ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
</ProjectConfiguration>

http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/56dcdb2a-5e30-4015-bc14-244f99f07b8b

Profiling with CMake, C++, and Visual Studio 2012

And this link as well.

Add the files to a directory outside of the project and then reference those directories in the "Additional Include Directories" in Properties -> Configuration Properties -> C/C++ -> General.

VC++ Visual Studio added .hpp files in subdirectory but get "Error: cannot open source file ..."

You can launch the performance wizard, under the Analyze tab.

This is a known bug in VS.

Without seeing your computer, it is hard to know what else, I can suggest. I do know that it's important to go through all the suggested steps to trouble shoot. If I can find anything else, I'll let you know.

Please note my project is a downloaded sample.

Community
  • 1
  • 1
  • yvette maybe its beacuse i have added to my projects only "extern files" ? – dynamic Jun 11 '13 at 15:09
  • I have checked and inside the Project folder `...\Documents\Visual Studio 2012\Projects\OpenCVHelloWorld\OpenCVHelloWorld` there is only the main.cpp file, all other files are extern... What should I do? (note that the projects compiles and runs normally) (Also please note that I didn't have arrange the files) – dynamic Jun 11 '13 at 15:19
  • there is only one main .cpp the rest files are all .hpp files (all these files are extern located in a separated folder). (For now the implementaion is inside the .hpp too) – dynamic Jun 11 '13 at 16:00
  • I have tried both Win32 and x64 Platform. Also I have tried both Release and Debug mode. I am getting always the same error `No launchable projects are available for profiling.` Also the Additional Include Directories are set fine because the project compiles and run normally! – dynamic Jun 11 '13 at 19:29
  • Maybe it's because I have created two custom property sheet "OpenCV-Release" and "OpenCV-Debug" ? (to link the right libraries of opencv) – dynamic Jun 11 '13 at 20:02
  • Because in the debug mode we need to include libraries such that: `opencv_calib3d242d.lib` in the release mode we need to include the same file without the d final: `opencv_calib3d242.lib` I have followed this guide: http://www.anlak.com/using-opencv-2-4-x-with-visual-studio-2010-tutorial/ – dynamic Jun 11 '13 at 20:14