系统分析 - 共享库的使用信息

system profiling - usage information of shared libraries

有什么方法可以知道在一段时间内哪个进程(或多少个进程)正在使用哪些库文件。

可以使用 V-Tune 或 perf 或 OProfile 吗?

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>


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

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

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

您可以通过cat /proc/*/maps > /tmp/snapshot进行快照,然后使用grepwc来回答您的问题。

如果你想在一段时间内监控系统,你可以每隔一秒左右拍摄一次快照。

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

您可以 perf record -a,然后 perf script -D 并查找 PERF_RECORD_MMAP 个事件。