(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tracing) op: Equal rhs: {(/sys/kernel/debug/tracing)} spids: [124] ) ] spids: [124] ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_duration) op:Equal rhs:{(0)} spids:[127])] spids: [127] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:duration) op:Equal rhs:{(EmptyPart)} spids:[131])] spids: [131] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_interval) op:Equal rhs:{(0)} spids:[134])] spids: [134] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:interval) op:Equal rhs:{(999999)} spids:[138])] spids: [138] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_timestamp) op:Equal rhs:{(0)} spids:[142])] spids: [142] ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_tail) op:Equal rhs:{(0)} spids:[145])] spids: [145] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:tcmd) op:Equal rhs:{(cat)} spids:[149])] spids: [149] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ttext) op:Equal rhs:{(EmptyPart)} spids:[153])] spids: [153] ) (C {(trap)} {(SQ <'quit=1'>)} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)}) (FuncDef name: usage body: (BraceGroup children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: { (DQ ('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') ) } do_expansion: True here_end: END was_filled: T spids: [184] ) (Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[187]) ] ) (ControlFlow token:<ControlFlow_Exit exit>) ] spids: [179] ) spids: [175 178] ) (FuncDef name: warn body: (BraceGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children:[(C {(eval)} {(DQ ($ VSub_At '$@'))})] negated:T) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ('WARNING: command failed ') (EscapedLiteralPart token: <Lit_EscapedChar '\\"'> ) ($ VSub_At '$@') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[246])] ) ] spids: [16777215 241] ) ] spids: [16777215 257] ) ] spids: [227] ) spids: [223 226] ) (FuncDef name: die body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_At '$@'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[271])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [266] ) spids: [262 265] ) (While cond: [(C {(getopts)} {(d) (Lit_Other ':') (hi) (Lit_Other ':') (t) (Lit_Other ':') (T)} {(opt)})] body: (DoGroup children: [ (Case to_match: {($ VSub_Name '$opt')} arms: [ (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: [316] ) ] spids: [316] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:duration) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [320] ) ] spids: [320] ) ] spids: [313 314 323 16777215] ) (case_arm pat_list: [{(i)}] action: [ (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_interval) op: Equal rhs: {(1)} spids: [329] ) ] spids: [329] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:interval) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [333] ) ] spids: [333] ) ] spids: [326 327 336 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: [342] ) ] spids: [342] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tnum) op: Equal rhs: {($ VSub_Name '$OPTARG')} spids: [346] ) ] spids: [346] ) ] spids: [339 340 349 16777215] ) (case_arm pat_list: [{(T)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_timestamp) op: Equal rhs: {(1)} spids: [355] ) ] spids: [355] ) ] spids: [352 353 358 16777215] ) (case_arm pat_list: [{(h)} {(Lit_Other '?')}] action: [(C {(usage)})] spids: [361 364 368 16777215] ) ] spids: [306 310 371] ) ] spids: [303 373] ) ) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithWord w:{($ VSub_Name '$OPTIND')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [377 386] ) } ) (AndOr ops: [Op_DAmp] children: [ (DParen child: (ArithBinary op_id: Arith_DEqual left: (ArithWord w:{($ VSub_Pound '$#')}) right: (ArithWord w:{(Lit_Digits 0)}) ) ) (C {(usage)}) ] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:funcs) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [407] ) ] spids: [407] ) (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: [425] ) ] spids: [425] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ttext) op: Equal rhs: {(DQ (' Top ') ($ VSub_Name '$tnum') (' only.'))} spids: [432] ) ] spids: [432] ) ] spids: [16777215 422] ) ] spids: [16777215 439] ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithVarRef name:opt_duration)) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} { (DQ ('Tracing ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$funcs') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' for ') ($ VSub_Name '$duration') (' seconds.') ($ VSub_Name '$ttext') (..) ) } ) ] spids: [16777215 451] ) ] else_action: [ (C {(echo)} { (DQ ('Tracing ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$funcs') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (.) ($ VSub_Name '$ttext') ('.. Ctrl-C to end.') ) } ) ] spids: [468 483] ) (AndOr ops: [Op_DAmp] children: [ (DParen child: (ArithBinary op_id: Arith_DAmp left: (ArithVarRef name:opt_duration) right: (ArithUnary op_id:Arith_Bang child:(ArithVarRef name:opt_interval)) ) ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:interval) op: Equal rhs: {($ VSub_Name '$duration')} spids: [499] ) ] spids: [499] ) ] ) (AndOr ops: [Op_DPipe] children: [ (C {(cd)} {($ VSub_Name '$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)}) (AndOr ops: [Op_DPipe] children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Name '$funcs'))}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(set_ftrace_filter)} spids: [540] ) ] ) (C {(die)} { (DQ ('ERROR: enabling ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$funcs') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('. Exiting.') ) } ) ] ) (C {(warn)} {(DQ ('echo nop > current_tracer'))}) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(echo)} {(1)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(function_profile_enabled)} spids: [570] ) ] ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(set_ftrace_filter)} spids: [580] ) ] ) (C {(die)} {(DQ ('ERROR: enabling function profiling.'))} {(DQ ('Have CONFIG_FUNCTION_PROFILER? Exiting.'))} ) ] spids: [16777215 575] ) ] spids: [16777215 596] ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:quit) op:Equal rhs:{(0)} spids:[602])] spids: [602] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:secs) op:Equal rhs:{(0)} spids:[606])] spids: [606] ) (While cond: [ (Sentence child: (DParen child: (ArithBinary op_id: Arith_DAmp left: (ArithUnary op_id:Arith_Bang child:(ArithVarRef name:quit)) right: (ArithBinary op_id: Arith_DPipe left: (ArithUnary op_id:Arith_Bang child:(ArithVarRef name:opt_duration)) right: (ArithBinary op_id: Arith_Less left: (ArithVarRef name:secs) right: (ArithVarRef name:duration) ) ) ) ) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (DParen child: (BinaryAssign op_id: Arith_PlusEqual left: (LhsName name:secs) right: (ArithVarRef name:interval) ) ) (SimpleCommand words: [{(echo)} {(0)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(function_profile_enabled)} spids: [654] ) ] ) (SimpleCommand words: [{(echo)} {(1)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(function_profile_enabled)} spids: [663] ) ] ) (C {(sleep)} {($ VSub_Name '$interval')}) (C {(echo)}) (AndOr ops: [Op_DAmp] children: [(DParen child:(ArithVarRef name:opt_timestamp)) (C {(date)})] ) (C {(printf)} {(DQ ('%-30s %8s') (Lit_Other '\\') (n))} {(DQ (FUNC))} {(DQ (COUNT))}) (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_Name '$tcmd')}) ] negated: F ) ] spids: [635 739] ) ) (SimpleCommand words: [{(echo)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[747])] ) (SimpleCommand words: [{(echo)} {(DQ ('Ending tracing...'))}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[756])] ) (C {(warn)} {(DQ ('echo 0 > function_profile_enabled'))}) (C {(warn)} {(DQ ('echo > set_ftrace_filter'))}) ] )