We help IT Professionals succeed at work.

speed-up DLLs: DLL profiling (VC++) resp. profile-based optimization (Intel-C++)

Rilf asked
Watch Question


'no text' maybe a little too short though :--) Sorry, my error!


I am programming a DLL that is speed-relevant. It is loaded by an application that I don't have the source code of. My DLL is somehow a plug-in (plain Win32 dll).

How do I...
a) ...use the VisualC++'s profiler to profile the DLL. I followed the description, but got only results for functions that were called out of DLLMain(). I am pretty sure that the host application creates a new thread each time it calls one of my functions.

b) ... use Intel-C++'s profile-based optimization for a dll. It works fine for a exe-file, but I don't know how to run the profile-feedback compilation for dlls. I can't compile an exe, optimize it and load it as a dll, can I?

Thanks a lot!
I would strongly suggest that you do exactly this: build a thin exe wrapper that represents the use cases of your DLL, compile it with the DLL sources as a monolythic EXE, and profile it as usual. I believe that the DLL overhead is insignificant unless your DLL is loaded/unloaded all the time, or is called extremely often.

But if either of these cases is relevant, you should optimize DLL wrappers (generated by C++), not your code.

You should pay attention to multithreading scenarios, and emulate them in your profiling application as close as possible.

Have you tried using one of the non-MS profiling tools - VTune (Intel), Quantify, TrueTime?

At least with Intel's VTune I know that you can get hotspots and call graph information for your DLL even if you don't have sources for the executable that loads the DLL.

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to accept "alexcohn, boazt" comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: http://www.experts-exchange.com/commspt


Explore More ContentExplore courses, solutions, and other research materials related to this topic.