The information in this article applies to:
SUMMARYThe Microsoft Visual C++ Help discusses two ways to profile a dynamic-link library (DLL), but it does not indicate when to use each example. This article describes a general-purpose method of profiling DLLs. MORE INFORMATIONThe first part of the Help on profiling a DLL describes the use of self- profiling DLLs, using the PREP option /OM. Self-profiling DLLs are not necessary, except when profiling DLLs that are dynamically loaded using the LoadLibrary instruction. Use the following batch file example (name it Profdll.bat) to profile a single DLL, accessed with LoadLibrary. Profdll.bat profiles a DLL with the assumption that the .exe file has not been prepared for profiling. Sample Batch File
If you have a main program (for example, Hearts.exe) that uses a DLL (for
example, Cards.dll) and you want to profile only the DLL, you can run the
batch file as:
Note that the command above generates a warning message that the main
program has not been prepared for profiling. You can ignore this message.
The second example batch file in the Help shows how to profile multiple DLLs as well as the calling executable. This example profiles an executable named "wingame" and two DLLs named "aliens" and "hiscore": Sample Batch File
This method is most effective when the DLLs are loaded at run time, through
the use of an import library. The Source Profiler, however, does not report
any data for a dynamically loaded DLL if you use function profiling. The
maximum number of DLLs that can be profiled this way is:
You must combine these two methods when considering larger, more complex projects. First, create self-profiling objects for all items in the profile:
where "myfile.exe" is the executable program, "import1.dll" is a DLL called
through an import library, and "loadlib1.dll" is a DLL called through the
LoadLibrary and GetProcAddress functions.
Next, use the first method and copy the _LL files over all DLLs loaded using LoadLibrary:
The rest of the procedure is the same as for most profiles:
Putting it all together, you can generalize the process as follows:
REFERENCES
Visual C++, version 5.0; Profiling DLLs from a Batch File; Profiling
Multiple .dll and .exe Files
Additional query words: Profile.dll _LL _XE line profiling
Keywords : kbcode kbVC200 kbVC210 kbVC220 kbVC400 kbVC410 kbVC420 kbVC500 kbVC600 TlsMisc |
Last Reviewed: July 21, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |