perf-trace.txt 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. perf-trace(1)
  2. =============
  3. NAME
  4. ----
  5. perf-trace - strace inspired tool
  6. SYNOPSIS
  7. --------
  8. [verse]
  9. 'perf trace'
  10. 'perf trace record'
  11. DESCRIPTION
  12. -----------
  13. This command will show the events associated with the target, initially
  14. syscalls, but other system events like pagefaults, task lifetime events,
  15. scheduling events, etc.
  16. This is a live mode tool in addition to working with perf.data files like
  17. the other perf tools. Files can be generated using the 'perf record' command
  18. but the session needs to include the raw_syscalls events (-e 'raw_syscalls:*').
  19. Alternatively, 'perf trace record' can be used as a shortcut to
  20. automatically include the raw_syscalls events when writing events to a file.
  21. The following options apply to perf trace; options to perf trace record are
  22. found in the perf record man page.
  23. OPTIONS
  24. -------
  25. -a::
  26. --all-cpus::
  27. System-wide collection from all CPUs.
  28. -e::
  29. --expr::
  30. List of syscalls to show, currently only syscall names.
  31. Prefixing with ! shows all syscalls but the ones specified. You may
  32. need to escape it.
  33. -o::
  34. --output=::
  35. Output file name.
  36. -p::
  37. --pid=::
  38. Record events on existing process ID (comma separated list).
  39. -t::
  40. --tid=::
  41. Record events on existing thread ID (comma separated list).
  42. -u::
  43. --uid=::
  44. Record events in threads owned by uid. Name or number.
  45. --filter-pids=::
  46. Filter out events for these pids and for 'trace' itself (comma separated list).
  47. -v::
  48. --verbose=::
  49. Verbosity level.
  50. --no-inherit::
  51. Child tasks do not inherit counters.
  52. -m::
  53. --mmap-pages=::
  54. Number of mmap data pages (must be a power of two) or size
  55. specification with appended unit character - B/K/M/G. The
  56. size is rounded up to have nearest pages power of two value.
  57. -C::
  58. --cpu::
  59. Collect samples only on the list of CPUs provided. Multiple CPUs can be provided as a
  60. comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2.
  61. In per-thread mode with inheritance mode on (default), Events are captured only when
  62. the thread executes on the designated CPUs. Default is to monitor all CPUs.
  63. --duration:
  64. Show only events that had a duration greater than N.M ms.
  65. --sched:
  66. Accrue thread runtime and provide a summary at the end of the session.
  67. -i
  68. --input
  69. Process events from a given perf data file.
  70. -T
  71. --time
  72. Print full timestamp rather time relative to first sample.
  73. --comm::
  74. Show process COMM right beside its ID, on by default, disable with --no-comm.
  75. -s::
  76. --summary::
  77. Show only a summary of syscalls by thread with min, max, and average times
  78. (in msec) and relative stddev.
  79. -S::
  80. --with-summary::
  81. Show all syscalls followed by a summary by thread with min, max, and
  82. average times (in msec) and relative stddev.
  83. --tool_stats::
  84. Show tool stats such as number of times fd->pathname was discovered thru
  85. hooking the open syscall return + vfs_getname or via reading /proc/pid/fd, etc.
  86. -F=[all|min|maj]::
  87. --pf=[all|min|maj]::
  88. Trace pagefaults. Optionally, you can specify whether you want minor,
  89. major or all pagefaults. Default value is maj.
  90. --syscalls::
  91. Trace system calls. This options is enabled by default.
  92. --event::
  93. Trace other events, see 'perf list' for a complete list.
  94. --proc-map-timeout::
  95. When processing pre-existing threads /proc/XXX/mmap, it may take a long time,
  96. because the file may be huge. A time out is needed in such cases.
  97. This option sets the time out limit. The default value is 500 ms.
  98. PAGEFAULTS
  99. ----------
  100. When tracing pagefaults, the format of the trace is as follows:
  101. <min|maj>fault [<ip.symbol>+<ip.offset>] => <addr.dso@addr.offset> (<map type><addr level>).
  102. - min/maj indicates whether fault event is minor or major;
  103. - ip.symbol shows symbol for instruction pointer (the code that generated the
  104. fault); if no debug symbols available, perf trace will print raw IP;
  105. - addr.dso shows DSO for the faulted address;
  106. - map type is either 'd' for non-executable maps or 'x' for executable maps;
  107. - addr level is either 'k' for kernel dso or '.' for user dso.
  108. For symbols resolution you may need to install debugging symbols.
  109. Please be aware that duration is currently always 0 and doesn't reflect actual
  110. time it took for fault to be handled!
  111. When --verbose specified, perf trace tries to print all available information
  112. for both IP and fault address in the form of dso@symbol+offset.
  113. EXAMPLES
  114. --------
  115. Trace only major pagefaults:
  116. $ perf trace --no-syscalls -F
  117. Trace syscalls, major and minor pagefaults:
  118. $ perf trace -F all
  119. 1416.547 ( 0.000 ms): python/20235 majfault [CRYPTO_push_info_+0x0] => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0@0x61be0 (x.)
  120. As you can see, there was major pagefault in python process, from
  121. CRYPTO_push_info_ routine which faulted somewhere in libcrypto.so.
  122. SEE ALSO
  123. --------
  124. linkperf:perf-record[1], linkperf:perf-script[1]