Example of strace in Linux and linuxstrace
The strace parameters are as follows:
-T: the output result is accurate to seconds.
-Tt output results are accurate to subtle
-Ttt is accurate to subtle, and time is expressed as unix Timestamp
-T records the time spent on each system call. You can see which system call takes a long time.
-S 1024 indicates the length of the string displayed when system call parameters are displayed. The default value is 32. If the string parameter is long, a lot of information cannot be displayed.
-O filename: Output trace results to files
-P pid can track a background process
-C: Calculate the execution time, number of times, and number of errors of each system call.
-D: Output strace debugging information about standard errors.
-F: in addition to tracking the current process, it also traces its sub-processes.
-Ff if-o filename is provided, the trace results of all processes are output to the corresponding filename. pid, which is the process number of each process.
-F attempts to trace vfork calls. In-f, vfork is not tracked.
-H outputs brief help information.
-I output the entry pointer of the system call.
-Q: Do not output the message about the disconnection.
-R prints the relative time, which is called by every system.
-V outputs all system calls. Some calls about environment variables, status, input and output are not output by default due to frequent calls.
-V outputs the version information of strace.
-X outputs non-standard strings in hexadecimal format
-Xx all strings are output in hexadecimal format.
-E trace = nanosleep only records relevant system call Information.
-E trace = network only records system calls related to network APIs
-E trace = file: only records system calls involving file names
-E trace = desc only records system calls involving file handles
-E trace = set
-E trace = all
-E strace = signal tracks all system calls related to system signals
-E trace = ipc tracks all system calls related to process Communication
-E abbrev = set the result set of the System Call output by strace.-v and abbrev = none. The default value is abbrev = all.
-E raw = set: displays the system call parameters in hexadecimal format.
-E signal = set indicates the system signal of the trail. The default value is all. For example, signal =! SIGIO (or signal =! Io), indicating that the SIGIO signal is not tracked.
-U username: run the tracked command with the UID and GID of username.
Example:
Strace-T-tt-e trace = desc-s 1024-o out.txt-p pid
Strace-T-tt-e trace = all-o output.txt-p pid
Strace-fo out.txt sqlplus/as sysdba
--------------- Organize the self-network