system profiling - usage information of shared libraries

342 Views Asked by At

Is there any way to know which library files are being used by which process (or by how many number of process) in some amount of time.

Can V-Tune or perf or OProfile be used for this?

2

There are 2 best solutions below

0
On BEST ANSWER

Is there any way to know which library files are being used by which process (or by how many number of process)

You can take a snapshot by cat /proc/*/maps > /tmp/snapshot and then use grep and wc to answer your question.

If you want to monitor the system for some period of time, you could take the snapshot every second or so.

Can V-Tune or perf or OProfile be used for this?

You can do perf record -a, then perf script -D and look for PERF_RECORD_MMAP events.

0
On

At any moment, one can list all shared-libraries within the process map of a particular process-pid

cat /proc/<pid>/maps | grep <name of library>

process maps


Also one can check the list of running processes that have opened a particular shared library

lsof <path-to-shared-library-file>

lsof shared lib