Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
5106 Discussions

Using VTune to analyze an attached process C++/Fortran pgm

AONym
New Contributor II
555 Views
I am looking for information on how to determine CPU usage in various parts of my pgm--this is what I believe is the purpose of VTune.

I have a large C++ and Fortran app (Fortran is in a library), running Win XP32. I'd like to do the analysis on certain parts of this pgm, so I am attempting to do the following:

1) Start the pgm.
2) Get it to the point where I can click a button to start calculations which I want to profile.
3) Let VTune collect data until I tell it to stop.
4) Have VTune analyze the results.

Sounds pretty straightforward, right? But, I get errors at every step of the way.

Problem 1) Identifying the process to be analyzed. I create a new project, choose "Attach to Process" as the target type. ERROR: Cannot find running process with the specified name (I have not specified a name). What is a "Process name"? This is not standard Windows nomenclature. In order to proceed, I have to open Task Manager and look up the process ID. When I input the PID, I can continue.
Problem 2) Collecting data. I select New... / Analysis ... from the File menu. I run the pgm to the desired starting point, then click VTune's Start button. VTune says "Collecting Hotspots data". All appears OK until the pgm has completed its calculations and the Fortran thread terminates. Now VTune gives "Collection failed" error, and terminates my pgm. Error is "Failed to write probes in process, can't complete attach."
Problem 3) Viewing results. There seems to be nowhere to go from here. VTune has apparently discarded all the data it collected. There is nothing under File / Recent Results.
Problem 4) Stopping analysis. Per the VTune doc, "Attaching to a Process", I start data collection, then click Stop before the calculation is complete. Now VTune tells me "Analysis is completed successfully", followed by "Failed to finalize the result". Clicking Re-resolve gives the same error message.

Can anyone tell me how to do this, or point me to documentation that does so?
0 Kudos
4 Replies
Mark_D_Intel
Employee
555 Views

You might also try using VTune to launch your process while starting with data collection paused. (Set the target to 'Launch Application', use the 'Start Paused' button start it. Then when your program reaches the point you wish to profile, press the 'Resume' button)
0 Kudos
TimP
Honored Contributor III
555 Views
Your description seems to indicate you should be interested in the VTune "API" to turn data collection on and off by adding function calls in your program.
0 Kudos
virtualmemory
Beginner
555 Views
Doesn't work.

When I launch the process while starting with data collection paused (from VS2005), the application is launched, and an informational message box (from my app) appears--this is normal behavior for the app.

If I click OK on my app's message box, which I must do to proceed, VTune almost immediately says "Analysis has completed successfully", then "Finalizing results", "Completed successfully", and the results are empty.

All this occurs without my having started data collection by clicking Resume.
0 Kudos
David_A_Intel1
Employee
555 Views
Does the app that puts up the message box launch another process and then terminate? VTune Amplifier XE is watching the process that it started. If it terminates, it assumes data collection should terminate.
0 Kudos
Reply