-
Notifications
You must be signed in to change notification settings - Fork 0
Notes
- To build memlogger in dual ABI environments (32/64 bit) use the following commands:
# 64 bit (GCC, most platforms)
./configure 'CXXFLAGS=-m64' --libdir=/usr/local/lib/64
make clean && make && make install-strip
# 32 bit
./configure 'CXXFLAGS=-m32' --libdir=/usr/local/lib
make clean && make && make install-strip
It may also be necessary to create symlinks in system/trusted library directories for simplified preloading without the full absolute path and auto-selecting the appropriate bit on preloading as follows:
export LD_PRELOAD=libmemlogger.so
Important: On Linux do not forget execute command as root:
printf "/usr/local/lib/\n/usr/local/lib/64/\n" > /etc/ld.so.conf.d/memlogger.conf && ldconfig
On Solaris just add the library paths to the corresponding crle configs.
- Note: inner malloc calls (inside realloc/calloc/dlsym/fprintf etc.) will not logged, so they will not count. Also note that using a logger can noticeably slow down the profiled application.
Remember that counting allocations per second is implemented in its simplest form as the ratio of the number of calls to the allocation function divided by the difference between the timestamps of the first and last function calls. This is quite enough for a rough estimate of the number of allocations per second during the logging period. This ratio, in addition to the distribution of allocations by chunk size, average allocations per second and peak allocations values, is of interest to us to assess the possible overhead from memory allocations.
To assess the nature of the distribution of allocations over time, the ratio of the average number of allocations and peak values, as well as the profiling time of the application, is used. If the average number of allocations is numerically close to the peak, allocations are performed relatively evenly over the profiling period. If the average value is much less than the peak value, the bulk of allocations occurs at the startup of the application and at the beginning of its operation.
Please remember that this is true for relatively short profiling periods. With long-term measurements, the average values, as a rule, decrease significantly. It is recommended that the profiling period be consistent with the application's main work cycles.
- To make logger library statically linked with libstdc++, do the follows (example):
cd src
export CXXFLAGS=-m64
ln -s `g++ $CXXFLAGS -print-file-name=libstdc++.a` libstdc++.a
unset CXXFLAGS
cd ..
./configure 'CXXFLAGS=-m64' 'LDFLAGS=-static-libstdc++ -L.'
then make and install.