(command.CommandList children: [ (command.CommandList children: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_count spids:[163]) op: Equal rhs: {(0)} spids: [163] ) ] spids: [163] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_pid spids:[167]) op: Equal rhs: {(0)} spids: [167] ) ] spids: [167] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_verbose spids:[171]) op: Equal rhs: {(0)} spids: [171] ) ] spids: [171] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_cmd spids:[175]) op: Equal rhs: {(0)} spids: [175] ) ] spids: [175] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_duration spids:[179]) op: Equal rhs: {(0)} spids: [179] ) ] spids: [179] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_tail spids:[183]) op: Equal rhs: {(0)} spids: [183] ) ] spids: [183] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tnum spids:[186]) op: Equal rhs: (word.EmptyWord) spids: [186] ) ] spids: [186] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:pid spids:[189]) op: Equal rhs: (word.EmptyWord) spids: [189] ) ] spids: [189] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:duration spids:[192]) op: Equal rhs: (word.EmptyWord) spids: [192] ) ] spids: [192] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cmd spids:[195]) op: Equal rhs: (word.EmptyWord) spids: [195] ) ] spids: [195] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cpus spids:[198]) op: Equal rhs: {(-a)} spids: [198] ) ] spids: [198] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opts spids:[202]) op: Equal rhs: (word.EmptyWord) spids: [202] ) ] spids: [202] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tcmd spids:[205]) op: Equal rhs: {(cat)} spids: [205] ) ] spids: [205] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:ttext spids:[209]) op: Equal rhs: (word.EmptyWord) spids: [209] ) ] spids: [209] ) ] ) (C {(trap)} {(SQ )} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:stdout_workaround spids:[227]) op: Equal rhs: {(1)} spids: [227] ) ] spids: [227] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:write_workaround spids:[233]) op: Equal rhs: {(1)} spids: [233] ) ] spids: [233] ) (command.WhileUntil keyword: <KW_While while> cond: [ (C {(getopts)} {(cd) (Lit_Other ':') (hp) (Lit_Other ':') (t) (Lit_Other ':') (v)} {(opt)}) ] body: (command.DoGroup children: [ (command.Case to_match: {($ VSub_Name '$opt')} arms: [ (case_arm pat_list: [{(c)}] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_count spids:[270]) op: Equal rhs: {(1)} spids: [270] ) ] spids: [270] ) ] spids: [267 268 273 16777215] ) (case_arm pat_list: [{(d)}] action: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_duration spids:[279]) op: Equal rhs: {(1)} spids: [279] ) ] spids: [279] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:duration spids:[283]) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [283] ) ] spids: [283] ) ] spids: [276 277 286 16777215] ) (case_arm pat_list: [{(p)}] action: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_pid spids:[292]) op: Equal rhs: {(1)} spids: [292] ) ] spids: [292] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:pid spids:[296]) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [296] ) ] spids: [296] ) ] spids: [289 290 299 16777215] ) (case_arm pat_list: [{(t)}] action: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_tail spids:[305]) op: Equal rhs: {(1)} spids: [305] ) ] spids: [305] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tnum spids:[309]) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [309] ) ] spids: [309] ) ] spids: [302 303 312 16777215] ) (case_arm pat_list: [{(v)}] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_verbose spids:[318]) op: Equal rhs: {(1)} spids: [318] ) ] spids: [318] ) ] spids: [315 316 321 16777215] ) (case_arm pat_list: [{(h)} {(Lit_Other '?')}] action: [ (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.HereDoc op: <Redir_DLessDash '<<-'> fd: 16777215 here_begin: {(END)} here_end_span_id: 359 stdin_parts: [ ('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') ] ) (redir.Redir op: <Redir_GreatAnd '>&'> fd: 16777215 arg_word: {(2)} ) ] ) (command.ControlFlow token: <ControlFlow_Exit exit> arg_word: {(1)} ) ] spids: [324 327 16777215 366] ) ] spids: [260 264 366] ) ] spids: [257 368] ) ) (C {(shift)} { (word_part.ArithSubPart anode: (arith_expr.ArithBinary op_id: Arith_Minus left: (arith_expr.ArithWord w:{($ VSub_Name '$OPTIND')}) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) spids: [372 381] ) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithBinary op_id: Arith_Great left: (arith_expr.ArithWord w:{($ VSub_Pound '$#')}) right: (arith_expr.ArithWord w:{(Lit_Digits 0)}) ) spids: [389 398] ) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_cmd spids:[404]) op: Equal rhs: {(1)} spids: [404] ) ] spids: [404] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cmd spids:[408]) op: Equal rhs: {(DQ ($ VSub_At '$@'))} spids: [408] ) ] spids: [408] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cpus spids:[414]) op: Equal rhs: (word.EmptyWord) spids: [414] ) ] spids: [414] ) ] spids: [16777215 401] ) ] spids: [16777215 416] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithBinary op_id: Arith_Great left: (arith_expr.ArithBinary op_id: Arith_Plus left: (arith_expr.ArithBinary op_id: Arith_Plus left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_pid>) right: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_duration>) ) right: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_cmd>) ) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) spids: [420 437] ) terminator: <Op_Semi ';'> ) ] action: [ (command.SimpleCommand words: [{(echo)} {(DQ ('ERROR: Pick one of {-p PID|-n name|-d seconds|command}'))}] redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [16777215 440] ) ] spids: [16777215 457] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_tail>) spids: [461 466] ) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tcmd spids:[472]) op: Equal rhs: {(DQ ('tail -') ($ VSub_Name '$tnum'))} spids: [472] ) ] spids: [472] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:ttext spids:[479]) op: Equal rhs: {(DQ (' Top ') ($ VSub_Name '$tnum') (' only.'))} spids: [479] ) ] spids: [479] ) ] spids: [16777215 469] ) ] spids: [16777215 486] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_duration>) spids: [490 495] ) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cmd spids:[501]) op: Equal rhs: {(DQ ('sleep ') ($ VSub_Name '$duration'))} spids: [501] ) ] spids: [501] ) (C {(echo)} { (DQ ('Tracing for ') ($ VSub_Name '$duration') (' seconds.') ($ VSub_Name '$ttext') (..)) } ) ] spids: [16777215 498] ) ] spids: [16777215 518] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_pid>) spids: [522 527] ) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cpus spids:[533]) op: Equal rhs: (word.EmptyWord) spids: [533] ) ] spids: [533] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:cmd spids:[536]) op: Equal rhs: {(DQ ('-p ') ($ VSub_Name '$pid'))} spids: [536] ) ] spids: [536] ) (C {(echo)} { (DQ ('Tracing PID ') ($ VSub_Name '$pid') (.) ($ VSub_Name '$ttext') ('.. Ctrl-C to end.') ) } ) ] spids: [16777215 530] ) ] spids: [16777215 553] ) (command.AndOr ops: [Op_DAmp] children: [ (command.DParen child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_cmd>) spids: [555 560] ) (C {(echo)} { (DQ ('Tracing while running: ') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$cmd') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (.) ($ VSub_Name '$ttext') (..) ) } ) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.DParen child: (arith_expr.ArithBinary op_id: Arith_DEqual left: (arith_expr.ArithBinary op_id: Arith_Plus left: (arith_expr.ArithBinary op_id: Arith_Plus left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_pid>) right: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_duration>) ) right: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_cmd>) ) right: (arith_expr.ArithWord w:{(Lit_Digits 0)}) ) spids: [576 593] ) (C {(echo)} {(DQ (Tracing.) ($ VSub_Name '$ttext') ('.. Ctrl-C to end.'))}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.DParen child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike stdout_workaround>) spids: [607 612] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opts spids:[616]) op: Equal rhs: {(DQ ('-o /dev/stdout'))} spids: [616] ) ] spids: [616] ) ] ) (C {(ulimit)} {(-n)} {(32768)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithBinary op_id: Arith_DAmp left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_count>) right: (arith_expr.ArithUnary op_id: Arith_Bang child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_verbose>) ) ) spids: [637 648] ) terminator: <Op_Semi ';'> ) ] action: [ (C {(Lit_Other ':')} { (word_part.BracedVarSub token: <VSub_Name cmd> suffix_op: (suffix_op.StringUnary op_id: VTest_ColonEquals arg_word: {('sleep 999999')} ) spids: [656 660] ) } ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:out spids:[663]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(perf)} {(stat)} {($ VSub_Name '$opts')} {(-e)} {(SQ <'syscalls:sys_enter_*'>)} {($ VSub_Name '$cpus')} {($ VSub_Name '$cmd')} ) ] ) left_token: <Left_CommandSub '$('> spids: [664 680] ) } spids: [663] ) ] spids: [663] ) (C {(printf)} {(DQ ('%-17s %8s') (Lit_Other '\\') (n))} {(DQ (SYSCALL))} {(DQ (COUNT))}) (command.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 ) (command.ControlFlow token:<ControlFlow_Exit exit>) ] spids: [16777215 651] ) ] spids: [16777215 734] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithBinary op_id: Arith_DAmp left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_count>) right: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_verbose>) ) spids: [742 751] ) terminator: <Op_Semi ';'> ) ] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike write_workaround>) spids: [759 764] ) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tp spids:[774]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.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: [775 793] ) } spids: [774] ) ] spids: [774] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tp spids:[796]) op: Equal rhs: {(DQ ($ VSub_Name '$tp') (' -e syscalls:sys_enter_write'))} spids: [796] ) ] spids: [796] ) (C {(sh)} {(-c)} { (DQ ('perf record ') ($ VSub_Name '$tp') (" --filter 'common_pid != '") (word_part.EscapedLiteralPart token: <Lit_EscapedChar '\\$'> ) (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) (' ') ($ VSub_Name '$cpus') (' ') ($ VSub_Name '$cmd') ) } ) ] spids: [16777215 767] ) ] else_action: [ (C {(perf)} {(record)} {(SQ <'syscalls:sys_enter_*'>)} {($ VSub_Name '$cpus')} {($ VSub_Name '$cmd')} ) ] spids: [820 840] ) (C {(printf)} {(DQ ('%-6s %-16s %-17s %8s') (Lit_Other '\\') (n))} {(DQ (PID))} {(DQ (COMM))} {(DQ (SYSCALL))} {(DQ (COUNT))} ) (command.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 ) (command.ControlFlow token:<ControlFlow_Exit exit>) ] spids: [16777215 754] ) ] spids: [16777215 913] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tp spids:[919]) op: Equal rhs: {(DQ ('-e raw_syscalls:sys_enter'))} spids: [919] ) ] spids: [919] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike write_workaround>) spids: [926 931] ) terminator: <Op_Semi ';'> ) ] action: [ (C {(sh)} {(-c)} { (DQ ('perf record ') ($ VSub_Name '$tp') (" --filter 'common_pid != '") (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) (' ') ($ VSub_Name '$cpus') (' ') ($ VSub_Name '$cmd') ) } ) ] spids: [16777215 934] ) ] else_action: [ (C {(perf)} {(record)} {($ VSub_Name '$tp')} {($ VSub_Name '$cpus')} {($ VSub_Name '$cmd')}) ] spids: [953 966] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_verbose>) spids: [971 976] ) terminator: <Op_Semi ';'> ) ] action: [ (C {(printf)} {(DQ ('%-6s %-16s %8s') (Lit_Other '\\') (n))} {(DQ (PID))} {(DQ (COMM))} {(DQ (COUNT))} ) (command.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 979] ) ] else_action: [ (C {(printf)} {(DQ ('%-16s %8s') (Lit_Other '\\') (n))} {(DQ (COMM))} {(DQ (COUNT))}) (command.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: [1039 1092] ) ] )