#NEWLINE# def get_process( self , pid ) : #NEWLINE# #INDENT# p = psutil . Process ( pid ) #NEWLINE# mem = p . memory_info_ex ( ) #NEWLINE# cpu_times = p . cpu_times ( ) #NEWLINE# try : #NEWLINE# #INDENT# username = p . username ( ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# username = None #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'pid' : p . pid , #NEWLINE# 'ppid' : p . ppid ( ) , #NEWLINE# 'parent_name' : ( p . parent ( ) . name ( ) if p . parent ( ) else '' ) , #NEWLINE# 'name' : p . name ( ) , #NEWLINE# 'cmdline' : ' ' . join ( p . cmdline ( ) ) , #NEWLINE# 'user' : username , #NEWLINE# 'uid_real' : p . uids ( ) . real , #NEWLINE# 'uid_effective' : p . uids ( ) . effective , #NEWLINE# 'uid_saved' : p . uids ( ) . saved , #NEWLINE# 'gid_real' : p . gids ( ) . real , #NEWLINE# 'gid_effective' : p . gids ( ) . effective , #NEWLINE# 'gid_saved' : p . gids ( ) . saved , #NEWLINE# 'status' : p . status ( ) , #NEWLINE# 'created' : p . create_time ( ) , #NEWLINE# 'terminal' : p . terminal ( ) , #NEWLINE# 'mem_rss' : mem . rss , #NEWLINE# 'mem_vms' : mem . vms , #NEWLINE# 'mem_shared' : mem . shared , #NEWLINE# 'mem_text' : mem . text , #NEWLINE# 'mem_lib' : mem . lib , #NEWLINE# 'mem_data' : mem . data , #NEWLINE# 'mem_dirty' : mem . dirty , #NEWLINE# 'mem_percent' : p . memory_percent ( ) , #NEWLINE# 'cwd' : p . cwd ( ) , #NEWLINE# 'nice' : p . nice ( ) , #NEWLINE# 'io_nice_class' : p . ionice ( ) [ 0 ] , #NEWLINE# 'io_nice_value' : p . ionice ( ) [ 1 ] , #NEWLINE# 'cpu_percent' : p . cpu_percent ( 0 ) , #NEWLINE# 'num_threads' : p . num_threads ( ) , #NEWLINE# 'num_files' : len ( p . open_files ( ) ) , #NEWLINE# 'num_children' : len ( p . children ( ) ) , #NEWLINE# 'num_ctx_switches_invol' : p . num_ctx_switches ( ) . involuntary , #NEWLINE# 'num_ctx_switches_vol' : p . num_ctx_switches ( ) . voluntary , #NEWLINE# 'cpu_times_user' : cpu_times . user , #NEWLINE# 'cpu_times_system' : cpu_times . system , #NEWLINE# 'cpu_affinity' : p . cpu_affinity ( ) , #NEWLINE# #UNINDENT# }