(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tracing spids:[124]) op: Equal rhs: {(/sys/kernel/debug/tracing)} spids: [124] ) ] spids: [124] ) (command.CommandList children: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_duration spids:[127]) op: Equal rhs: {(0)} spids: [127] ) ] spids: [127] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:duration spids:[131]) op: Equal rhs: (word.EmptyWord) spids: [131] ) ] spids: [131] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_interval spids:[134]) op: Equal rhs: {(0)} spids: [134] ) ] spids: [134] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:interval spids:[138]) op: Equal rhs: {(999999)} spids: [138] ) ] spids: [138] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_timestamp spids:[142]) op: Equal rhs: {(0)} spids: [142] ) ] spids: [142] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_tail spids:[145]) op: Equal rhs: {(0)} spids: [145] ) ] spids: [145] ) terminator: <Op_Semi ';'> ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tcmd spids:[149]) op: Equal rhs: {(cat)} spids: [149] ) ] spids: [149] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:ttext spids:[153]) op: Equal rhs: (word.EmptyWord) spids: [153] ) ] spids: [153] ) ] ) (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>) ] spids: [179] ) spids: [175 178] ) (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)})] ) ] spids: [16777215 242] ) ] spids: [16777215 258] ) ] spids: [228] ) spids: [224 227] ) (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)}) ] spids: [267] ) spids: [263 266] ) (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 spids:[317]) op: Equal rhs: {(1)} spids: [317] ) ] spids: [317] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:duration spids:[321]) op: Equal rhs: {($ VSub_DollarName '$OPTARG')} spids: [321] ) ] spids: [321] ) ] spids: [314 315 324 16777215] ) (case_arm pat_list: [{(i)}] action: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_interval spids:[330]) op: Equal rhs: {(1)} spids: [330] ) ] spids: [330] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:interval spids:[334]) op: Equal rhs: {($ VSub_DollarName '$OPTARG')} spids: [334] ) ] spids: [334] ) ] spids: [327 328 337 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:[343]) op: Equal rhs: {(1)} spids: [343] ) ] spids: [343] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tnum spids:[347]) op: Equal rhs: {($ VSub_DollarName '$OPTARG')} spids: [347] ) ] spids: [347] ) ] spids: [340 341 350 16777215] ) (case_arm pat_list: [{(T)}] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:opt_timestamp spids:[356]) op: Equal rhs: {(1)} spids: [356] ) ] spids: [356] ) ] spids: [353 354 359 16777215] ) (case_arm pat_list: [{(h)} {(Lit_Other '?')}] action: [(C {(usage)})] spids: [362 365 369 16777215] ) ] spids: [307 311 372] ) ] spids: [304 374] ) ) (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)}) ) spids: [378 387] ) } ) (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)}) ) spids: [393 402] ) (C {(usage)}) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:funcs spids:[408]) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [408] ) ] spids: [408] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_tail>) spids: [415 420] ) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tcmd spids:[426]) op: Equal rhs: {(DQ ('tail -') ($ VSub_DollarName '$tnum'))} spids: [426] ) ] spids: [426] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:ttext spids:[433]) op: Equal rhs: {(DQ (' Top ') ($ VSub_DollarName '$tnum') (' only.'))} spids: [433] ) ] spids: [433] ) ] spids: [16777215 423] ) ] spids: [16777215 440] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.ArithVarRef token:<Lit_ArithVarLike opt_duration>) spids: [444 449] ) 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') (..) ) } ) ] spids: [16777215 452] ) ] 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.') ) } ) ] spids: [469 484] ) (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>) ) ) spids: [486 496] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:interval spids:[500]) op: Equal rhs: {($ VSub_DollarName '$duration')} spids: [500] ) ] spids: [500] ) ] ) (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.'))} ) ] spids: [16777215 576] ) ] spids: [16777215 597] ) (command.CommandList children: [ (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:quit spids:[603]) op: Equal rhs: {(0)} spids: [603] ) ] spids: [603] ) terminator: <Op_Semi ';'> ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:secs spids:[607]) op: Equal rhs: {(0)} spids: [607] ) ] spids: [607] ) ] ) (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>) ) ) ) spids: [612 633] ) terminator: <Op_Semi ';'> ) ] body: (command.DoGroup children: [ (command.DParen child: (arith_expr.BinaryAssign op_id: Arith_PlusEqual left: (lhs_expr.LhsName name:secs spids:[641]) right: (arith_expr.ArithVarRef token:<Lit_ArithVarLike interval>) ) spids: [639 648] ) (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>) spids: [678 683] ) (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 ) ] spids: [636 740] ) ) (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'))}) ] )