(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: -1 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: True spids: [176] ) (Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[179]) ] ) (C {(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:-1 arg_word:{(2)} spids:[208])] ) (C {(exit)} {(1)}) ] spids: [203] ) spids: [199 202] ) (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: [249] ) ] spids: [249] ) ] spids: [246 247 254 -1] ) (case_arm pat_list: [{(h)} {(Lit_Other "?")}] action: [(C {(usage)})] spids: [257 260 264 -1] ) ] spids: [239 243 267] ) ] spids: [236 269] ) ) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithWord w:{($ VSub_Name "$OPTIND")}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [273 282] ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tpoint) op: Equal rhs: {(block) (Lit_Other ":") (block_rq_issue)} spids: [284] ) ] spids: [284] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:var) op:Equal rhs:{(nr_sector)} spids:[289])] spids: [289] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:duration) op: Equal rhs: {($ VSub_Number "$1")} spids: [292] ) ] spids: [292] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:i) op:Equal rhs:{(0)} spids:[299])] spids: [299] ) (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: [304 309] ) } ] ) } spids: [302] ) ] spids: [302] ) (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: [317 323] ) } ) 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: [357 362] ) } ) 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: [400 405] ) } ) 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: [409 418] ) } ) ) ) terminator: <Op_Semi ";"> ) ] action: [(C {(die)} {(DQ ("ERROR: bucket list must increase in size."))})] spids: [-1 424] ) ] spids: [-1 434] ) ] spids: [-1 393] ) ] spids: [-1 437] ) (DParen child:(UnaryAssign op_id:Node_PostDPlus child:(LhsName name:i))) ] spids: [345 448] ) ) (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: [455 460] ) } spids: [454] ) ] spids: [454] ) (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: [463 468] ) } spids: [462] ) ] spids: [462] ) (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: [478 483] ) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) ) } spids: [470] ) ] spids: [470] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:awkarray) op:Equal rhs:{(SQ )} spids:[487])] spids: [487] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:i) op:Equal rhs:{(0)} spids:[489])] spids: [489] ) (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: [518 523] ) (" && ") ) } spids: [509] ) ] spids: [509] ) (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: [534 543] ) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) ) } spids: [528] ) ] spids: [528] ) (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: [554 559] ) (";") ) } spids: [548] ) ] spids: [548] ) (DParen child:(UnaryAssign op_id:Node_PostDPlus child:(LhsName name:i))) ] spids: [506 572] ) ) (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: [580 585] ) (";") ) } spids: [574] ) ] spids: [574] ) (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: [598 603] ) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) ) } spids: [589] ) ] spids: [589] ) (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: [624] ) ] spids: [624] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: {(DQ ("sleep ") ($ VSub_Name "$duration"))} spids: [632] ) ] spids: [632] ) ] spids: [-1 621] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:etext) op: Equal rhs: {(DQ ("until Ctrl-C"))} spids: [641] ) ] spids: [641] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: {(DQ ("sleep 999999"))} spids: [647] ) ] spids: [647] ) ] spids: [638 652] ) (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:[666])] spids: [666] ) (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:[690])] ) ] ) left_token: <Left_CommandSub "$("> spids: [675 692] ) } spids: [674] ) ] spids: [674] ) (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:-1 arg_word:{(2)} spids:[713])] ) (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Name "$stat"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[723])] ) (C {(exit)}) ] spids: [-1 708] ) ] spids: [-1 733] ) (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: False ) ] ) left_token: <Left_CommandSub "$("> spids: [740 762] ) } spids: [739] ) ] spids: [739] ) (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: False ) ] )