(command.CommandList children: [ (command.CommandList children: [ (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_count) op:Equal rhs:{(0)})] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_pid) op:Equal rhs:{(0)})] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_verbose) op:Equal rhs:{(0)})] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_cmd) op:Equal rhs:{(0)})] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_duration) op:Equal rhs:{(0)})] ) terminator: <Op_Semi ';'> ) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_tail) op:Equal rhs:{(0)})] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:tnum) op:Equal rhs:(word.Empty))] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:pid) op:Equal rhs:(word.Empty))] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:duration) op:Equal rhs:(word.Empty))] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:cmd) op:Equal rhs:(word.Empty))] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:cpus) op:Equal rhs:{(-a)})] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opts) op:Equal rhs:(word.Empty))] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:tcmd) op:Equal rhs:{(cat)})] ) terminator: <Op_Semi ';'> ) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:ttext) op:Equal rhs:(word.Empty))] ) ] ) (C {(trap)} {(SQ )} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)}) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:stdout_workaround) op:Equal rhs:{(1)})] ) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:write_workaround) op:Equal rhs:{(1)})] ) (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_DollarName '$opt')} arms: [ (case_arm pat_list: [{(c)}] action: [ (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_count) op:Equal rhs:{(1)})] ) ] ) (case_arm pat_list: [{(d)}] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_duration) op: Equal rhs: {(1)} ) ] ) terminator: <Op_Semi ';'> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:duration) op: Equal rhs: {($ VSub_DollarName '$OPTARG')} ) ] ) ] ) (case_arm pat_list: [{(p)}] action: [ (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_pid) op:Equal rhs:{(1)})] ) terminator: <Op_Semi ';'> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pid) op: Equal rhs: {($ VSub_DollarName '$OPTARG')} ) ] ) ] ) (case_arm pat_list: [{(t)}] action: [ (command.Sentence child: (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_tail) op:Equal rhs:{(1)})] ) terminator: <Op_Semi ';'> ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tnum) op: Equal rhs: {($ VSub_DollarName '$OPTARG')} ) ] ) ] ) (case_arm pat_list: [{(v)}] action: [ (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_verbose) op:Equal rhs:{(1)})] ) ] ) (case_arm pat_list: [{(h)} {(Lit_QMark '?')}] action: [ (command.Simple 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)} ) ] ) ] ) ] ) ) (C {(shift)} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Arith_Minus left: (arith_expr.ArithWord w:{($ VSub_DollarName '$OPTIND')}) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) } ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Arith_Great left: (arith_expr.ArithWord w:{($ VSub_Pound '$#')}) right: (arith_expr.ArithWord w:{(Lit_Digits 0)}) ) ) terminator: <Op_Semi ';'> ) ] action: [ (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opt_cmd) op:Equal rhs:{(1)})] ) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:cmd) op:Equal rhs:{(DQ ($ VSub_At '$@'))})] ) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:cpus) op:Equal rhs:(word.Empty))] ) ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Arith_Great left: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.VarRef token:<Lit_ArithVarLike opt_pid>) right: (arith_expr.VarRef token:<Lit_ArithVarLike opt_duration>) ) right: (arith_expr.VarRef token:<Lit_ArithVarLike opt_cmd>) ) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) terminator: <Op_Semi ';'> ) ] action: [ (command.Simple 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)}) ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_tail>)) terminator: <Op_Semi ';'> ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tcmd) op: Equal rhs: {(DQ ('tail -') ($ VSub_DollarName '$tnum'))} ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ttext) op: Equal rhs: {(DQ (' Top ') ($ VSub_DollarName '$tnum') (' only.'))} ) ] ) ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_duration>)) terminator: <Op_Semi ';'> ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:cmd) op: Equal rhs: {(DQ ('sleep ') ($ VSub_DollarName '$duration'))} ) ] ) (C {(echo)} { (DQ ('Tracing for ') ($ VSub_DollarName '$duration') (' seconds.') ($ VSub_DollarName '$ttext') (..) ) } ) ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_pid>)) terminator: <Op_Semi ';'> ) ] action: [ (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:cpus) op:Equal rhs:(word.Empty))] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:cmd) op: Equal rhs: {(DQ ('-p ') ($ VSub_DollarName '$pid'))} ) ] ) (C {(echo)} { (DQ ('Tracing PID ') ($ VSub_DollarName '$pid') (.) ($ VSub_DollarName '$ttext') ('.. Ctrl-C to end.') ) } ) ] ) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_cmd>)) (C {(echo)} { (DQ ('Tracing while running: ') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) ($ VSub_DollarName '$cmd') (word_part.EscapedLiteral token:<Lit_EscapedChar '\\"'>) (.) ($ VSub_DollarName '$ttext') (..) ) } ) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.DParen child: (arith_expr.Binary op_id: Arith_DEqual left: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.Binary op_id: Arith_Plus left: (arith_expr.VarRef token:<Lit_ArithVarLike opt_pid>) right: (arith_expr.VarRef token:<Lit_ArithVarLike opt_duration>) ) right: (arith_expr.VarRef token:<Lit_ArithVarLike opt_cmd>) ) right: (arith_expr.ArithWord w:{(Lit_Digits 0)}) ) ) (C {(echo)} {(DQ (Tracing.) ($ VSub_DollarName '$ttext') ('.. Ctrl-C to end.'))}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike stdout_workaround>)) (command.ShAssignment pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:opts) op:Equal rhs:{(DQ ('-o /dev/stdout'))})] ) ] ) (C {(ulimit)} {(-n)} {(32768)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Arith_DAmp left: (arith_expr.VarRef token:<Lit_ArithVarLike opt_count>) right: (arith_expr.Unary op_id: Arith_Bang child: (arith_expr.VarRef token:<Lit_ArithVarLike opt_verbose>) ) ) ) terminator: <Op_Semi ';'> ) ] action: [ (C {(Lit_Other ':')} { (braced_var_sub token: <VSub_Name cmd> suffix_op: (suffix_op.Unary op_id:VTest_ColonEquals arg_word:{('sleep 999999')}) ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:out) op: Equal rhs: { (command_sub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children: [ (C {(perf)} {(stat)} {($ VSub_DollarName '$opts')} {(-e)} {(SQ <'syscalls:sys_enter_*'>)} {($ VSub_DollarName '$cpus')} {($ VSub_DollarName '$cmd')} ) ] ) ) } ) ] ) (C {(printf)} {(DQ ('%-17s %8s') (Lit_Other '\\') (n))} {(DQ (SYSCALL))} {(DQ (COUNT))}) (command.Pipeline children: [ (C {(echo)} {(DQ ($ VSub_DollarName '$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_DollarName '$tcmd')}) ] negated: F ) (command.ControlFlow token:<ControlFlow_Exit exit>) ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Arith_DAmp left: (arith_expr.VarRef token:<Lit_ArithVarLike opt_count>) right: (arith_expr.VarRef token:<Lit_ArithVarLike opt_verbose>) ) ) terminator: <Op_Semi ';'> ) ] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.VarRef token:<Lit_ArithVarLike write_workaround>) ) terminator: <Op_Semi ';'> ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tp) op: Equal rhs: { (command_sub left_token: <Left_DollarParen '$('> command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(perf)} {(list)} {(syscalls) (Lit_Other ':') (sys_enter_) (Lit_Star '*')} ) (C {(awk)} { (SQ <'\n'> < '\t\t $1 != "syscalls:sys_enter_write" && $1 ~ /syscalls:/ { printf "-e %s ", $1 }' > ) } ) ] negated: F ) ] ) ) } ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tp) op: Equal rhs: {(DQ ($ VSub_DollarName '$tp') (' -e syscalls:sys_enter_write'))} ) ] ) (C {(sh)} {(-c)} { (DQ ('perf record ') ($ VSub_DollarName '$tp') (" --filter 'common_pid != '") (word_part.EscapedLiteral token: <Lit_EscapedChar '\\$'> ) (word_part.EscapedLiteral token:<Lit_EscapedChar '\\$'>) (' ') ($ VSub_DollarName '$cpus') (' ') ($ VSub_DollarName '$cmd') ) } ) ] ) ] else_action: [ (C {(perf)} {(record)} {(SQ <'syscalls:sys_enter_*'>)} {($ VSub_DollarName '$cpus')} {($ VSub_DollarName '$cmd')} ) ] ) (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_DollarName '$tcmd')}) ] negated: F ) (command.ControlFlow token:<ControlFlow_Exit exit>) ] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tp) op: Equal rhs: {(DQ ('-e raw_syscalls:sys_enter'))} ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.VarRef token:<Lit_ArithVarLike write_workaround>) ) terminator: <Op_Semi ';'> ) ] action: [ (C {(sh)} {(-c)} { (DQ ('perf record ') ($ VSub_DollarName '$tp') (" --filter 'common_pid != '") (word_part.EscapedLiteral token:<Lit_EscapedChar '\\$'>) (word_part.EscapedLiteral token:<Lit_EscapedChar '\\$'>) (' ') ($ VSub_DollarName '$cpus') (' ') ($ VSub_DollarName '$cmd') ) } ) ] ) ] else_action: [ (C {(perf)} {(record)} {($ VSub_DollarName '$tp')} {($ VSub_DollarName '$cpus')} {($ VSub_DollarName '$cmd')} ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child:(arith_expr.VarRef token:<Lit_ArithVarLike opt_verbose>)) 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_DollarName '$tcmd')}) ] negated: F ) ] ) ] 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_DollarName '$tcmd')}) ] negated: F ) ] ) ] )