Article ID: 179269 - Last Review: March 21, 2005 - Revision: 2.2 HOWTO: Use Source Profiler to Profile Dynamic-Link LibrariesThis article was previously published under Q179269 On This PageSUMMARY
The 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 INFORMATION
The 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 FileCOPY %1.dll save PREP /OM %1.dll COPY %1._ll %1.dll PROFILE /I %1 /O %1 %2 %3 %4 %5 %6 COPY save %1.dll PREP /M %1 PLIST %1 PROFDLL cards hearts 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 FilePREP /OM /FC wingame.exe aliens.dll hiscore.dll PROFILE wingame.exe PREP /M wingame PLIST wingame >wingame.out
You must combine these two methods when considering larger, more complex projects. First, create self-profiling objects for all items in the profile: PREP /OM /FT myfile.exe import1.dll loadlib1.dll ... Next, use the first method and copy the _LL files over all DLLs loaded using LoadLibrary: copy loadlib1.dll loadlib1.tmp copy loadlib1._ll loadlib1.dll PROFILE myfile.exe PREP /M myfile PLIST myfile >> profile.out
REFERENCES
Visual C++, version 5.0; Profiling DLLs from a Batch File; Profiling
Multiple .dll and .exe Files
URL: mk:@ivt:vccore/F33/D36/S4D19E.HTM URL: mk:@ivt:vccore/F33/D36/S4D19F.HTM Visual C++, versions 2.0, 2.1, 2.2, 4.0, 4.0a, 4.1, 4.2, 4.2b; search on: "Profiling DLLs from a batch file"; "Profiling multiple .dll and .exe files" APPLIES TO
| Article Translations
|
Back to the top
