(CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:duration) op:Equal rhs:{(0)} spids:[133])] spids: [133] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:buckets) op: Equal rhs: {(ArrayLiteralPart words:[{(1)} {(8)} {(64)} {(128)}])} spids: [136] ) ] spids: [136] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:secsz) op:Equal rhs:{(512)} spids:[147])] spids: [147] ) (C {(trap)} {(SQ <':'>)} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)}) (FuncDef name: usage body: (BraceGroup children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: { (DQ ('USAGE: bitesize [-h] [-b buckets] [seconds]\n') (' -b buckets # specify histogram buckets (Kbytes)\n') (' -h # this usage message\n') (' eg,\n') (' bitesize # trace I/O size until Ctrl-C\n') (' bitesize 10 # trace I/O size for 10 seconds\n') (' bitesize -b ') (Right_DoubleQuote '"') ('8 16 32') (Right_DoubleQuote '"') (' # specify custom bucket points\n') ) } do_expansion: True here_end: END was_filled: T spids: [176] ) (Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[179]) ] ) (ControlFlow token:<ControlFlow_Exit exit>) ] spids: [171] ) spids: [167 170] ) (FuncDef name: die body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_At '$@'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[209])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [204] ) spids: [200 203] ) (While cond: [(C {(getopts)} {(b) (Lit_Other ':') (h)} {(opt)})] body: (DoGroup children: [ (Case to_match: {($ VSub_Name '$opt')} arms: [ (case_arm pat_list: [{(b)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:buckets) op: Equal rhs: {(ArrayLiteralPart words:[{($ VSub_Name '$OPTARG')}])} spids: [250] ) ] spids: [250] ) ] spids: [247 248 255 16777215] ) (case_arm pat_list: [{(h)} {(Lit_Other '?')}] action: [(C {(usage)})] spids: [258 261 265 16777215] ) ] spids: [240 244 268] ) ] spids: [237 270] ) ) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithWord w:{($ VSub_Name '$OPTIND')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [274 283] ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tpoint) op: Equal rhs: {(block) (Lit_Other ':') (block_rq_issue)} spids: [285] ) ] spids: [285] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:var) op:Equal rhs:{(nr_sector)} spids:[290])] spids: [290] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:duration) op: Equal rhs: {($ VSub_Number '$1')} spids: [293] ) ] spids: [293] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:i) op:Equal rhs:{(0)} spids:[300])] spids: [300] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sectors) op: Equal rhs: { (ArrayLiteralPart words: [ { (BracedVarSub token: <VSub_Name buckets> bracket_op: (WholeArray op_id:Arith_Star) spids: [305 310] ) } ] ) } spids: [303] ) ] spids: [303] ) (DParen child: (BinaryAssign op_id: Arith_Equal left: (LhsName name:max_i) right: (ArithBinary op_id: Arith_Minus left: (ArithWord w: { (BracedVarSub token: <VSub_Name buckets> prefix_op: VSub_Pound bracket_op: (WholeArray op_id:Arith_Star) spids: [318 324] ) } ) right: (ArithWord w:{(Lit_Digits 1)}) ) ) ) (While cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_LessEqual left: (ArithVarRef name:i) right: (ArithVarRef name:max_i) ) ) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (DParen child: (BinaryAssign op_id: Arith_Equal left: (LhsIndexedName name:sectors index:(ArithWord w:{($ VSub_Name '$i')})) right: (ArithBinary op_id: Arith_Slash left: (ArithBinary op_id: Arith_Star left: (ArithWord w: { (BracedVarSub token: <VSub_Name sectors> bracket_op: (ArrayIndex expr:(ArithWord w:{($ VSub_Name '$i')})) spids: [358 363] ) } ) right: (ArithWord w:{(Lit_Digits 1024)}) ) right: (ArithWord w:{($ VSub_Name '$secsz')}) ) ) ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_Great left: (ArithVarRef name:i) right: (ArithWord w:{(Lit_Digits 0)}) ) ) terminator: <Op_Semi ';'> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_LessEqual left: (ArithWord w: { (BracedVarSub token: <VSub_Name sectors> bracket_op: (ArrayIndex expr: (ArithWord w:{($ VSub_Name '$i')}) ) spids: [401 406] ) } ) right: (ArithWord w: { (BracedVarSub token: <VSub_Name sectors> bracket_op: (ArrayIndex expr: (ArithBinary op_id: Arith_Minus left: (ArithWord w:{($ VSub_Name '$i')}) right: (ArithWord w:{(Lit_Digits 1)}) ) ) spids: [410 419] ) } ) ) ) terminator: <Op_Semi ';'> ) ] action: [(C {(die)} {(DQ ('ERROR: bucket list must increase in size.'))})] spids: [16777215 425] ) ] spids: [16777215 435] ) ] spids: [16777215 394] ) ] spids: [16777215 438] ) (DParen child:(UnaryAssign op_id:Node_PostDPlus child:(LhsName name:i))) ] spids: [346 449] ) ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:max_b) op: Equal rhs: { (BracedVarSub token: <VSub_Name buckets> bracket_op: (ArrayIndex expr:(ArithWord w:{($ VSub_Name '$max_i')})) spids: [456 461] ) } spids: [455] ) ] spids: [455] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:max_s) op: Equal rhs: { (BracedVarSub token: <VSub_Name sectors> bracket_op: (ArrayIndex expr:(ArithWord w:{($ VSub_Name '$max_i')})) spids: [464 469] ) } spids: [463] ) ] spids: [463] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tpoints) op: Equal rhs: { (DQ ('-e ') ($ VSub_Name '$tpoint') (' --filter ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$var') (' < ') (BracedVarSub token: <VSub_Name sectors> bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 0)})) spids: [479 484] ) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ) } spids: [471] ) ] spids: [471] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:awkarray) op:Equal rhs:{(EmptyPart)} spids:[488])] spids: [488] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:i) op:Equal rhs:{(0)} spids:[490])] spids: [490] ) (While cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_Less left: (ArithVarRef name:i) right: (ArithVarRef name:max_i) ) ) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tpoints) op: Equal rhs: { (DQ ($ VSub_Name '$tpoints') (' -e ') ($ VSub_Name '$tpoint') (' --filter ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$var') (' >= ') (BracedVarSub token: <VSub_Name sectors> bracket_op: (ArrayIndex expr:(ArithWord w:{($ VSub_Name '$i')})) spids: [519 524] ) (' && ') ) } spids: [510] ) ] spids: [510] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tpoints) op: Equal rhs: { (DQ ($ VSub_Name '$tpoints') (' ') ($ VSub_Name '$var') (' < ') (BracedVarSub token: <VSub_Name sectors> bracket_op: (ArrayIndex expr: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name '$i')}) right: (ArithWord w:{(Lit_Digits 1)}) ) ) spids: [535 544] ) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ) } spids: [529] ) ] spids: [529] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:awkarray) op: Equal rhs: { (DQ ($ VSub_Name '$awkarray') (' buckets[') ($ VSub_Name '$i') (']=') (BracedVarSub token: <VSub_Name buckets> bracket_op: (ArrayIndex expr:(ArithWord w:{($ VSub_Name '$i')})) spids: [555 560] ) (';') ) } spids: [549] ) ] spids: [549] ) (DParen child:(UnaryAssign op_id:Node_PostDPlus child:(LhsName name:i))) ] spids: [507 573] ) ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:awkarray) op: Equal rhs: { (DQ ($ VSub_Name '$awkarray') (' buckets[') ($ VSub_Name '$max_i') (']=') (BracedVarSub token: <VSub_Name buckets> bracket_op: (ArrayIndex expr:(ArithWord w:{($ VSub_Name '$max_i')})) spids: [581 586] ) (';') ) } spids: [575] ) ] spids: [575] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tpoints) op: Equal rhs: { (DQ ($ VSub_Name '$tpoints') (' -e ') ($ VSub_Name '$tpoint') (' --filter ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$var') (' >= ') (BracedVarSub token: <VSub_Name sectors> bracket_op: (ArrayIndex expr:(ArithWord w:{($ VSub_Name '$max_i')})) spids: [599 604] ) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ) } spids: [590] ) ] spids: [590] ) (If arms: [ (if_arm cond: [(Sentence child:(DParen child:(ArithVarRef name:duration)) terminator:<Op_Semi ';'>)] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:etext) op: Equal rhs: {(DQ ('for ') ($ VSub_Name '$duration') (' seconds'))} spids: [625] ) ] spids: [625] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: {(DQ ('sleep ') ($ VSub_Name '$duration'))} spids: [633] ) ] spids: [633] ) ] spids: [16777215 622] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:etext) op: Equal rhs: {(DQ ('until Ctrl-C'))} spids: [642] ) ] spids: [642] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: {(DQ ('sleep 999999'))} spids: [648] ) ] spids: [648] ) ] spids: [639 653] ) (C {(echo)} {(DQ ('Tracing block I/O size (bytes), ') ($ VSub_Name '$etext') (...))}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:out) op:Equal rhs:{(DQ ('-o /dev/stdout'))} spids:[667])] spids: [667] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:stat) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [ {(eval)} {(perf)} {(stat)} {($ VSub_Name '$tpoints')} {(-a)} {($ VSub_Name '$out')} {($ VSub_Name '$cmd')} ] redirects: [(Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[691])] ) ] ) left_token: <Left_CommandSub '$('> spids: [676 693] ) } spids: [675] ) ] spids: [675] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_NEqual left: (ArithWord w:{($ VSub_QMark '$?')}) right: (ArithWord w:{(Lit_Digits 0)}) ) ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('ERROR running perf:'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[714])] ) (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Name '$stat'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[724])] ) (ControlFlow token:<ControlFlow_Exit exit>) ] spids: [16777215 709] ) ] spids: [16777215 734] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:most) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(DQ ($ VSub_Name '$stat'))}) (C {(awk)} {(-v)} {(Lit_VarLike 'tpoint=') ($ VSub_Name '$tpoint')} { (SQ <'\n'> <'\t$2 == tpoint { gsub(/,/, ""); if ($1 > m) { m = $1 } }\n'> <'\tEND { print m }'> ) } ) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [741 763] ) } spids: [740] ) ] spids: [740] ) (C {(echo)}) (Pipeline children: [ (C {(echo)} {(DQ ($ VSub_Name '$stat'))}) (C {(awk)} {(-v)} {(Lit_VarLike 'tpoint=') ($ VSub_Name '$tpoint')} {(-v)} {(Lit_VarLike 'max_i=') ($ VSub_Name '$max_i')} {(-v)} {(Lit_VarLike 'most=') ($ VSub_Name '$most')} { (SQ <'\n'> <'\tfunction star(sval, smax, swidth) {\n'> <'\t\tstars = ""\n'> <'\t\t# using int could avoid error on gawk\n'> <'\t\tif (int(smax) == 0) return ""\n'> <'\t\tfor (si = 0; si < (swidth * sval / smax); si++) {\n'> <'\t\t\tstars = stars "#"\n'> <'\t\t}\n'> <'\t\treturn stars\n'> <'\t}\n'> <'\tBEGIN {\n'> <'\t\t'> ) (DQ ($ VSub_Name '$awkarray')) (SQ <'\n'> <'\t\tprintf(" %-15s: %-8s %s\\n", "Kbytes", "I/O",\n'> <'\t\t "Distribution")\n'> <'\t}\n'> <'\t/Performance counter stats/ { i = -1 }\n'> <'\t# reverse order of rule set is important\n'> <'\t{ ok = 0 }\n'> <'\t$2 == tpoint { num = $1; gsub(/,/, "", num); ok = 1 }\n'> <'\tok && i >= max_i {\n'> <'\t\tprintf(" %10.1f -> %-10s: %-8s |%-38s|\\n",\n'> <'\t\t buckets[i], "", num, star(num, most, 38))\n'> <'\t\tnext\n'> <'\t}\n'> <'\tok && i >= 0 && i < max_i {\n'> <'\t\tprintf(" %10.1f -> %-10.1f: %-8s |%-38s|\\n",\n'> <'\t\t buckets[i], buckets[i+1] - 0.1, num,\n'> <'\t\t star(num, most, 38))\n'> <'\t\ti++\n'> <'\t\tnext\n'> <'\t}\n'> <'\tok && i == -1 {\n'> <'\t\tprintf(" %10s -> %-10.1f: %-8s |%-38s|\\n", "",\n'> <'\t\t buckets[0] - 0.1, num, star(num, most, 38))\n'> <'\t\ti++\n'> <'\t}\n'> ) } ) ] negated: F ) ] )