File Index
Files and directories
Sign in
FILE

patterns.sh

File preview with syntax highlighting.

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