手机版
你好,游客 登录 注册
背景:
阅读新闻

Linux--- 进程跟踪手段

[日期:2015-04-18] 来源:Linux社区  作者:Linux [字体:大 中 小]

Linux--- 进程跟踪手段

strace方法:
strace XXX -o ttt  --- 跟踪XXX执行过程调用的系统调用,结果保存到ttt文件

strace -c XXX --- 跟踪XXX每次调用系统调用耗费时长

strace -f XXX --- 跟踪XXX所有进程包括子进程的系统调用

strace -e trace=open,write XXX  ---跟踪XXX执行过程调用的open、write系统调用

strace -e trace=network -p 24567  ---跟24567进程所有与网络有关的系统调用

ltrace方法:
ltrace –s XXX  --- 跟踪系统调用和库函数调用

ltrace –e strcpy,strlen XXX --- 跟踪进程调用的strcpy、strlen两种库函数

ltrace -l /lib64/librt.so.1 XXX --- 跟踪XXX调用的指定动态库中的库函数

valgrind方法:
默认没有安装,必须手工安装该工具。

valgrind --tool=memcheck --trace-children=yes XXX

--- 使用valgrind的memcheck工具对XXX命令执行内存检测。

memcheck

Detects memory errors. It helps you tune your programs to behave correctly.

cachegrind

Profiles cache prediction. It helps you tune your programs to run faster.

callgrind

Works in a similar way to cachegrind but also gathers additional cache-profiling information.

exp-drd

Detects thread errors. It helps you tune your multi-threaded programs to behave correctly.

helgrind

Another thread error detector. Similar to exp-drd but uses different techniques for problem analysis.

massif

A heap profiler. Heap is an area of memory used for dynamic memory allocation.This tool helps you tune your program to use less memory.

lackey

An example tool showing instrumentation basics

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-04/116393.htm

linux
相关资讯       Linux进程  Linux跟踪进程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款