For programs linked with shared libraries, Quantify instruments the code in each shared library and records data from functions in those libraries. Quantify does not instrument the dynamic linker itself, the program responsible for loading the shared libraries into the running process and resolving references to entry points and data within those libraries. These dynamic-linking operations, including calls to dlopen under Solaris 2, and shl_load under HP-UX, can take a substantial amount of time.
Quantify measures the elapsed time of dynamic-linking operations.
You can use the -record-dynamic-library-data option to control whether Quantify records time for dynamic linking. The default is -record-dynamic-library-data=yes.
To specify how Quantify measures time for dynamic linking, use the -measure-timed-calls option. The default is -measure-timed-calls=elapsed-time. This option also controls how Quantify measures times for system calls. If you change how Quantify measures time for system calls, you also change how it measures time for dynamic linking.
Most dynamic linkers perform an initial link of a shared library and then, as individual functions in that library are called, the final references are resolved once and a procedure linkage table (PLT) is updated by the dynamic linker so that subsequent calls to this function are processed directly. Quantify does not measure the time required to patch these PLT entries.
If the program attempts to open a dynamic library at run time that has not been instrumented, Quantify automatically instruments the library. Quantify does not measure the time required to instrument the library. Quantify records only the time required to open the instrumented library and link it into the process.
Each operating system implements dynamic library initialization and support differently. As a consequence, when Quantify times dynamic library operations it often reports the times in different functions and files.
On Solaris 2, the dynamic linker ld.so is loaded by the standard program interpreter before the program is started, so Quantify cannot time this loading operation. Each dynamic library contains init and fini code that is run after the library is loaded. Quantify reports these times under the init[<dynamic_library_name>] and fini[<dynamic_library_name>] functions. Quantify records dynamic library loading at run time in the dlopen function.
On HP-UX, the dynamic loader dld.sl is loaded by a function in the file crt0.o before start calls main. After dld.sl is loaded into memory, start calls it and it loads the initial set of dynamic libraries into memory and initializes them. Quantify times both the initial load of dld.sl and the initialization operations and attributes the times to the _p___map_dld function. Quantify records dynamic library loading at run time in the shl_load function.
Note: Unmapping dynamic libraries using dlclose on Solaris 2, and shl_unload on HP-UX, causes Quantify to attribute data to incorrect functions. Therefore, Quantify intercepts these functions and prevents the unmapping of dynamic libraries.