Forum Discussion

yoichi's avatar
yoichi
New Contributor
15 years ago

Using AQTime and .NET Unmanaged Profiling API Simultaneously

Hi,



I'm having problems with profiling the .NET application that is a subject to .NET unmanaged API, specifically Profiling API. Please note that this NOT the Visual Studio built-in profiler.



I have created my own profiler in accordance with .NET unmanaged API guidelines (http://msdn.microsoft.com/en-us/library/bb384493.aspx#profiling_api) and registered it in the system (e.g., regsvr32.exe, COR_ENABLE_PROFILING=1, etc.) At some point my custom profiler is loaded into .NET process and granted access to original application. This works just fine.



What I am trying to do is to measure the performance of my profiler (yes, I'm profiling the profiler since there are limitations on overhead it can bring to the application being profiled) using the AQTime. To do that I setup a project and include two modules in it, i.e. original .NET application (e.g., MyApplication.exe) and my Win32 profiler (e.g., MyProfiler.dll.) The selected profiler is Performance Profiler.



The problem is that: 1) I don't see my profiler's DLL is loaded at all in AQTime event log, 2) It is actually not loaded since my profiler does not report anything (i.e. no log files created.) If I run my application normally everything works fine.



Did anyone have the same problem with AQTime and .NET Profiling API? Any help would be much appreciated.

2 Replies

  • yoichi's avatar
    yoichi
    New Contributor
    Hello again,



    It seems that AQTime clears COR_ENABLE_PROFILING and COR_PROFILER environment variables on all processes it runs. Is there an option to disable that behavior? Does anyone know?

  • Hello John,





    You are right - AQtime uses the same technique as that used by your own profiler.

    You can't have two CLR profilers in one process, so you will not be able to profile the data-gathering part of your profiler.





    Why are you trying to implement your own profiler? Are there any functions you need that are not present in AQtime?

    BTW, it is possible to create custom profilers for AQtime - check the "<AQtime>\Help\AQtime6SDK.chm" help file to learn more about this. Probably, this approach can be better in your case.