File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ def get_all_processes_stats_json(load):
8686 'diskio' : psutil .disk_io_counters (perdisk = True , nowrap = True ),
8787 'netio' : psutil .net_io_counters (pernic = True , nowrap = True ),
8888 }
89+ < << << << HEAD
8990 processes = psutil .process_iter ()
9091 for process in processes :
9192 name = ""
@@ -98,4 +99,24 @@ def get_all_processes_stats_json(load):
9899 pass
99100 except Exception as ex :
100101 print (f"while inspecting { name } : { ex } " )
102+ == == == =
103+ for n in [True , False ]:
104+ processes = psutil .process_iter ()
105+ for process in processes :
106+ name = ""
107+ try :
108+ name = process .name ()
109+ if process .pid not in [1 , 2 ] and process .ppid () != 2 :
110+ procstat = gather_process_thread_statistics (process )
111+ if n :
112+ process_full_list [f"p{ process .pid } " ] = procstat
113+ else :
114+ add_delta (process_full_list [f"p{ process .pid } " ], procstat )
115+ except psutil .AccessDenied :
116+ pass
117+ except Exception as ex :
118+ print (f"while inspecting { name } : { ex } " )
119+ if n :
120+ time .sleep (1 )
121+ > >> >> >> 9 bac7477 (write system information as well )
101122 return json .dumps (process_full_list )
You can’t perform that action at this time.
0 commit comments