<s> from __future__ import print_function <EOL> from bcc import BPF <EOL> from time import sleep , strftime <EOL> import argparse <EOL> examples = """<STR_LIT>""" <EOL> parser = argparse . ArgumentParser ( <EOL> description = "<STR_LIT>" , <EOL> formatter_class = argparse . RawDescriptionHelpFormatter , <EOL> epilog = examples ) <EOL> parser . add_argument ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_argument ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_argument ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_argument ( "<STR_LIT>" , "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_argument ( "<STR_LIT>" , nargs = "<STR_LIT:?>" , default = <NUM_LIT> , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_argument ( "<STR_LIT:count>" , nargs = "<STR_LIT:?>" , default = <NUM_LIT> , <EOL> help = "<STR_LIT>" ) <EOL> args = parser . parse_args ( ) <EOL> countdown = int ( args . count ) <EOL> debug = <NUM_LIT:0> <EOL> bpf_text = """<STR_LIT>""" <EOL> if args . pid : <EOL> bpf_text = bpf_text . replace ( '<STR_LIT>' , '<STR_LIT>' % args . pid ) <EOL> else : <EOL> bpf_text = bpf_text . replace ( '<STR_LIT>' , '<STR_LIT:0>' ) <EOL> if args . milliseconds : <EOL> bpf_text = bpf_text . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> label = "<STR_LIT>" <EOL> else : <EOL> bpf_text = bpf_text . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> label = "<STR_LIT>" <EOL> if args . pids : <EOL> bpf_text = bpf_text . replace ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> bpf_text = bpf_text . replace ( '<STR_LIT>' , <EOL> '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> else : <EOL> bpf_text = bpf_text . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> bpf_text = bpf_text . replace ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> if debug : <EOL> print ( bpf_text ) <EOL> b = BPF ( text = bpf_text ) <EOL> b . attach_kprobe ( event_re = "<STR_LIT>" , fn_name = "<STR_LIT>" ) <EOL> b . attach_kprobe ( event = "<STR_LIT>" , fn_name = "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" ) <EOL> exiting = <NUM_LIT:0> if args . interval else <NUM_LIT:1> <EOL> dist = b . get_table ( "<STR_LIT>" ) <EOL> while ( <NUM_LIT:1> ) : <EOL> try : <EOL> sleep ( int ( args . interval ) ) <EOL> except KeyboardInterrupt : <EOL> exiting = <NUM_LIT:1> <EOL> print ( ) <EOL> if args . timestamp : <EOL> print ( "<STR_LIT>" % strftime ( "<STR_LIT>" ) , end = "<STR_LIT>" ) <EOL> dist . print_log2_hist ( label , "<STR_LIT>" , section_print_fn = int ) <EOL> dist . clear ( ) <EOL> countdown -= <NUM_LIT:1> <EOL> if exiting or countdown == <NUM_LIT:0> : <EOL> exit ( ) </s>
