#!/bin/bash # # Analyze a given results directory for rcutorture progress. # # Usage: kvm-recheck-rcu.sh resdir # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, you can access it online at # http://www.gnu.org/licenses/gpl-2.0.html. # # Copyright (C) IBM Corporation, 2014 # # Authors: Paul E. McKenney global i := $1 if test -d $i { : } else { echo Unreadable results directory: $i exit 1 } source tools/testing/selftests/rcutorture/bin/functions.sh global configfile := $[echo $i | sed -e 's/^.*\///] global ngps := $[grep ver: $i/console.log !2 > /dev/null | tail -1 | sed -e 's/^.* ver: //' -e 's/ .*$//] if test -z $ngps { echo "$configfile -------" } else { global title := ""$configfile ------- $ngps grace periods"" global dur := $[sed -e 's/^.* rcutorture.shutdown_secs=//' -e 's/ .*$//' < $i/qemu-cmd !2 > /dev/null] if test -z $dur { : } else { global ngpsps := $[awk -v ngps=$ngps -v dur=$dur ' BEGIN { print ngps / dur }' < /dev/null] global title := ""$title ($ngpsps per second)"" } echo $title global nclosecalls := $[grep --binary-files=text 'torture: Reader Batch' $i/console.log | tail -1 | awk '{for (i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}] if test -z $nclosecalls { exit 0 } if test $nclosecalls -eq 0 { exit 0 } # Compute number of close calls per tenth of an hour global nclosecalls10 := $[awk -v nclosecalls=$nclosecalls -v dur=$dur 'BEGIN { print int(nclosecalls * 36000 / dur) }' < /dev/null] if test $nclosecalls10 -gt 5 -a $nclosecalls -gt 1 { print_bug $nclosecalls "Reader Batch close calls in" $($dur/60) minute run: $i } else { print_warning $nclosecalls "Reader Batch close calls in" $($dur/60) minute run: $i } } (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:i) op:Equal rhs:{(DQ ($ VSub_Number "$1"))} spids:[70])] spids: [70] ) (If arms: [ (if_arm cond: [(C {(test)} {(-d)} {($ VSub_Name "$i")})] action: [(C {(Lit_Other ":")})] spids: [-1 83] ) ] else_action: [ (C {(echo)} {(Unreadable)} {(results)} {(directory) (Lit_Other ":")} {($ VSub_Name "$i")}) (C {(exit)} {(1)}) ] spids: [88 107] ) (C {(.)} {(tools/testing/selftests/rcutorture/bin/functions.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:configfile) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$i")}) (C {(sed)} {(-e)} {(SQ <"s/^.*\\///">)}) ] negated: False ) ] ) left_token: spids: [115 129] ) } spids: [114] ) ] spids: [114] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ngps) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (SimpleCommand words: [{(grep)} {(ver) (Lit_Other ":")} {($ VSub_Name "$i") (/console.log)}] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [141] ) ] ) (C {(tail)} {(-1)}) (C {(sed)} {(-e)} {(SQ <"s/^.* ver: //">)} {(-e)} {(SQ <"s/ .*$//">)}) ] negated: False ) ] ) left_token: spids: [132 166] ) } spids: [131] ) ] spids: [131] ) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$ngps"))})] action: [(C {(echo)} {(DQ ($ VSub_Name "$configfile") (" -------"))})] spids: [-1 178] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:title) op: Equal rhs: { (DQ ($ VSub_Name "$configfile") (" ------- ") ($ VSub_Name "$ngps") (" grace periods")) } spids: [191] ) ] spids: [191] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dur) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(sed)} {(-e)} {(SQ <"s/^.* rcutorture.shutdown_secs=//">)} {(-e)} {(SQ <"s/ .*$//">)} ] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {($ VSub_Name "$i") (/qemu-cmd)} spids: [216] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [221] ) ] ) ] ) left_token: spids: [201 224] ) } spids: [200] ) ] spids: [200] ) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$dur"))})] action: [(C {(Lit_Other ":")})] spids: [-1 238] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ngpsps) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(awk)} {(-v)} {(Lit_VarLike "ngps=") ($ VSub_Name "$ngps")} {(-v)} {(Lit_VarLike "dur=") ($ VSub_Name "$dur")} {(SQ <"\n"> <"\t\t\tBEGIN { print ngps / dur }">)} ] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(/dev/null)} spids: [266] ) ] ) ] ) left_token: spids: [248 269] ) } spids: [247] ) ] spids: [247] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:title) op: Equal rhs: {(DQ ($ VSub_Name "$title") (" (") ($ VSub_Name "$ngpsps") (" per second)"))} spids: [272] ) ] spids: [272] ) ] spids: [244 281] ) (C {(echo)} {($ VSub_Name "$title")}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:nclosecalls) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(--binary-files) (Lit_Other "=") (text)} {(SQ <"torture: Reader Batch">)} {($ VSub_Name "$i") (/console.log)} ) (C {(tail)} {(-1)}) (C {(awk)} {(SQ <"{for (i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}">)}) ] negated: False ) ] ) left_token: spids: [290 317] ) } spids: [289] ) ] spids: [289] ) (If arms: [ (if_arm cond: [(C {(test)} {(-z)} {(DQ ($ VSub_Name "$nclosecalls"))})] action: [(C {(exit)} {(0)})] spids: [-1 331] ) ] spids: [-1 339] ) (If arms: [ (if_arm cond: [(C {(test)} {(DQ ($ VSub_Name "$nclosecalls"))} {(-eq)} {(0)})] action: [(C {(exit)} {(0)})] spids: [-1 355] ) ] spids: [-1 363] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:nclosecalls10) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(awk)} {(-v)} {(Lit_VarLike "nclosecalls=") ($ VSub_Name "$nclosecalls")} {(-v)} {(Lit_VarLike "dur=") ($ VSub_Name "$dur")} {(SQ <"BEGIN { print int(nclosecalls * 36000 / dur) }">)} ] redirects: [ (Redir op_id: Redir_Less fd: -1 arg_word: {(/dev/null)} spids: [388] ) ] ) ] ) left_token: spids: [371 391] ) } spids: [370] ) ] spids: [370] ) (If arms: [ (if_arm cond: [ (C {(test)} {($ VSub_Name "$nclosecalls10")} {(-gt)} {(5)} {(-a)} {($ VSub_Name "$nclosecalls")} {(-gt)} {(1)} ) ] action: [ (C {(print_bug)} {($ VSub_Name "$nclosecalls")} {(DQ ("Reader Batch close calls in"))} { (ArithSubPart anode: (ArithBinary op_id: Arith_Slash left: (ArithWord w:{($ VSub_Name "$dur")}) right: (ArithWord w:{(Lit_Digits 60)}) ) spids: [424 429] ) } {(minute)} {(run) (Lit_Other ":")} {($ VSub_Name "$i")} ) ] spids: [-1 413] ) ] else_action: [ (C {(print_warning)} {($ VSub_Name "$nclosecalls")} {(DQ ("Reader Batch close calls in"))} { (ArithSubPart anode: (ArithBinary op_id: Arith_Slash left: (ArithWord w:{($ VSub_Name "$dur")}) right: (ArithWord w:{(Lit_Digits 60)}) ) spids: [450 455] ) } {(minute)} {(run) (Lit_Other ":")} {($ VSub_Name "$i")} ) ] spids: [439 465] ) ] spids: [188 467] ) ] )