(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tracing) op: assign_op.Equal rhs: {(/sys/kernel/debug/tracing)} spids: [124] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_duration) op: assign_op.Equal rhs: {(0)} spids: [127] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:129) ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:duration) op: assign_op.Equal rhs: (word.Empty) spids: [131] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:132) ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_interval) op: assign_op.Equal rhs: {(0)} spids: [134] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:136) ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:interval) op: assign_op.Equal rhs: {(999999)} spids: [138] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:140) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_timestamp) op: assign_op.Equal rhs: {(0)} spids: [142] ) ] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_tail) op: assign_op.Equal rhs: {(0)} spids: [145] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:147) ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tcmd) op: assign_op.Equal rhs: {(cat)} spids: [149] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:151) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ttext) op: assign_op.Equal rhs: (word.Empty) spids: [153] ) ] ) ] ) (C {(trap)} {(SQ (Token id:Id.Lit_Chars val:'quit=1' span_id:158))} {(INT)} {(QUIT)} {(TERM)} {(PIPE)} {(HUP)} ) (command.ShFunction name: usage body: (command.BraceGroup children: [ (command.Simple words: [{(cat)}] redirects: [ (redir.HereDoc op: (Token id:Id.Redir_DLessDash val:'<<-' span_id:184) fd: -1 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 ") (Id.Right_DoubleQuote '"') ('vfs*') (Id.Right_DoubleQuote '"') ('\n') (" funccount -d 5 'tcp*' # trace ") (Id.Right_DoubleQuote '"') ('tcp*') (Id.Right_DoubleQuote '"') (' funcs for 5 seconds\n') (" funccount -t 10 'ext3*' # show top 10 ") (Id.Right_DoubleQuote '"') ('ext3*') (Id.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: (Token id:Id.Redir_GreatAnd val:'>&' span_id:187) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:219) ) ] ) ) (command.ShFunction name: warn body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [(C {(eval)} {(DQ ($ Id.VSub_At '$@'))})] negated: T ) terminator: (Token id:Id.Op_Semi val:';' span_id:240) ) ] action: [ (command.Simple words: [ {(echo)} { (DQ ('WARNING: command failed ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:252) ) ($ Id.VSub_At '$@') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:254) ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:247) fd: -1 arg_word: {(2)} ) ] ) ] spids: [231 242] ) ] ) ] ) ) (command.ShFunction name: die body: (command.BraceGroup children: [ (command.Simple words: [{(echo)} {(DQ ($ Id.VSub_At '$@'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:272) fd: -1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:280) arg_word: {(1)} ) ] ) ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:290) cond: [ (C {(getopts)} {(d) (Id.Lit_Other ':') (hi) (Id.Lit_Other ':') (t) (Id.Lit_Other ':') (T)} {(opt)} ) ] body: (command.DoGroup children: [ (command.Case to_match: {($ Id.VSub_DollarName '$opt')} arms: [ (case_arm pat_list: [{(d)}] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_duration) op: assign_op.Equal rhs: {(1)} spids: [317] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:319) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:duration) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$OPTARG')} spids: [321] ) ] ) ] spids: [314 315 324 -1] ) (case_arm pat_list: [{(i)}] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_interval) op: assign_op.Equal rhs: {(1)} spids: [330] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:332) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:interval) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$OPTARG')} spids: [334] ) ] ) ] spids: [327 328 337 -1] ) (case_arm pat_list: [{(t)}] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_tail) op: assign_op.Equal rhs: {(1)} spids: [343] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:345) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tnum) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$OPTARG')} spids: [347] ) ] ) ] spids: [340 341 350 -1] ) (case_arm pat_list: [{(T)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:opt_timestamp) op: assign_op.Equal rhs: {(1)} spids: [356] ) ] ) ] spids: [353 354 359 -1] ) (case_arm pat_list: [{(h)} {(Id.Lit_QMark '?')}] action: [(C {(usage)})] spids: [362 365 369 -1] ) ] ) ] ) ) (C {(shift)} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$OPTIND')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DEqual left: (arith_expr.ArithWord w:{($ Id.VSub_Pound '$#')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 0)}) ) ) (C {(usage)}) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:funcs) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [408] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:opt_tail span_id:417) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:421) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tcmd) op: assign_op.Equal rhs: {(DQ ('tail -') ($ Id.VSub_DollarName '$tnum'))} spids: [426] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ttext) op: assign_op.Equal rhs: {(DQ (' Top ') ($ Id.VSub_DollarName '$tnum') (' only.'))} spids: [433] ) ] ) ] spids: [413 423] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.DParen child: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:opt_duration span_id:446) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:450) ) ] action: [ (C {(echo)} { (DQ ('Tracing ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:459) ) ($ Id.VSub_DollarName '$funcs') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:461) ) (' for ') ($ Id.VSub_DollarName '$duration') (' seconds.') ($ Id.VSub_DollarName '$ttext') (..) ) } ) ] spids: [442 452] ) ] else_action: [ (C {(echo)} { (DQ ('Tracing ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:476) ) ($ Id.VSub_DollarName '$funcs') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:478) ) (.) ($ Id.VSub_DollarName '$ttext') ('.. Ctrl-C to end.') ) } ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DAmp left: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:opt_duration span_id:488) ) right: (arith_expr.Unary op_id: Id.Arith_Bang child: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:opt_interval span_id:493) ) ) ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:interval) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$duration')} spids: [500] ) ] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(cd)} {($ Id.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) (Id.Lit_Equals '=') (1)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{(echo)} {(DQ ($ Id.VSub_DollarName '$funcs'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:541) fd: -1 arg_word: {(set_ftrace_filter)} ) ] ) (C {(die)} { (DQ ('ERROR: enabling ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:551) ) ($ Id.VSub_DollarName '$funcs') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:553) ) ('. Exiting.') ) } ) ] ) (C {(warn)} {(DQ ('echo nop > current_tracer'))}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [{(echo)} {(1)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:571) fd: -1 arg_word: {(function_profile_enabled)} ) ] ) ] negated: T ) terminator: (Token id:Id.Op_Semi val:';' span_id:574) ) ] action: [ (command.Simple words: [{(echo)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:581) fd: -1 arg_word: {(set_ftrace_filter)} ) ] ) (C {(die)} {(DQ ('ERROR: enabling function profiling.'))} {(DQ ('Have CONFIG_FUNCTION_PROFILER? Exiting.'))} ) ] spids: [563 576] ) ] ) (command.CommandList children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:quit) op: assign_op.Equal rhs: {(0)} spids: [603] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:605) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:secs) op: assign_op.Equal rhs: {(0)} spids: [607] ) ] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:610) cond: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_DAmp left: (arith_expr.Unary op_id: Id.Arith_Bang child: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:quit span_id:615) ) ) right: (arith_expr.Binary op_id: Id.Arith_DPipe left: (arith_expr.Unary op_id: Id.Arith_Bang child: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:opt_duration span_id:621) ) ) right: (arith_expr.Binary op_id: Id.Arith_Less left: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:secs span_id:625) ) right: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:duration span_id:629) ) ) ) ) ) terminator: (Token id:Id.Op_Semi val:';' span_id:634) ) ] body: (command.DoGroup children: [ (command.DParen child: (arith_expr.BinaryAssign op_id: Id.Arith_PlusEqual left: (sh_lhs_expr.Name name:secs) right: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:interval span_id:645) ) ) ) (command.Simple words: [{(echo)} {(0)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:655) fd: -1 arg_word: {(function_profile_enabled)} ) ] ) (command.Simple words: [{(echo)} {(1)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:664) fd: -1 arg_word: {(function_profile_enabled)} ) ] ) (C {(sleep)} {($ Id.VSub_DollarName '$interval')}) (C {(echo)}) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.DParen child: (arith_expr.VarRef token: (Token id:Id.Lit_ArithVarLike val:opt_timestamp span_id:680) ) ) (C {(date)}) ] ) (C {(printf)} {(DQ ('%-30s %8s') (Id.Lit_Other '\\') (n))} {(DQ (FUNC))} {(DQ (COUNT))}) (command.Pipeline children: [ (C {(cat)} {(trace_stat/function) (Id.Lit_Star '*')}) (C {(awk)} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:718) (Token id: Id.Lit_Chars val: '\t# skip headers by matching on the numeric hit column\n' span_id: 719 ) (Token id:Id.Lit_Chars val:'\t$2 ~ /[0-9]/ { a[$1] += $2 }\n' span_id:720) (Token id:Id.Lit_Chars val:'\tEND {\n' span_id:721) (Token id:Id.Lit_Chars val:'\t\tfor (k in a) {\n' span_id:722) (Token id: Id.Lit_Chars val: '\t\t\tprintf "%-30s %8d\\n", k, a[k]\n' span_id: 723 ) (Token id:Id.Lit_Chars val:'\t\t}\n' span_id:724) (Token id:Id.Lit_Chars val:'\t}' span_id:725) ) } ) (C {(sort)} {(-n)} {(-k2)}) (C {($ Id.VSub_DollarName '$tcmd')}) ] negated: F ) ] ) ) (command.Simple words: [{(echo)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:748) fd: 2 arg_word: {(/dev/null)} ) ] ) (command.Simple words: [{(echo)} {(DQ ('Ending tracing...'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'2>' span_id:757) fd: 2 arg_word: {(/dev/null)} ) ] ) (C {(warn)} {(DQ ('echo 0 > function_profile_enabled'))}) (C {(warn)} {(DQ ('echo > set_ftrace_filter'))}) ] )