(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:{(EmptyPart)} spids:[186])] spids: [186] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pid) op:Equal rhs:{(EmptyPart)} spids:[189])] spids: [189] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:duration) op:Equal rhs:{(EmptyPart)} spids:[192])] spids: [192] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:cmd) op:Equal rhs:{(EmptyPart)} 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:{(EmptyPart)} 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:{(EmptyPart)} 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 16777215] ) (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 16777215] ) (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 16777215] ) (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 16777215] ) (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 16777215] ) (case_arm pat_list: [{(h)} {(Lit_Other '?')}] action: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 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: T spids: [331] ) (Redir op_id: Redir_GreatAnd fd: 16777215 arg_word: {(2)} spids: [334] ) ] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [324 327 16777215 365] ) ] spids: [260 264 365] ) ] spids: [257 367] ) ) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithWord w:{($ VSub_Name '$OPTIND')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [371 380] ) } ) (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:[403])] spids: [403] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: {(DQ ($ VSub_At '$@'))} spids: [407] ) ] spids: [407] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:cpus) op:Equal rhs:{(EmptyPart)} spids:[413])] spids: [413] ) ] spids: [16777215 400] ) ] spids: [16777215 415] ) (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:16777215 arg_word:{(2)} spids:[444])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 439] ) ] spids: [16777215 456] ) (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: [471] ) ] spids: [471] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ttext) op: Equal rhs: {(DQ (' Top ') ($ VSub_Name '$tnum') (' only.'))} spids: [478] ) ] spids: [478] ) ] spids: [16777215 468] ) ] spids: [16777215 485] ) (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: [500] ) ] spids: [500] ) (C {(echo)} { (DQ ('Tracing for ') ($ VSub_Name '$duration') (' seconds.') ($ VSub_Name '$ttext') (..)) } ) ] spids: [16777215 497] ) ] spids: [16777215 517] ) (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:{(EmptyPart)} spids:[532])] spids: [532] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: {(DQ ('-p ') ($ VSub_Name '$pid'))} spids: [535] ) ] spids: [535] ) (C {(echo)} { (DQ ('Tracing PID ') ($ VSub_Name '$pid') (.) ($ VSub_Name '$ttext') ('.. Ctrl-C to end.') ) } ) ] spids: [16777215 529] ) ] spids: [16777215 552] ) (AndOr ops: [Op_DAmp] 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') (..) ) } ) ] ) (AndOr ops: [Op_DAmp] 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.'))}) ] ) (AndOr ops: [Op_DAmp] 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: [615] ) ] spids: [615] ) ] ) (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: [655 659] ) } ) (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: [663 679] ) } spids: [662] ) ] spids: [662] ) (C {(printf)} {(DQ ('%-17s %8s') (Lit_Other '\\') (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: F ) (ControlFlow token:<ControlFlow_Exit exit>) ] spids: [16777215 650] ) ] spids: [16777215 733] ) (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: F ) ] ) left_token: <Left_CommandSub '$('> spids: [774 792] ) } spids: [773] ) ] spids: [773] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tp) op: Equal rhs: {(DQ ($ VSub_Name '$tp') (' -e syscalls:sys_enter_write'))} spids: [795] ) ] spids: [795] ) (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: [16777215 766] ) ] else_action: [ (C {(perf)} {(record)} {(SQ <'syscalls:sys_enter_*'>)} {($ VSub_Name '$cpus')} {($ VSub_Name '$cmd')} ) ] spids: [819 839] ) (C {(printf)} {(DQ ('%-6s %-16s %-17s %8s') (Lit_Other '\\') (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: F ) (ControlFlow token:<ControlFlow_Exit exit>) ] spids: [16777215 753] ) ] spids: [16777215 912] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tp) op: Equal rhs: {(DQ ('-e raw_syscalls:sys_enter'))} spids: [918] ) ] spids: [918] ) (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: [16777215 933] ) ] else_action: [ (C {(perf)} {(record)} {($ VSub_Name '$tp')} {($ VSub_Name '$cpus')} {($ VSub_Name '$cmd')}) ] spids: [952 965] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_verbose)) terminator: <Op_Semi ';'> ) ] action: [ (C {(printf)} {(DQ ('%-6s %-16s %8s') (Lit_Other '\\') (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: F ) ] spids: [16777215 978] ) ] else_action: [ (C {(printf)} {(DQ ('%-16s %8s') (Lit_Other '\\') (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: F ) ] spids: [1038 1091] ) ] )