strace

strace -fr -o /tmp/xxx.log -p
sys 高 OS本身的问题


    -c          Count  time, calls, and errors for each system call and report a summary on program exit.  On Linux, this attempts to show
                   system time (CPU time spent running in the kernel) independent of wall clock time.  If -c is used with -f or  -F  (below),
                   only aggregate totals for all traced processes are kept.

  -T          Show the time spent in system calls. This records the time difference between the beginning and the  end  of  each  system
                   call.



----通过strace跟踪
[root@oradbsvr ~]# strace -c -T -p 14891
Process 14891 attached - interrupt to quit
Process 14891 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00    4.143606      276240        15           read
  0.00    0.000013           1        13           mprotect
  0.00    0.000000           0        12         1 open
  0.00    0.000000           0         9           close
  0.00    0.000000           0         4           stat
  0.00    0.000000           0         4           fstat
  0.00    0.000000           0         8           mmap
  0.00    0.000000           0         5           munmap
  0.00    0.000000           0         3           brk
  0.00    0.000000           0        22           rt_sigaction
  0.00    0.000000           0         3           rt_sigprocmask
  0.00    0.000000           0         3         1 access
  0.00    0.000000           0         8         8 shmget
  0.00    0.000000           0         2           dup
  0.00    0.000000           0         2           fcntl
  0.00    0.000000           0         2           umask
  0.00    0.000000           0         3           getrlimit
  0.00    0.000000           0         2           times
  0.00    0.000000           0         1           sigaltstack
  0.00    0.000000           0         2           setrlimit
  0.00    0.000000           0         2           futex
  0.00    0.000000           0         1           set_tid_address
  0.00    0.000000           0         1           set_robust_list
------ ----------- ----------- --------- --------- ----------------
100.00    4.143619                   127        10 total
[root@oradbsvr ~]# strace -c -T -p 14891
Process 14891 attached - interrupt to quit
Process 14891 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 46.42    1.456097       50210        29           read
 39.30    1.232811      616406         2           io_setup
  7.14    0.223964       13174        17           mmap
  3.57    0.111982       12442         9           write
  3.57    0.111982      111982         1           getcwd
  0.00    0.000031           8         4           socket
  .................
  0.00    0.000000           0       235           getrusage
  0.00    0.000000           0        19           times
  0.00    0.000000           0         2           getuid
  0.00    0.000000           0         1           geteuid
  0.00    0.000000           0         1           getegid
  0.00    0.000000           0         2           getppid
  0.00    0.000000           0         1           setrlimit
  0.00    0.000000           0         1           futex
  0.00    0.000000           0         1           io_destroy
------ ----------- ----------- --------- --------- ----------------
100.00    3.136867                   450        15 total
[root@oradbsvr ~]# strace -c -T -p 14990
Process 14990 attached - interrupt to quit
Process 14990 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 99.98    0.111982       27996         4           write
  0.02    0.000022           0       137           getrusage
  0.00    0.000000           0         6           read
  0.00    0.000000           0         1         1 open
  0.00    0.000000           0         4           close
  0.00    0.000000           0         8           poll
  0.00    0.000000           0         2           lseek
  0.00    0.000000           0         4           munmap
  0.00    0.000000           0        16           rt_sigaction
  0.00    0.000000           0         4           rt_sigprocmask
  0.00    0.000000           0         1           setitimer
  0.00    0.000000           0         3           setsockopt
  0.00    0.000000           0         1           shmdt
  0.00    0.000000           0        22           times
------ ----------- ----------- --------- --------- ----------------
100.00    0.112004                   213         1 total


你可能感兴趣的:(系统管理)