patterns.sh 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. # SPDX-License-Identifier: GPL-2.0
  2. export RE_NUMBER="[0-9\.]+"
  3. # Number
  4. # Examples:
  5. # 123.456
  6. export RE_NUMBER_HEX="[0-9A-Fa-f]+"
  7. # Hexadecimal number
  8. # Examples:
  9. # 1234
  10. # a58d
  11. # aBcD
  12. # deadbeef
  13. export RE_DATE_YYYYMMDD="[0-9]{4}-(?:(?:01|03|05|07|08|10|12)-(?:[0-2][0-9]|3[0-1])|02-[0-2][0-9]|(?:(?:04|06|09|11)-(?:[0-2][0-9]|30)))"
  14. # Date in YYYY-MM-DD form
  15. # Examples:
  16. # 1990-02-29
  17. # 0015-07-31
  18. # 2456-12-31
  19. #! 2012-13-01
  20. #! 1963-09-31
  21. export RE_TIME="(?:[0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]"
  22. # Time
  23. # Examples:
  24. # 15:12:27
  25. # 23:59:59
  26. #! 24:00:00
  27. #! 11:25:60
  28. #! 17:60:15
  29. export RE_DATE_TIME="\w+\s+\w+\s+$RE_NUMBER\s+$RE_TIME\s+$RE_NUMBER"
  30. # Time and date
  31. # Examples:
  32. # Wed Feb 12 10:46:26 2020
  33. # Mon Mar 2 13:27:06 2020
  34. #! St úno 12 10:57:21 CET 2020
  35. #! Po úno 14 15:17:32 2010
  36. export RE_ADDRESS="0x$RE_NUMBER_HEX"
  37. # Memory address
  38. # Examples:
  39. # 0x123abc
  40. # 0xffffffff9abe8ae8
  41. # 0x0
  42. export RE_ADDRESS_NOT_NULL="0x[0-9A-Fa-f]*[1-9A-Fa-f]+[0-9A-Fa-f]*"
  43. # Memory address (not NULL)
  44. # Examples:
  45. # 0xffffffff9abe8ae8
  46. #! 0x0
  47. #! 0x0000000000000000
  48. export RE_PROCESS_PID="[^\/]+\/\d+"
  49. # A process with PID
  50. # Example:
  51. # sleep/4102
  52. # test_overhead./866185
  53. # in:imjournal/1096
  54. # random#$& test/866607
  55. export RE_EVENT_ANY="[\w\-\:\/_=,]+"
  56. # Name of any event (universal)
  57. # Examples:
  58. # cpu-cycles
  59. # cpu/event=12,umask=34/
  60. # r41e1
  61. # nfs:nfs_getattr_enter
  62. export RE_EVENT="[\w\-:_]+"
  63. # Name of an usual event
  64. # Examples:
  65. # cpu-cycles
  66. export RE_EVENT_RAW="r$RE_NUMBER_HEX"
  67. # Specification of a raw event
  68. # Examples:
  69. # r41e1
  70. # r1a
  71. export RE_EVENT_CPU="cpu/(\w+=$RE_NUMBER_HEX,?)+/p*"
  72. # Specification of a CPU event
  73. # Examples:
  74. # cpu/event=12,umask=34/pp
  75. export RE_EVENT_UNCORE="uncore/[\w_]+/"
  76. # Specification of an uncore event
  77. # Examples:
  78. # uncore/qhl_request_local_reads/
  79. export RE_EVENT_SUBSYSTEM="[\w\-]+:[\w\-]+"
  80. # Name of an event from subsystem
  81. # Examples:
  82. # ext4:ext4_ordered_write_end
  83. # sched:sched_switch
  84. export RE_FILE_NAME="[\w\+\.-]+"
  85. # A filename
  86. # Examples:
  87. # libstdc++.so.6
  88. #! some/path
  89. export RE_PATH_ABSOLUTE="(?:\/$RE_FILE_NAME)+"
  90. # A full filepath
  91. # Examples:
  92. # /usr/lib64/somelib.so.5.4.0
  93. # /lib/modules/4.3.0-rc5/kernel/fs/xfs/xfs.ko
  94. # /usr/bin/mv
  95. #! some/relative/path
  96. #! ./some/relative/path
  97. export RE_PATH="(?:$RE_FILE_NAME)?$RE_PATH_ABSOLUTE"
  98. # A filepath
  99. # Examples:
  100. # /usr/lib64/somelib.so.5.4.0
  101. # /lib/modules/4.3.0-rc5/kernel/fs/xfs/xfs.ko
  102. # ./.emacs
  103. # src/fs/file.c
  104. export RE_DSO="(?:$RE_PATH_ABSOLUTE(?: \(deleted\))?|\[kernel\.kallsyms\]|\[unknown\]|\[vdso\]|\[kernel\.vmlinux\][\.\w]*)"
  105. # A DSO name in various result tables
  106. # Examples:
  107. # /usr/lib64/somelib.so.5.4.0
  108. # /usr/bin/somebinart (deleted)
  109. # /lib/modules/4.3.0-rc5/kernel/fs/xfs/xfs.ko
  110. # [kernel.kallsyms]
  111. # [kernel.vmlinux]
  112. # [vdso]
  113. # [unknown]
  114. export RE_LINE_COMMENT="^#.*"
  115. # A comment line
  116. # Examples:
  117. # # Started on Thu Sep 10 11:43:00 2015
  118. export RE_LINE_EMPTY="^\s*$"
  119. # An empty line with possible whitespaces
  120. # Examples:
  121. #
  122. export RE_LINE_RECORD1="^\[\s+perf\s+record:\s+Woken up $RE_NUMBER times? to write data\s+\].*$"
  123. # The first line of perf-record "OK" output
  124. # Examples:
  125. # [ perf record: Woken up 1 times to write data ]
  126. export RE_LINE_RECORD2="^\[\s+perf\s+record:\s+Captured and wrote $RE_NUMBER\s*MB\s+(?:[\w\+\.-]*(?:$RE_PATH)?\/)?perf\.data(?:\.\d+)?\s*\(~?$RE_NUMBER samples\)\s+\].*$"
  127. # The second line of perf-record "OK" output
  128. # Examples:
  129. # [ perf record: Captured and wrote 0.405 MB perf.data (109 samples) ]
  130. # [ perf record: Captured and wrote 0.405 MB perf.data (~109 samples) ]
  131. # [ perf record: Captured and wrote 0.405 MB /some/temp/dir/perf.data (109 samples) ]
  132. # [ perf record: Captured and wrote 0.405 MB ./perf.data (109 samples) ]
  133. # [ perf record: Captured and wrote 0.405 MB ./perf.data.3 (109 samples) ]
  134. export RE_LINE_RECORD2_TOLERANT="^\[\s+perf\s+record:\s+Captured and wrote $RE_NUMBER\s*MB\s+(?:[\w\+\.-]*(?:$RE_PATH)?\/)?perf\.data(?:\.\d+)?\s*(?:\(~?$RE_NUMBER samples\))?\s+\].*$"
  135. # The second line of perf-record "OK" output, even no samples is OK here
  136. # Examples:
  137. # [ perf record: Captured and wrote 0.405 MB perf.data (109 samples) ]
  138. # [ perf record: Captured and wrote 0.405 MB perf.data (~109 samples) ]
  139. # [ perf record: Captured and wrote 0.405 MB /some/temp/dir/perf.data (109 samples) ]
  140. # [ perf record: Captured and wrote 0.405 MB ./perf.data (109 samples) ]
  141. # [ perf record: Captured and wrote 0.405 MB ./perf.data.3 (109 samples) ]
  142. # [ perf record: Captured and wrote 0.405 MB perf.data ]
  143. export RE_LINE_RECORD2_TOLERANT_FILENAME="^\[\s+perf\s+record:\s+Captured and wrote $RE_NUMBER\s*MB\s+(?:[\w\+\.-]*(?:$RE_PATH)?\/)?perf\w*\.data(?:\.\d+)?\s*\(~?$RE_NUMBER samples\)\s+\].*$"
  144. # The second line of perf-record "OK" output
  145. # Examples:
  146. # [ perf record: Captured and wrote 0.405 MB perf.data (109 samples) ]
  147. # [ perf record: Captured and wrote 0.405 MB perf_ls.data (~109 samples) ]
  148. # [ perf record: Captured and wrote 0.405 MB perf_aNyCaSe.data (109 samples) ]
  149. # [ perf record: Captured and wrote 0.405 MB ./perfdata.data.3 (109 samples) ]
  150. #! [ perf record: Captured and wrote 0.405 MB /some/temp/dir/my_own.data (109 samples) ]
  151. #! [ perf record: Captured and wrote 0.405 MB ./UPPERCASE.data (109 samples) ]
  152. #! [ perf record: Captured and wrote 0.405 MB ./aNyKiNDoF.data.3 (109 samples) ]
  153. #! [ perf record: Captured and wrote 0.405 MB perf.data ]
  154. export RE_LINE_TRACE_FULL="^\s*$RE_NUMBER\s*\(\s*$RE_NUMBER\s*ms\s*\):\s*$RE_PROCESS_PID\s+.*\)\s+=\s+(:?\-?$RE_NUMBER|0x$RE_NUMBER_HEX).*$"
  155. # A line of perf-trace output
  156. # Examples:
  157. # 0.115 ( 0.005 ms): sleep/4102 open(filename: 0xd09e2ab2, flags: CLOEXEC ) = 3
  158. # 0.157 ( 0.005 ms): sleep/4102 mmap(len: 3932736, prot: EXEC|READ, flags: PRIVATE|DENYWRITE, fd: 3 ) = 0x7f89d0605000
  159. #! 0.115 ( 0.005 ms): sleep/4102 open(filename: 0xd09e2ab2, flags: CLOEXEC ) =
  160. export RE_LINE_TRACE_ONE_PROC="^\s*$RE_NUMBER\s*\(\s*$RE_NUMBER\s*ms\s*\):\s*\w+\(.*\)\s+=\s+(?:\-?$RE_NUMBER|0x$RE_NUMBER_HEX).*$"
  161. # A line of perf-trace output
  162. # Examples:
  163. # 0.115 ( 0.005 ms): open(filename: 0xd09e2ab2, flags: CLOEXEC ) = 3
  164. # 0.157 ( 0.005 ms): mmap(len: 3932736, prot: EXEC|READ, flags: PRIVATE|DENYWRITE, fd: 3 ) = 0x7f89d0605000
  165. #! 0.115 ( 0.005 ms): open(filename: 0xd09e2ab2, flags: CLOEXEC ) =
  166. export RE_LINE_TRACE_CONTINUED="^\s*(:?$RE_NUMBER|\?)\s*\(\s*($RE_NUMBER\s*ms\s*)?\):\s*($RE_PROCESS_PID\s*)?\.\.\.\s*\[continued\]:\s+\w+\(\).*\s+=\s+(?:\-?$RE_NUMBER|0x$RE_NUMBER_HEX).*$"
  167. # A line of perf-trace output
  168. # Examples:
  169. # 0.000 ( 0.000 ms): ... [continued]: nanosleep()) = 0
  170. # 0.000 ( 0.000 ms): ... [continued]: nanosleep()) = 0x00000000
  171. # ? ( ): packagekitd/94838 ... [continued]: poll()) = 0 (Timeout)
  172. #! 0.000 ( 0.000 ms): ... [continued]: nanosleep()) =
  173. export RE_LINE_TRACE_UNFINISHED="^\s*$RE_NUMBER\s*\(\s*\):\s*$RE_PROCESS_PID\s+.*\)\s+\.\.\.\s*$"
  174. # A line of perf-trace output
  175. # Examples:
  176. # 901.040 ( ): in:imjournal/1096 ppoll(ufds: 0x7f701a5adb70, nfds: 1, tsp: 0x7f701a5adaf0, sigsetsize: 8) ...
  177. # 613.727 ( ): gmain/1099 poll(ufds: 0x56248f6b64b0, nfds: 2, timeout_msecs: 3996) ...
  178. export RE_LINE_TRACE_SUMMARY_HEADER="\s*syscall\s+calls\s+(?:errors\s+)?total\s+min\s+avg\s+max\s+stddev"
  179. # A header of a perf-trace summary table
  180. # Example:
  181. # syscall calls total min avg max stddev
  182. # syscall calls errors total min avg max stddev
  183. export RE_LINE_TRACE_SUMMARY_CONTENT="^\s*\w+\s+(?:$RE_NUMBER\s+){5,6}$RE_NUMBER%"
  184. # A line of a perf-trace summary table
  185. # Example:
  186. # open 3 0.017 0.005 0.006 0.007 10.90%
  187. # openat 2 0 0.017 0.008 0.009 0.010 12.29%
  188. export RE_LINE_REPORT_CONTENT="^\s+$RE_NUMBER%\s+\w+\s+\S+\s+\S+\s+\S+" # FIXME
  189. # A line from typicap perf report --stdio output
  190. # Example:
  191. # 100.00% sleep [kernel.vmlinux] [k] syscall_return_slowpath
  192. export RE_TASK="\s+[\w~\/ \.\+:#-]+(?:\[-1(?:\/\d+)?\]|\[\d+(?:\/\d+)?\])"
  193. # A name of a task used for perf sched timehist -s
  194. # Example:
  195. # sleep[62755]
  196. # runtest.sh[62762]
  197. # gmain[705/682]
  198. # xfsaild/dm-0[495]
  199. # kworker/u8:1-ev[62714]
  200. # :-1[-1/62756]
  201. # :-1[-1]
  202. # :-1[62756]
  203. export RE_SEGFAULT=".*(?:Segmentation\sfault|SIGSEGV|\score\s|dumped|segfault).*"
  204. # Possible variations of the segfault message
  205. # Example:
  206. # /bin/bash: line 1: 32 Segmentation fault timeout 15s
  207. # Segmentation fault (core dumped)
  208. # Program terminated with signal SIGSEGV
  209. #! WARNING: 12323431 isn't a 'cpu_core', please use a CPU list in the 'cpu_core' range (0-15)