~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/tests/shell/stat.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/perf/tests/shell/stat.sh (Version linux-6.12-rc7) and /tools/perf/tests/shell/stat.sh (Version linux-6.0.19)


  1 #!/bin/sh                                           1 #!/bin/sh
  2 # perf stat tests                                   2 # perf stat tests
  3 # SPDX-License-Identifier: GPL-2.0                  3 # SPDX-License-Identifier: GPL-2.0
  4                                                     4 
  5 set -e                                              5 set -e
  6                                                     6 
  7 err=0                                               7 err=0
  8 test_default_stat() {                               8 test_default_stat() {
  9   echo "Basic stat command test"                    9   echo "Basic stat command test"
 10   if ! perf stat true 2>&1 | grep -E -q "Perfo !!  10   if ! perf stat true 2>&1 | egrep -q "Performance counter stats for 'true':"
 11   then                                             11   then
 12     echo "Basic stat command test [Failed]"        12     echo "Basic stat command test [Failed]"
 13     err=1                                          13     err=1
 14     return                                         14     return
 15   fi                                               15   fi
 16   echo "Basic stat command test [Success]"         16   echo "Basic stat command test [Success]"
 17 }                                                  17 }
 18                                                    18 
 19 test_stat_record_report() {                        19 test_stat_record_report() {
 20   echo "stat record and report test"               20   echo "stat record and report test"
 21   if ! perf stat record -o - true | perf stat      21   if ! perf stat record -o - true | perf stat report -i - 2>&1 | \
 22     grep -E -q "Performance counter stats for  !!  22     egrep -q "Performance counter stats for 'pipe':"
 23   then                                             23   then
 24     echo "stat record and report test [Failed]     24     echo "stat record and report test [Failed]"
 25     err=1                                          25     err=1
 26     return                                         26     return
 27   fi                                               27   fi
 28   echo "stat record and report test [Success]"     28   echo "stat record and report test [Success]"
 29 }                                                  29 }
 30                                                    30 
 31 test_stat_record_script() {                    << 
 32   echo "stat record and script test"           << 
 33   if ! perf stat record -o - true | perf scrip << 
 34     grep -E -q "CPU[[:space:]]+THREAD[[:space: << 
 35   then                                         << 
 36     echo "stat record and script test [Failed] << 
 37     err=1                                      << 
 38     return                                     << 
 39   fi                                           << 
 40   echo "stat record and script test [Success]" << 
 41 }                                              << 
 42                                                << 
 43 test_stat_repeat_weak_groups() {                   31 test_stat_repeat_weak_groups() {
 44   echo "stat repeat weak groups test"              32   echo "stat repeat weak groups test"
 45   if ! perf stat -e '{cycles,cycles,cycles,cyc     33   if ! perf stat -e '{cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles}' \
 46      true 2>&1 | grep -q 'seconds time elapsed     34      true 2>&1 | grep -q 'seconds time elapsed'
 47   then                                             35   then
 48     echo "stat repeat weak groups test [Skippe     36     echo "stat repeat weak groups test [Skipped event parsing failed]"
 49     return                                         37     return
 50   fi                                               38   fi
 51   if ! perf stat -r2 -e '{cycles,cycles,cycles     39   if ! perf stat -r2 -e '{cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles}:W' \
 52     true > /dev/null 2>&1                          40     true > /dev/null 2>&1
 53   then                                             41   then
 54     echo "stat repeat weak groups test [Failed     42     echo "stat repeat weak groups test [Failed]"
 55     err=1                                          43     err=1
 56     return                                         44     return
 57   fi                                               45   fi
 58   echo "stat repeat weak groups test [Success]     46   echo "stat repeat weak groups test [Success]"
 59 }                                                  47 }
 60                                                    48 
 61 test_topdown_groups() {                            49 test_topdown_groups() {
 62   # Topdown events must be grouped with the sl     50   # Topdown events must be grouped with the slots event first. Test that
 63   # parse-events reorders this.                    51   # parse-events reorders this.
 64   echo "Topdown event group test"                  52   echo "Topdown event group test"
 65   if ! perf stat -e '{slots,topdown-retiring}'     53   if ! perf stat -e '{slots,topdown-retiring}' true > /dev/null 2>&1
 66   then                                             54   then
 67     echo "Topdown event group test [Skipped ev     55     echo "Topdown event group test [Skipped event parsing failed]"
 68     return                                         56     return
 69   fi                                               57   fi
 70   if perf stat -e '{slots,topdown-retiring}' t !!  58   if perf stat -e '{slots,topdown-retiring}' true 2>&1 | egrep -q "<not supported>"
 71   then                                             59   then
 72     echo "Topdown event group test [Failed eve     60     echo "Topdown event group test [Failed events not supported]"
 73     err=1                                          61     err=1
 74     return                                         62     return
 75   fi                                               63   fi
 76   if perf stat -e '{topdown-retiring,slots}' t !!  64   if perf stat -e '{topdown-retiring,slots}' true 2>&1 | egrep -q "<not supported>"
 77   then                                             65   then
 78     echo "Topdown event group test [Failed slo     66     echo "Topdown event group test [Failed slots not reordered first]"
 79     err=1                                          67     err=1
 80     return                                         68     return
 81   fi                                               69   fi
 82   echo "Topdown event group test [Success]"        70   echo "Topdown event group test [Success]"
 83 }                                                  71 }
 84                                                    72 
 85 test_topdown_weak_groups() {                       73 test_topdown_weak_groups() {
 86   # Weak groups break if the perf_event_open o     74   # Weak groups break if the perf_event_open of multiple grouped events
 87   # fails. Breaking a topdown group causes the     75   # fails. Breaking a topdown group causes the events to fail. Test a very large
 88   # grouping to see that the topdown events ar     76   # grouping to see that the topdown events aren't broken out.
 89   echo "Topdown weak groups test"                  77   echo "Topdown weak groups test"
 90   ok_grouping="{slots,topdown-bad-spec,topdown     78   ok_grouping="{slots,topdown-bad-spec,topdown-be-bound,topdown-fe-bound,topdown-retiring},branch-instructions,branch-misses,bus-cycles,cache-misses,cache-references,cpu-cycles,instructions,mem-loads,mem-stores,ref-cycles,cache-misses,cache-references"
 91   if ! perf stat --no-merge -e "$ok_grouping"      79   if ! perf stat --no-merge -e "$ok_grouping" true > /dev/null 2>&1
 92   then                                             80   then
 93     echo "Topdown weak groups test [Skipped ev     81     echo "Topdown weak groups test [Skipped event parsing failed]"
 94     return                                         82     return
 95   fi                                               83   fi
 96   group_needs_break="{slots,topdown-bad-spec,t     84   group_needs_break="{slots,topdown-bad-spec,topdown-be-bound,topdown-fe-bound,topdown-retiring,branch-instructions,branch-misses,bus-cycles,cache-misses,cache-references,cpu-cycles,instructions,mem-loads,mem-stores,ref-cycles,cache-misses,cache-references}:W"
 97   if perf stat --no-merge -e "$group_needs_bre !!  85   if perf stat --no-merge -e "$group_needs_break" true 2>&1 | egrep -q "<not supported>"
 98   then                                             86   then
 99     echo "Topdown weak groups test [Failed eve     87     echo "Topdown weak groups test [Failed events not supported]"
100     err=1                                          88     err=1
101     return                                         89     return
102   fi                                               90   fi
103   echo "Topdown weak groups test [Success]"        91   echo "Topdown weak groups test [Success]"
104 }                                                  92 }
105                                                    93 
106 test_cputype() {                               << 
107   # Test --cputype argument.                   << 
108   echo "cputype test"                          << 
109                                                << 
110   # Bogus PMU should fail.                     << 
111   if perf stat --cputype="123" -e instructions << 
112   then                                         << 
113     echo "cputype test [Bogus PMU didn't fail] << 
114     err=1                                      << 
115     return                                     << 
116   fi                                           << 
117                                                << 
118   # Find a known PMU for cputype.              << 
119   pmu=""                                       << 
120   for i in cpu cpu_atom armv8_pmuv3_0          << 
121   do                                           << 
122     if test -d "/sys/devices/$i"               << 
123     then                                       << 
124       pmu="$i"                                 << 
125       break                                    << 
126     fi                                         << 
127     if perf stat -e "$i/instructions/" true >  << 
128     then                                       << 
129       pmu="$i"                                 << 
130       break                                    << 
131     fi                                         << 
132   done                                         << 
133   if test "x$pmu" = "x"                        << 
134   then                                         << 
135     echo "cputype test [Skipped known PMU not  << 
136     return                                     << 
137   fi                                           << 
138                                                << 
139   # Test running with cputype produces output. << 
140   if ! perf stat --cputype="$pmu" -e instructi << 
141   then                                         << 
142     echo "cputype test [Failed count missed wi << 
143     err=1                                      << 
144     return                                     << 
145   fi                                           << 
146   echo "cputype test [Success]"                << 
147 }                                              << 
148                                                << 
149 test_default_stat                                  94 test_default_stat
150 test_stat_record_report                            95 test_stat_record_report
151 test_stat_record_script                        << 
152 test_stat_repeat_weak_groups                       96 test_stat_repeat_weak_groups
153 test_topdown_groups                                97 test_topdown_groups
154 test_topdown_weak_groups                           98 test_topdown_weak_groups
155 test_cputype                                   << 
156 exit $err                                          99 exit $err
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php