Profiling VC7/VC71 generated code 
Author Message
 Profiling VC7/VC71 generated code

Hi,

  I wonder whether the Microsoft Visual C++ 6.0 profiling tools
prep.exe, profile.exe and plist.exe are supposed to work with VisualC++
7.0 or 7.1. The linker still supports the /profile option, at least
MSDN / Visual C++: Getting Started / C++ Compiler, Linker, and C++
Language reads:

  * The /PROFILE linker option has been removed. If you are using a
    third party profiler that needs /PROFILE, you should instead use
    /FIXED:NO. In this version, the linker will still accept /PROFILE
    as a synonym for /FIXED:NO.

Now I have e.g. the following code:

  #include <stdlib.h>
  #include <stdio.h>

  void baz(void)
  {
    printf("Hello World!\n");
  }

  void bar(void)
  {
    baz();
  }

  void foo(void)
  {
    bar();
  }

  int main(void)
  {
    foo();
    bar();
    baz();
    return EXIT_SUCCESS;
  }

Compiled using `cl main.c /link /profile` with Visual C++ 6.0. Calling
the profiler through the Visual C++ 6.0 fcount.bat bach file I get

[...]
         3  42,9 _baz (main.obj)
         2  28,6 _bar (main.obj)
         1  14,3 _foo (main.obj)
         1  14,3 _main (main.obj)
[...]

If the source is compiled using the same command line with Visual C++
7.0 or 7.1 I get no listing. Fcount.bat finds the four functions but
does not list any calls to it. For more complex projects I get some
function calls listed, but certainly not an accurate listing. Using
/fixed:no instead of /profile does not change that. The MSDN article
quoted above also says

  * /MAPINFO:FIXUPS has been removed.

Then I tried Visual C++ 7.0 using `cl main.c /link /profile
/mapinfo:fixups`. The linker does not complain about the "removed"
config option, in fact, it puts the FIXUPS info into the map file and
suddenly profiling works as expected.

Hmm?



Sun, 23 Oct 2005 11:54:33 GMT  
 Profiling VC7/VC71 generated code

Quote:

> Hi,

>   I wonder whether the Microsoft Visual C++ 6.0 profiling tools
> prep.exe, profile.exe and plist.exe are supposed to work with
> VisualC++  7.0 or 7.1.

No, this is not expected to work.

In order for the VC 6 profile tools to work, the project must be
instrumented with code that's injected by the compiler, and then linked with
the profiling library.  The VC7+ compiler no longer does the necessary code
injection.

To profile VC7 or VC7.l apps, MS recommends using a 3rd party profiler -
Compuware DevPartner or Intel VTune both come to mind.  If you've purchased
Visual Studio .NET, you can get DevPartner Profiler from CompuWare for no
charge (at least you used to be able to).  I don't know if the free version
has any limitations - never tried it.

-cd



Sun, 23 Oct 2005 21:19:41 GMT  
 Profiling VC7/VC71 generated code
Hello,

Check:
http://www.compuware.com/products/devpartner/profiler/default.asp


Quote:
> Hi,

>   I wonder whether the Microsoft Visual C++ 6.0 profiling tools
> prep.exe, profile.exe and plist.exe are supposed to work with VisualC++
> 7.0 or 7.1. The linker still supports the /profile option, at least
> MSDN / Visual C++: Getting Started / C++ Compiler, Linker, and C++
> Language reads:

>   * The /PROFILE linker option has been removed. If you are using a
>     third party profiler that needs /PROFILE, you should instead use
>     /FIXED:NO. In this version, the linker will still accept /PROFILE
>     as a synonym for /FIXED:NO.

> Now I have e.g. the following code:

>   #include <stdlib.h>
>   #include <stdio.h>

>   void baz(void)
>   {
>     printf("Hello World!\n");
>   }

>   void bar(void)
>   {
>     baz();
>   }

>   void foo(void)
>   {
>     bar();
>   }

>   int main(void)
>   {
>     foo();
>     bar();
>     baz();
>     return EXIT_SUCCESS;
>   }

> Compiled using `cl main.c /link /profile` with Visual C++ 6.0. Calling
> the profiler through the Visual C++ 6.0 fcount.bat bach file I get

> [...]
>          3  42,9 _baz (main.obj)
>          2  28,6 _bar (main.obj)
>          1  14,3 _foo (main.obj)
>          1  14,3 _main (main.obj)
> [...]

> If the source is compiled using the same command line with Visual C++
> 7.0 or 7.1 I get no listing. Fcount.bat finds the four functions but
> does not list any calls to it. For more complex projects I get some
> function calls listed, but certainly not an accurate listing. Using
> /fixed:no instead of /profile does not change that. The MSDN article
> quoted above also says

>   * /MAPINFO:FIXUPS has been removed.

> Then I tried Visual C++ 7.0 using `cl main.c /link /profile
> /mapinfo:fixups`. The linker does not complain about the "removed"
> config option, in fact, it puts the FIXUPS info into the map file and
> suddenly profiling works as expected.

> Hmm?



Sun, 23 Oct 2005 22:41:58 GMT  
 Profiling VC7/VC71 generated code
* Carl Daniel [VC++ MVP] wrote in microsoft.public.dotnet.languages.vc:

Quote:
>>   I wonder whether the Microsoft Visual C++ 6.0 profiling tools
>> prep.exe, profile.exe and plist.exe are supposed to work with
>> VisualC++  7.0 or 7.1.

>No, this is not expected to work.

>In order for the VC 6 profile tools to work, the project must be
>instrumented with code that's injected by the compiler, and then linked with
>the profiling library.  The VC7+ compiler no longer does the necessary code
>injection.

Then why do I get the expected results using the allegedly removed
/MAPINFO:FIXUPS linker option? Why are the profiling tools no longer
included in Visual C++?

Quote:
>To profile VC7 or VC7.l apps, MS recommends using a 3rd party profiler -
>Compuware DevPartner or Intel VTune both come to mind.  If you've purchased
>Visual Studio .NET, you can get DevPartner Profiler from CompuWare for no
>charge (at least you used to be able to).  I don't know if the free version
>has any limitations - never tried it.

No command line support :-(


Mon, 24 Oct 2005 00:33:29 GMT  
 Profiling VC7/VC71 generated code

Quote:

> * Carl Daniel [VC++ MVP] wrote in
> microsoft.public.dotnet.languages.vc:
>>>   I wonder whether the Microsoft Visual C++ 6.0 profiling tools
>>> prep.exe, profile.exe and plist.exe are supposed to work with
>>> VisualC++  7.0 or 7.1.

>> No, this is not expected to work.

>> In order for the VC 6 profile tools to work, the project must be
>> instrumented with code that's injected by the compiler, and then
>> linked with the profiling library.  The VC7+ compiler no longer does
>> the necessary code injection.

> Then why do I get the expected results using the allegedly removed
> /MAPINFO:FIXUPS linker option? Why are the profiling tools no longer
> included in Visual C++?

The VC team decided that they'd rather ship no profiler at all instead of a
lousy one.

Quote:

>> To profile VC7 or VC7.l apps, MS recommends using a 3rd party
>> profiler - Compuware DevPartner or Intel VTune both come to mind.
>> If you've purchased Visual Studio .NET, you can get DevPartner
>> Profiler from CompuWare for no charge (at least you used to be able
>> to).  I don't know if the free version has any limitations - never
>> tried it.

> No command line support :-(

Oh well.

-cd



Mon, 24 Oct 2005 00:43:21 GMT  
 Profiling VC7/VC71 generated code
You might also want to take a look at AutomatedQA's excellent QTime
product.  http://www.automatedqa.com

Cheers...



Wed, 26 Oct 2005 11:26:53 GMT  
 Profiling VC7/VC71 generated code
Hi,

I suppose you have used QATime? If yes, I've a question to you. In the docs
they are talking about profiling a Debug build of an application. But that
seems of practical no use to me because the code then generated by the
compiler is not the same as the highly optimized code generated by a release
build.

Can QATime profile release builds too?

Ferdinand.


Quote:
> You might also want to take a look at AutomatedQA's excellent QTime
> product.  http://www.automatedqa.com

> Cheers...



Wed, 26 Oct 2005 21:34:12 GMT  
 Profiling VC7/VC71 generated code
It can profile release builds (as long as you have PDB's).
I did run into a problem w/ 3.0 (it's at 3.01 now I believe) that it
couldn't read the .pdb's my company generated for release builds.
We were using /debugtype:both for release builds (so Dr. Watson could
get the data it needs), but AQTime didn't like two formats being in the
PDB's.  They fixed it within a couple of days and sent me a patch.
I'm assuming it's rolled into 3.01 now (haven't verified it).

I haven't had a chance to try AQTime w/ VC 7.x though.  We're still
using VC6 for our compiles and aren't scheduled to (try to) switch until
next year.  7.0 was so buggy (7.1 seems to have its share as well) that
we pushed back the switch.



Thu, 27 Oct 2005 00:06:20 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. VC7 / VC71 iterator_traits, reverse_iterator, distance

2. VC71 c++ internal compiler error (with very simple code)

3. VC71 final beta - Reject valid C++ code snippet

4. Profiling in VC7 vs VC6

5. Profiling C++ Code to find slow code

6. How to generate execution profile of C++ program?

7. Generate Option in VC7

8. VB6 can call into typelib generated using VC7?

9. Size of generated objects files for VC7

10. drwtsn32 dont find pdb files generated by VC7

11. BUG with VC7 RC1 with an MFC AppWizard generated CEditView project

12. Faster Exe generated from VC7?!?!

 

 
Powered by phpBB® Forum Software