Linux--- 进程跟踪手段

strace方法:

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

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

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

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

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

ltrace方法:

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

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

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

valgrind方法:

默认没有安装,必须手工安装该工具。

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

--- 使用valgrindmemcheck工具对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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值