(CommandList children: [ (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_count) op:Equal rhs:{(0)} spids:[163])] spids: [163] ) terminator: <Op_Semi ";"> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_pid) op:Equal rhs:{(0)} spids:[167])] spids: [167] ) terminator: <Op_Semi ";"> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_verbose) op:Equal rhs:{(0)} spids:[171])] spids: [171] ) terminator: <Op_Semi ";"> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_cmd) op:Equal rhs:{(0)} spids:[175])] spids: [175] ) terminator: <Op_Semi ";"> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_duration) op:Equal rhs:{(0)} spids:[179])] spids: [179] ) terminator: <Op_Semi ";"> ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_tail) op:Equal rhs:{(0)} spids:[183])] spids: [183] ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:tnum) op:Equal rhs:{(SQ )} spids:[186])] spids: [186] ) terminator: <Op_Semi ";"> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pid) op:Equal rhs:{(SQ )} spids:[189])] spids: [189] ) terminator: <Op_Semi ";"> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:duration) op:Equal rhs:{(SQ )} spids:[192])] spids: [192] ) terminator: <Op_Semi ";"> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:cmd) op:Equal rhs:{(SQ )} spids:[195])] spids: [195] ) terminator: <Op_Semi ";"> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:cpus) op:Equal rhs:{(-a)} spids:[198])] spids: [198] ) terminator: <Op_Semi ";"> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opts) op:Equal rhs:{(SQ )} spids:[202])] spids: [202] ) terminator: <Op_Semi ";"> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:tcmd) op:Equal rhs:{(cat)} spids:[205])] spids: [205] ) terminator: <Op_Semi ";"> ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ttext) op:Equal rhs:{(SQ )} spids:[209])] spids: [209] ) (C {(trap)} {(SQ )} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:stdout_workaround) op:Equal rhs:{(1)} spids:[227])] spids: [227] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:write_workaround) op:Equal rhs:{(1)} spids:[233])] spids: [233] ) (While cond: [ (C {(getopts)} {(cd) (Lit_Other ":") (hp) (Lit_Other ":") (t) (Lit_Other ":") (v)} {(opt)}) ] body: (DoGroup children: [ (Case to_match: {($ VSub_Name "$opt")} arms: [ (case_arm pat_list: [{(c)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_count) op: Equal rhs: {(1)} spids: [270] ) ] spids: [270] ) ] spids: [267 268 273 -1] ) (case_arm pat_list: [{(d)}] action: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_duration) op: Equal rhs: {(1)} spids: [279] ) ] spids: [279] ) terminator: <Op_Semi ";"> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:duration) op: Equal rhs: {($ VSub_Name "$OPTARG")} spids: [283] ) ] spids: [283] ) ] spids: [276 277 286 -1] ) (case_arm pat_list: [{(p)}] action: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_pid) op: Equal rhs: {(1)} spids: [292] ) ] spids: [292] ) terminator: <Op_Semi ";"> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pid) op: Equal rhs: {($ VSub_Name "$OPTARG")} spids: [296] ) ] spids: [296] ) ] spids: [289 290 299 -1] ) (case_arm pat_list: [{(t)}] action: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_tail) op: Equal rhs: {(1)} spids: [305] ) ] spids: [305] ) terminator: <Op_Semi ";"> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tnum) op: Equal rhs: {($ VSub_Name "$OPTARG")} spids: [309] ) ] spids: [309] ) ] spids: [302 303 312 -1] ) (case_arm pat_list: [{(v)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_verbose) op: Equal rhs: {(1)} spids: [318] ) ] spids: [318] ) ] spids: [315 316 321 -1] ) (case_arm pat_list: [{(h)} {(Lit_Other "?")}] action: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLessDash fd: -1 body: { (DQ ("USAGE: syscount [-chv] [-t top] {-p PID|-d seconds|command}\n") (" syscount # count by process name\n") (" -c # show counts by syscall name\n") (" -h # this usage message\n") (" -v # verbose: shows PID\n") (" -p PID # trace this PID only\n") (" -d seconds # duration of trace\n") (" -t num # show top number only\n") (" command # run and trace this command\n") (" eg,\n") (" syscount # syscalls by process name\n") (" syscount -c # syscalls by syscall name\n") (" syscount -d 5 # trace for 5 seconds\n") (" syscount -cp 923 # syscall names for PID 923\n") (" syscount -c ls # syscall names for ") (Right_DoubleQuote "\"") (ls) (Right_DoubleQuote "\"") ("\n") ("\n") ("See the man page and example file for more info.\n") ) } do_expansion: True here_end: END was_filled: True spids: [331] ) (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(2)} spids: [334] ) ] ) (C {(exit)} {(1)}) ] spids: [324 327 -1 364] ) ] spids: [260 264 364] ) ] spids: [257 366] ) ) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithWord w:{($ VSub_Name "$OPTIND")}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [370 379] ) } ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_Great left: (ArithWord w:{($ VSub_Pound "$#")}) right: (ArithWord w:{(Lit_Digits 0)}) ) ) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_cmd) op:Equal rhs:{(1)} spids:[402])] spids: [402] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: {(DQ ($ VSub_At "$@"))} spids: [406] ) ] spids: [406] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:cpus) op:Equal rhs:{(SQ )} spids:[412])] spids: [412] ) ] spids: [-1 399] ) ] spids: [-1 414] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_Great left: (ArithBinary op_id: Arith_Plus left: (ArithBinary op_id: Arith_Plus left: (ArithVarRef name:opt_pid) right: (ArithVarRef name:opt_duration) ) right: (ArithVarRef name:opt_cmd) ) right: (ArithWord w:{(Lit_Digits 1)}) ) ) terminator: <Op_Semi ";"> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("ERROR: Pick one of {-p PID|-n name|-d seconds|command}"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[443])] ) (C {(exit)} {(1)}) ] spids: [-1 438] ) ] spids: [-1 455] ) (If arms: [ (if_arm cond: [(Sentence child:(DParen child:(ArithVarRef name:opt_tail)) terminator:<Op_Semi ";">)] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tcmd) op: Equal rhs: {(DQ ("tail -") ($ VSub_Name "$tnum"))} spids: [470] ) ] spids: [470] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ttext) op: Equal rhs: {(DQ (" Top ") ($ VSub_Name "$tnum") (" only."))} spids: [477] ) ] spids: [477] ) ] spids: [-1 467] ) ] spids: [-1 484] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_duration)) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: {(DQ ("sleep ") ($ VSub_Name "$duration"))} spids: [499] ) ] spids: [499] ) (C {(echo)} { (DQ ("Tracing for ") ($ VSub_Name "$duration") (" seconds.") ($ VSub_Name "$ttext") (..)) } ) ] spids: [-1 496] ) ] spids: [-1 516] ) (If arms: [ (if_arm cond: [(Sentence child:(DParen child:(ArithVarRef name:opt_pid)) terminator:<Op_Semi ";">)] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:cpus) op:Equal rhs:{(SQ )} spids:[531])] spids: [531] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: {(DQ ("-p ") ($ VSub_Name "$pid"))} spids: [534] ) ] spids: [534] ) (C {(echo)} { (DQ ("Tracing PID ") ($ VSub_Name "$pid") (.) ($ VSub_Name "$ttext") (".. Ctrl-C to end.") ) } ) ] spids: [-1 528] ) ] spids: [-1 551] ) (AndOr children: [ (DParen child:(ArithVarRef name:opt_cmd)) (C {(echo)} { (DQ ("Tracing while running: ") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) ($ VSub_Name "$cmd") (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (.) ($ VSub_Name "$ttext") (..) ) } ) ] op_id: Op_DAmp ) (AndOr children: [ (DParen child: (ArithBinary op_id: Arith_DEqual left: (ArithBinary op_id: Arith_Plus left: (ArithBinary op_id: Arith_Plus left: (ArithVarRef name:opt_pid) right: (ArithVarRef name:opt_duration) ) right: (ArithVarRef name:opt_cmd) ) right: (ArithWord w:{(Lit_Digits 0)}) ) ) (C {(echo)} {(DQ (Tracing.) ($ VSub_Name "$ttext") (".. Ctrl-C to end."))}) ] op_id: Op_DAmp ) (AndOr children: [ (DParen child:(ArithVarRef name:stdout_workaround)) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opts) op: Equal rhs: {(DQ ("-o /dev/stdout"))} spids: [614] ) ] spids: [614] ) ] op_id: Op_DAmp ) (C {(ulimit)} {(-n)} {(32768)}) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_DAmp left: (ArithVarRef name:opt_count) right: (ArithUnary op_id:Arith_Bang child:(ArithVarRef name:opt_verbose)) ) ) terminator: <Op_Semi ";"> ) ] action: [ (C {(Lit_Other ":")} { (BracedVarSub token: <VSub_Name cmd> suffix_op: (StringUnary op_id:VTest_ColonEquals arg_word:{("sleep 999999")}) spids: [654 658] ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:out) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(perf)} {(stat)} {($ VSub_Name "$opts")} {(-e)} {(SQ <"syscalls:sys_enter_*">)} {($ VSub_Name "$cpus")} {($ VSub_Name "$cmd")} ) ] ) left_token: <Left_CommandSub "$("> spids: [662 678] ) } spids: [661] ) ] spids: [661] ) (C {(printf)} {(DQ ("%-17s %8s") (EscapedLiteralPart token:<Lit_EscapedChar "\\n">))} {(DQ (SYSCALL))} {(DQ (COUNT))} ) (Pipeline children: [ (C {(echo)} {(DQ ($ VSub_Name "$out"))}) (C {(awk)} { (SQ <"\n"> <"\t$1 && $2 ~ /syscalls:/ {\n"> <"\t\tsub(\"syscalls:sys_enter_\", \"\"); sub(\":\", \"\")\n"> <"\t\tgsub(\",\", \"\")\n"> <"\t\tprintf \"%-17s %8s\\n\", $2, $1\n"> <"\t}"> ) } ) (C {(sort)} {(-n)} {(-k2)}) (C {($ VSub_Name "$tcmd")}) ] negated: False ) (C {(exit)}) ] spids: [-1 649] ) ] spids: [-1 731] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_DAmp left: (ArithVarRef name:opt_count) right: (ArithVarRef name:opt_verbose) ) ) terminator: <Op_Semi ";"> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:write_workaround)) terminator: <Op_Semi ";"> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tp) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(perf)} {(list)} {(syscalls) (Lit_Other ":") (sys_enter_) (Lit_Other "*")} ) (C {(awk)} { (SQ <"\n"> < "\t\t $1 != \"syscalls:sys_enter_write\" && $1 ~ /syscalls:/ { printf \"-e %s \", $1 }" > ) } ) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [772 790] ) } spids: [771] ) ] spids: [771] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tp) op: Equal rhs: {(DQ ($ VSub_Name "$tp") (" -e syscalls:sys_enter_write"))} spids: [793] ) ] spids: [793] ) (C {(sh)} {(-c)} { (DQ ("perf record ") ($ VSub_Name "$tp") (" --filter 'common_pid != '") (EscapedLiteralPart token:<Lit_EscapedChar "\\$">) (EscapedLiteralPart token:<Lit_EscapedChar "\\$">) (" ") ($ VSub_Name "$cpus") (" ") ($ VSub_Name "$cmd") ) } ) ] spids: [-1 764] ) ] else_action: [ (C {(perf)} {(record)} {(SQ <"syscalls:sys_enter_*">)} {($ VSub_Name "$cpus")} {($ VSub_Name "$cmd")} ) ] spids: [817 837] ) (C {(printf)} {(DQ ("%-6s %-16s %-17s %8s") (EscapedLiteralPart token:<Lit_EscapedChar "\\n">))} {(DQ (PID))} {(DQ (COMM))} {(DQ (SYSCALL))} {(DQ (COUNT))} ) (Pipeline children: [ (C {(perf)} {(script)} {(--fields)} {(pid) (Lit_Comma ",") (comm) (Lit_Comma ",") (event)} ) (C {(awk)} { (SQ <"$1 != \"#\" {\n"> <"\t\tsub(\"syscalls:sys_enter_\", \"\"); sub(\":\", \"\")\n"> <"\t\ta[$1 \";\" $2 \";\" $3]++\n"> <"\t}\n"> <"\tEND {\n"> <"\t\tfor (k in a) {\n"> <"\t\t\tsplit(k, b, \";\");\n"> <"\t\t\tprintf \"%-6s %-16s %-17s %8d\\n\", b[2], b[1], b[3], a[k]\n"> <"\t\t}\n"> <"\t}"> ) } ) (C {(sort)} {(-n)} {(-k4)}) (C {($ VSub_Name "$tcmd")}) ] negated: False ) (C {(exit)}) ] spids: [-1 751] ) ] spids: [-1 909] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tp) op: Equal rhs: {(DQ ("-e raw_syscalls:sys_enter"))} spids: [915] ) ] spids: [915] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:write_workaround)) terminator: <Op_Semi ";"> ) ] action: [ (C {(sh)} {(-c)} { (DQ ("perf record ") ($ VSub_Name "$tp") (" --filter 'common_pid != '") (EscapedLiteralPart token:<Lit_EscapedChar "\\$">) (EscapedLiteralPart token:<Lit_EscapedChar "\\$">) (" ") ($ VSub_Name "$cpus") (" ") ($ VSub_Name "$cmd") ) } ) ] spids: [-1 930] ) ] else_action: [ (C {(perf)} {(record)} {($ VSub_Name "$tp")} {($ VSub_Name "$cpus")} {($ VSub_Name "$cmd")}) ] spids: [949 962] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_verbose)) terminator: <Op_Semi ";"> ) ] action: [ (C {(printf)} {(DQ ("%-6s %-16s %8s") (EscapedLiteralPart token:<Lit_EscapedChar "\\n">))} {(DQ (PID))} {(DQ (COMM))} {(DQ (COUNT))} ) (Pipeline children: [ (C {(perf)} {(script)} {(--fields)} {(pid) (Lit_Comma ",") (comm)}) (C {(awk)} { (SQ <"$1 != \"#\" { a[$1 \";\" $2]++ }\n"> <"\tEND {\n"> <"\t\tfor (k in a) {\n"> <"\t\t\tsplit(k, b, \";\");\n"> <"\t\t\tprintf \"%-6s %-16s %8d\\n\", b[2], b[1], a[k]\n"> <"\t\t}\n"> <"\t}"> ) } ) (C {(sort)} {(-n)} {(-k3)}) (C {($ VSub_Name "$tcmd")}) ] negated: False ) ] spids: [-1 975] ) ] else_action: [ (C {(printf)} {(DQ ("%-16s %8s") (EscapedLiteralPart token:<Lit_EscapedChar "\\n">))} {(DQ (COMM))} {(DQ (COUNT))} ) (Pipeline children: [ (C {(perf)} {(script)} {(--fields)} {(comm)}) (C {(awk)} { (SQ <"$1 != \"#\" { a[$1]++ }\n"> <"\tEND {\n"> <"\t\tfor (k in a) {\n"> <"\t\t\tprintf \"%-16s %8d\\n\", k, a[k]\n"> <"\t\t}\n"> <"\t}"> ) } ) (C {(sort)} {(-n)} {(-k2)}) (C {($ VSub_Name "$tcmd")}) ] negated: False ) ] spids: [1034 1086] ) ] )