269 lines · bash
1# SPDX-License-Identifier: GPL-2.02 3export RE_NUMBER="[0-9\.]+"4# Number5# Examples:6# 123.4567 8 9export RE_NUMBER_HEX="[0-9A-Fa-f]+"10# Hexadecimal number11# Examples:12# 123413# a58d14# aBcD15# deadbeef16 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 form20# Examples:21# 1990-02-2922# 0015-07-3123# 2456-12-3124#! 2012-13-0125#! 1963-09-3126 27 28export RE_TIME="(?:[0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]"29# Time30# Examples:31# 15:12:2732# 23:59:5933#! 24:00:0034#! 11:25:6035#! 17:60:1536 37 38export RE_DATE_TIME="\w+\s+\w+\s+$RE_NUMBER\s+$RE_TIME\s+$RE_NUMBER"39# Time and date40# Examples:41# Wed Feb 12 10:46:26 202042# Mon Mar 2 13:27:06 202043#! St úno 12 10:57:21 CET 202044#! Po úno 14 15:17:32 201045 46 47export RE_ADDRESS="0x$RE_NUMBER_HEX"48# Memory address49# Examples:50# 0x123abc51# 0xffffffff9abe8ae852# 0x053 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# 0xffffffff9abe8ae859#! 0x060#! 0x000000000000000061 62export RE_PROCESS_PID="[^\/]+\/\d+"63# A process with PID64# Example:65# sleep/410266# test_overhead./86618567# in:imjournal/109668# random#$& test/86660769 70export RE_EVENT_ANY="[\w\-\:\/_=,]+"71# Name of any event (universal)72# Examples:73# cpu-cycles74# cpu/event=12,umask=34/75# r41e176# nfs:nfs_getattr_enter77 78 79export RE_EVENT="[\w\-:_]+"80# Name of an usual event81# Examples:82# cpu-cycles83 84 85export RE_EVENT_RAW="r$RE_NUMBER_HEX"86# Specification of a raw event87# Examples:88# r41e189# r1a90 91 92export RE_EVENT_CPU="cpu/(\w+=$RE_NUMBER_HEX,?)+/p*"93# Specification of a CPU event94# Examples:95# cpu/event=12,umask=34/pp96 97 98export RE_EVENT_UNCORE="uncore/[\w_]+/"99# Specification of an uncore event100# Examples:101# uncore/qhl_request_local_reads/102 103 104export RE_EVENT_SUBSYSTEM="[\w\-]+:[\w\-]+"105# Name of an event from subsystem106# Examples:107# ext4:ext4_ordered_write_end108# sched:sched_switch109 110 111export RE_FILE_NAME="[\w\+\.-]+"112# A filename113# Examples:114# libstdc++.so.6115#! some/path116 117 118export RE_PATH_ABSOLUTE="(?:\/$RE_FILE_NAME)+"119# A full filepath120# Examples:121# /usr/lib64/somelib.so.5.4.0122# /lib/modules/4.3.0-rc5/kernel/fs/xfs/xfs.ko123# /usr/bin/mv124#! some/relative/path125#! ./some/relative/path126 127 128export RE_PATH="(?:$RE_FILE_NAME)?$RE_PATH_ABSOLUTE"129# A filepath130# Examples:131# /usr/lib64/somelib.so.5.4.0132# /lib/modules/4.3.0-rc5/kernel/fs/xfs/xfs.ko133# ./.emacs134# src/fs/file.c135 136 137export RE_DSO="(?:$RE_PATH_ABSOLUTE(?: \(deleted\))?|\[kernel\.kallsyms\]|\[unknown\]|\[vdso\]|\[kernel\.vmlinux\][\.\w]*)"138# A DSO name in various result tables139# Examples:140# /usr/lib64/somelib.so.5.4.0141# /usr/bin/somebinart (deleted)142# /lib/modules/4.3.0-rc5/kernel/fs/xfs/xfs.ko143# [kernel.kallsyms]144# [kernel.vmlinux]145# [vdso]146# [unknown]147 148 149export RE_LINE_COMMENT="^#.*"150# A comment line151# Examples:152# # Started on Thu Sep 10 11:43:00 2015153 154 155export RE_LINE_EMPTY="^\s*$"156# An empty line with possible whitespaces157# 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" output163# 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" output169# 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 here179# 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" output190# 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 output203# Examples:204# 0.115 ( 0.005 ms): sleep/4102 open(filename: 0xd09e2ab2, flags: CLOEXEC ) = 3205# 0.157 ( 0.005 ms): sleep/4102 mmap(len: 3932736, prot: EXEC|READ, flags: PRIVATE|DENYWRITE, fd: 3 ) = 0x7f89d0605000206#! 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 output210# Examples:211# 0.115 ( 0.005 ms): open(filename: 0xd09e2ab2, flags: CLOEXEC ) = 3212# 0.157 ( 0.005 ms): mmap(len: 3932736, prot: EXEC|READ, flags: PRIVATE|DENYWRITE, fd: 3 ) = 0x7f89d0605000213#! 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 output217# Examples:218# 0.000 ( 0.000 ms): ... [continued]: nanosleep()) = 0219# 0.000 ( 0.000 ms): ... [continued]: nanosleep()) = 0x00000000220# ? ( ): 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 output225# 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 table231# Example:232# syscall calls total min avg max stddev233# syscall calls errors total min avg max stddev234 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 table238# 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+" # FIXME244# A line from typicap perf report --stdio output245# Example:246# 100.00% sleep [kernel.vmlinux] [k] syscall_return_slowpath247 248 249export RE_TASK="\s+[\w~\/ \.\+:#-]+(?:\[-1(?:\/\d+)?\]|\[\d+(?:\/\d+)?\])"250# A name of a task used for perf sched timehist -s251# 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 message264# Example:265# /bin/bash: line 1: 32 Segmentation fault timeout 15s266# Segmentation fault (core dumped)267# Program terminated with signal SIGSEGV268#! WARNING: 12323431 isn't a 'cpu_core', please use a CPU list in the 'cpu_core' range (0-15)269