(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tracing) op: Equal rhs: {(/sys/kernel/debug/tracing)} spids: [166] ) ] spids: [166] ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:interval) op:Equal rhs:{(1)} spids:[169])] spids: [169] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_timestamp) op:Equal rhs:{(0)} spids:[173])] spids: [173] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:opt_debug) op:Equal rhs:{(0)} spids:[177])] spids: [177] ) (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: cachestat [-Dht] [interval]\n') (' -D # print debug counters\n') (' -h # this usage message\n') (' -t # include timestamp\n') (' interval # output interval in secs (default 1)\n') (' eg,\n') (' cachestat # show stats every second\n') (' cachestat 5 # show stats every 5 seconds\n') ('\n') ('See the man page and example file for more info.\n') ) } do_expansion: True here_end: END was_filled: T spids: [209] ) (Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[212]) ] ) (ControlFlow token:<ControlFlow_Exit exit>) ] spids: [204] ) spids: [200 203] ) (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:[255])] ) ] spids: [16777215 250] ) ] spids: [16777215 266] ) ] spids: [236] ) spids: [232 235] ) (FuncDef name: die body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_At '$@'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[280])] ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)}) ] spids: [275] ) spids: [271 274] ) (While cond: [(C {(getopts)} {(Dht)} {(opt)})] body: (DoGroup children: [ (Case to_match: {($ VSub_Name '$opt')} arms: [ (case_arm pat_list: [{(D)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_debug) op: Equal rhs: {(1)} spids: [319] ) ] spids: [319] ) ] spids: [316 317 322 16777215] ) (case_arm pat_list: [{(t)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:opt_timestamp) op: Equal rhs: {(1)} spids: [328] ) ] spids: [328] ) ] spids: [325 326 331 16777215] ) (case_arm pat_list: [{(h)} {(Lit_Other '?')}] action: [(C {(usage)})] spids: [334 337 341 16777215] ) ] spids: [309 313 344] ) ] spids: [306 346] ) ) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithWord w:{($ VSub_Name '$OPTIND')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [350 359] ) } ) (If arms: [ (if_arm cond: [ (Sentence child: (DParen child:(ArithWord w:{($ VSub_Pound '$#')})) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:interval) op: Equal rhs: {($ VSub_Number '$1')} spids: [378] ) ] spids: [378] ) ] spids: [16777215 375] ) ] spids: [16777215 381] ) (C {(echo)} {(DQ ('Counting cache functions... Output every ') ($ VSub_Name '$interval') (' seconds.'))} ) (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: [ {(printf)} { (DQ (mark_page_accessed) (Lit_Other '\\') (nmark_buffer_dirty) (Lit_Other '\\') (nadd_to_page_cache_lru) (Lit_Other '\\') (naccount_page_dirtied) (Lit_Other '\\') (n) ) } ] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(set_ftrace_filter)} spids: [437] ) ] ) (C {(die)} {(DQ ('ERROR: tracing these four kernel functions: mark_page_accessed,'))} { (DQ ( 'mark_buffer_dirty, add_to_page_cache_lru and account_page_dirtied (unknown kernel version?). 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: [470] ) ] ) ] negated: T ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(set_ftrace_filter)} spids: [480] ) ] ) (C {(die)} {(DQ ('ERROR: enabling function profiling. Have CONFIG_FUNCTION_PROFILER? Exiting.'))} ) ] spids: [16777215 475] ) ] spids: [16777215 491] ) (AndOr ops: [Op_DAmp] children: [ (DParen child:(ArithVarRef name:opt_timestamp)) (C {(printf)} {(DQ ('%-8s '))} {(TIME)}) ] ) (C {(printf)} {(DQ ('%8s %8s %8s %8s %12s %10s'))} {(HITS)} {(MISSES)} {(DIRTIES)} {(RATIO)} {(DQ (BUFFERS_MB))} {(DQ (CACHE_MB))} ) (AndOr ops: [Op_DAmp] children: [(DParen child:(ArithVarRef name:opt_debug)) (C {(printf)} {(DQ (' DEBUG'))})] ) (C {(echo)}) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:quit) op:Equal rhs:{(0)} spids:[554])] spids: [554] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:secs) op:Equal rhs:{(0)} spids:[558])] spids: [558] ) (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: [606] ) ] ) (SimpleCommand words: [{(echo)} {(1)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(function_profile_enabled)} spids: [615] ) ] ) (C {(sleep)} {($ VSub_Name '$interval')}) (AndOr ops: [Op_DAmp] children: [ (DParen child:(ArithVarRef name:opt_timestamp)) (C {(printf)} {(DQ ('%(%H:%M:%S)T '))} {(-1)}) ] ) (Pipeline children: [ (C {(cat)} {(/proc/meminfo)} {(trace_stat/function) (Lit_Other '*')}) (C {(awk)} {(-v)} {(Lit_VarLike 'debug=') ($ VSub_Name '$opt_debug')} { (SQ <'\n'> <'\t# match meminfo stats:\n'> <'\t$1 == "Buffers:" && $3 == "kB" { buffers_mb = $2 / 1024 }\n'> <'\t$1 == "Cached:" && $3 == "kB" { cached_mb = $2 / 1024 }\n'> <'\t# identify and save trace counts:\n'> <'\t$2 ~ /[0-9]/ && $3 != "kB" { a[$1] += $2 }\n'> <'\tEND {\n'> <'\t\tmpa = a["mark_page_accessed"]\n'> <'\t\tmbd = a["mark_buffer_dirty"]\n'> <'\t\tapcl = a["add_to_page_cache_lru"]\n'> <'\t\tapd = a["account_page_dirtied"]\n'> <'\n'> <'\t\ttotal = mpa - mbd\n'> <'\t\tmisses = apcl - apd\n'> <'\t\tif (misses < 0)\n'> <'\t\t\tmisses = 0\n'> <'\t\thits = total - misses\n'> <'\n'> <'\t\tratio = 100 * hits / total\n'> <'\t\tprintf "%8d %8d %8d %7.1f%% %12.0f %10.0f", hits, misses, mbd,\n'> <'\t\t ratio, buffers_mb, cached_mb\n'> <'\t\tif (debug)\n'> <'\t\t\tprintf " (%d %d %d %d)", mpa, mbd, apcl, apd\n'> <'\t\tprintf "\\n"\n'> <'\t}'> ) } ) ] negated: F ) ] spids: [587 693] ) ) (SimpleCommand words: [{(echo)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[701])] ) (SimpleCommand words: [{(echo)} {(DQ ('Ending tracing...'))}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[710])] ) (C {(warn)} {(DQ ('echo 0 > function_profile_enabled'))}) (C {(warn)} {(DQ ('echo > set_ftrace_filter'))}) ] )