简体   繁体   English

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

[英]system profiling - usage information of shared libraries

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? 可以使用V-Tune或perf或OProfile吗?

At any moment, one can list all shared-libraries within the process map of a particular process-pid 任何时候,都可以列出特定进程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>

lsof共享库

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. 您可以通过cat /proc/*/maps > /tmp/snapshot ,然后使用grepwc回答您的问题。

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? 可以使用V-Tune或perf或OProfile吗?

You can do perf record -a , then perf script -D and look for PERF_RECORD_MMAP events. 您可以执行perf record -a ,然后执行perf script -D并查找PERF_RECORD_MMAP事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM