Linux Command Debug Tool strace in-depth analysis _php instance

Source: Internet
Author: User
Reference
1 "Linux strace Command (Detailed)". txt "sina ebook available for download
2man Strace
a complete usage that is basically generic:
Strace-o output.txt-t-tt-e trace=all-p 28979
The above meaning is to trace all system calls (-e Trace=all) of the 28979 process, and to count the time spent on the system call, as well as the start time (and display in the visual hour-in-seconds format), and finally the recorded result exists in the Output.txt file.
several usages that must be remembered
1) strace-p PID can track a background process
2) strace-o filename Output trace results to file
3) Strace-t records the time spent on each system call and can see which system calls are taking a long time
4) Strace-t (or-TT) records the time each system call occurred (in seconds and minutes)
5) Strace-s 1024 shows the system call parameter, for the length of the string display, the default is 32, if the string parameter is very long, a lot of information is not displayed.
6) Strace-e Trace=nanosleep only records the relevant system call information.
-e trace=network//record-only and network API-related system calls
-e trace=file//record only system calls involving file names
-e trace=desc//record only system calls involving file handles
There are other including process,ipc,signal and so on.
A classic, through the Strace view a process of all relevant open file troubleshooting process, refer to the Linux strace command (detailed). txt "sina ebook available for download
If the development program does not have a powerful tool to accompany, then the development efficiency will be very low, even encountered a problem. Now start learning the powerful debug tool strace under Linux and record it here.
Strace
1) similar to Processexp.exe under Windows
can monitor system calls
2) Similar to the Depand tool under Windows
You can check your program's dependent libraries. More powerful than the LDD under Linux.
Reference: Strace command usage
Click to download
Case:
Strace helps me solve the problem of not knowing where the log files are printed.
Tracking server with Strace
/usr/bin/strace-p Pid-o Out.file
Then execute client side, then end strace, view Out.file search Write,open system call
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.