Linux-Process Tracking
Linux-Process Tracking
Strace method:
Strace XXX-o ttt --- trace the system calls of XXX execution process calls and save the results to the ttt File
Strace-c XXX --- tracking the duration of every system call of XXX
Strace-f XXX --- trace all processes of XXX, including system calls of sub-Processes
Strace-e trace = open, write XXX --- tracking open and write system calls of XXX execution process calls
Strace-e trace = network-p 24567 --- all network-related system calls of the 24567 Process
Ltrace method:
Ltrace-s XXX --- trace system calls and library function calls
Ltrace-e strcpy, strlen XXX --- trace the strcpy and strlen library functions called by the Process
Ltrace-l/lib64/librt. so.1 XXX --- trace the library functions in the specified dynamic library called by XXX
Valgrind method:
The tool is not installed by default and must be manually installed.
Valgrind -- tool = memcheck -- trace-children = yes XXX
--- Use valgrind's memcheck tool to perform memory detection on XXX commands.
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
This article permanently updates the link address: