(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tracing) op: Equal rhs: {(/sys/kernel/debug/tracing)} ) ] ) (command.CommandList children: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:opt_duration) op:Equal rhs:{(0)})] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:duration) op:Equal rhs:(word.EmptyWord))] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:opt_interval) op:Equal rhs:{(0)})] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:interval) op:Equal rhs:{(999999)})] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:opt_timestamp) op:Equal rhs:{(0)})] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:opt_tail) op:Equal rhs:{(0)})] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:tcmd) op:Equal rhs:{(cat)})] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:ttext) op:Equal rhs:(word.EmptyWord))] ) ] ) (C {(trap)} {(SQ <'quit=1'>)} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)}) (command.FuncDef name: usage body: (command.BraceGroup children: [ (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.HereDoc op: <Redir_DLessDash '<<-'> fd: 16777215 here_begin: {(END)} here_end_span_id: 217 stdin_parts: [ ('USAGE: funccount [-hT] [-i secs] [-d secs] [-t top] funcstring\n') (' -d seconds # total duration of trace\n') (' -h # this usage message\n') (' -i seconds # interval summary\n') (' -t top # show top num entries only\n') (' -T # include timestamp (for -i)\n') (' eg,\n') (" funccount 'vfs*' # trace all funcs that match ") (Right_DoubleQuote '"') ('vfs*') (Right_DoubleQuote '"') ('\n') (" funccount -d 5 'tcp*' # trace ") (Right_DoubleQuote '"') ('tcp*') (Right_DoubleQuote '"') (' funcs for 5 seconds\n') (" funccount -t 10 'ext3*' # show top 10 ") (Right_DoubleQuote '"') ('ext3*') (Right_DoubleQuote '"') (' funcs\n') (" funccount -i 1 'ext3*' # summary every 1 second\n") (" funccount -i 1 -d 5 'ext3*' # 5 x 1 second summaries\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>) ] ) ) (command.FuncDef name: warn body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [(C {(eval)} {(DQ ($ VSub_At '$@'))})] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (command.SimpleCommand words: [ {(echo)} { (DQ ('WARNING: command failed ') (word_part.EscapedLiteralPart token: <Lit_EscapedChar '\\"'> ) ($ VSub_At '$@') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ) } ] redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) ] ) ] ) ] ) ) (command.FuncDef name: die body: (command.BraceGroup children: [ (command.SimpleCommand words: [{(echo)} {(DQ ($ VSub_At '$@'))}] redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] ) ) (command.WhileUntil keyword: <KW_While while> cond: [(C {(getopts)} {(d) (Lit_Other ':') (hi) (Lit_Other ':') (t) (Lit_Other ':') (T)} {(opt)})] body: (command.DoGroup children: [ (command.Case to_match: {($ VSub_DollarName '$opt')} arms: [ (case_arm pat_list: [{(d)}] action: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_duration) op: Equal rhs: {(1)} ) ] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:duration) op: Equal rhs: {($ VSub_DollarName '$OPTARG')} ) ] ) ] ) (case_arm pat_list: [{(i)}] action: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_interval) op: Equal rhs: {(1)} ) ] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:interval) op: Equal rhs: {($ VSub_DollarName '$OPTARG')} ) ] ) ] ) (case_arm pat_list: [{(t)}] action: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:opt_tail) op:Equal rhs:{(1)})] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tnum) op: Equal rhs: {($ VSub_DollarName '$OPTARG')} ) ] ) ] ) (case_arm pat_list: [{(T)}] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_timestamp) op: Equal rhs: {(1)} ) ] ) ] ) (case_arm pat_list:[{(h)} {(Lit_Other '?')}] action:[(C {(usage)})]) ] ) ] ) ) (C {(shift)} { (word_part.ArithSubPart anode: (arith_expr.ArithBinary op_id: Arith_Minus left: (arith_expr.ArithWord w:{($ VSub_DollarName '$OPTIND')}) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) } ) (command.AndOr ops: [Op_DAmp] children: [ (command.DParen child: (arith_expr.ArithBinary op_id: Arith_DEqual left: (arith_expr.ArithWord w:{($ VSub_Pound '$#')}) right: (arith_expr.ArithWord w:{(Lit_Digits 0)}) ) ) (C {(usage)}) ] ) (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:funcs) op:Equal rhs:{(DQ ($ VSub_Number '$1'))})] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child:(arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_tail>)) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tcmd) op: Equal rhs: {(DQ ('tail -') ($ VSub_DollarName '$tnum'))} ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName 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.ArithVarRef token:<Lit_ArithVarLike opt_duration>) ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} { (DQ ('Tracing ') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_DollarName '$funcs') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' for ') ($ VSub_DollarName '$duration') (' seconds.') ($ VSub_DollarName '$ttext') (..) ) } ) ] ) ] else_action: [ (C {(echo)} { (DQ ('Tracing ') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_DollarName '$funcs') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (.) ($ VSub_DollarName '$ttext') ('.. Ctrl-C to end.') ) } ) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.DParen child: (arith_expr.ArithBinary op_id: Arith_DAmp left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_duration>) right: (arith_expr.ArithUnary op_id: Arith_Bang child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_interval>) ) ) ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:interval) op: Equal rhs: {($ VSub_DollarName '$duration')} ) ] ) ] ) (command.AndOr ops: [Op_DPipe] children: [ (C {(cd)} {($ VSub_DollarName '$tracing')}) (C {(die)} { (DQ ('ERROR: accessing tracing. Root user? Kernel has FTRACE?\n') (' debugfs mounted? (mount -t debugfs debugfs /sys/kernel/debug)') ) } ) ] ) (C {(sysctl)} {(-q)} {(kernel.ftrace_enabled) (Lit_Other '=') (1)}) (command.AndOr ops: [Op_DPipe] children: [ (command.SimpleCommand words: [{(echo)} {(DQ ($ VSub_DollarName '$funcs'))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(set_ftrace_filter)})] ) (C {(die)} { (DQ ('ERROR: enabling ') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_DollarName '$funcs') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('. Exiting.') ) } ) ] ) (C {(warn)} {(DQ ('echo nop > current_tracer'))}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (command.SimpleCommand words: [{(echo)} {(1)}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(function_profile_enabled)} ) ] ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (command.SimpleCommand words: [{(echo)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(set_ftrace_filter)})] ) (C {(die)} {(DQ ('ERROR: enabling function profiling.'))} {(DQ ('Have CONFIG_FUNCTION_PROFILER? Exiting.'))} ) ] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:quit) op:Equal rhs:{(0)})] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:secs) op:Equal rhs:{(0)})] ) ] ) (command.WhileUntil keyword: <KW_While while> cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithBinary op_id: Arith_DAmp left: (arith_expr.ArithUnary op_id: Arith_Bang child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike quit>) ) right: (arith_expr.ArithBinary op_id: Arith_DPipe left: (arith_expr.ArithUnary op_id: Arith_Bang child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_duration>) ) right: (arith_expr.ArithBinary op_id: Arith_Less left: (arith_expr.ArithVarRef token:<Lit_ArithVarLike secs>) right: (arith_expr.ArithVarRef token:<Lit_ArithVarLike duration>) ) ) ) ) terminator: <Op_Semi ';'> ) ] body: (command.DoGroup children: [ (command.DParen child: (arith_expr.BinaryAssign op_id: Arith_PlusEqual left: (lhs_expr.LhsName name:secs) right: (arith_expr.ArithVarRef token:<Lit_ArithVarLike interval>) ) ) (command.SimpleCommand words: [{(echo)} {(0)}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(function_profile_enabled)} ) ] ) (command.SimpleCommand words: [{(echo)} {(1)}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(function_profile_enabled)} ) ] ) (C {(sleep)} {($ VSub_DollarName '$interval')}) (C {(echo)}) (command.AndOr ops: [Op_DAmp] children: [ (command.DParen child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_timestamp>) ) (C {(date)}) ] ) (C {(printf)} {(DQ ('%-30s %8s') (Lit_Other '\\') (n))} {(DQ (FUNC))} {(DQ (COUNT))}) (command.Pipeline children: [ (C {(cat)} {(trace_stat/function) (Lit_Other '*')}) (C {(awk)} { (SQ <'\n'> <'\t# skip headers by matching on the numeric hit column\n'> <'\t$2 ~ /[0-9]/ { a[$1] += $2 }\n'> <'\tEND {\n'> <'\t\tfor (k in a) {\n'> <'\t\t\tprintf "%-30s %8d\\n", k, a[k]\n'> <'\t\t}\n'> <'\t}'> ) } ) (C {(sort)} {(-n)} {(-k2)}) (C {($ VSub_DollarName '$tcmd')}) ] negated: F ) ] ) ) (command.SimpleCommand words: [{(echo)}] redirects: [(redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})] ) (command.SimpleCommand words: [{(echo)} {(DQ ('Ending tracing...'))}] redirects: [(redir.Redir op:<Redir_Great '2>'> fd:2 arg_word:{(/dev/null)})] ) (C {(warn)} {(DQ ('echo 0 > function_profile_enabled'))}) (C {(warn)} {(DQ ('echo > set_ftrace_filter'))}) ] )