MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / get_proc_rss

Method get_proc_rss

class/projectModel/pythonModel.py:3372–3385  ·  view source on GitHub ↗
(pid)

Source from the content-addressed store, hash-verified

3370
3371 @staticmethod
3372 def get_proc_rss(pid):
3373 status_path = '/proc/' + str(pid) + '/status'
3374 if not os.path.exists(status_path):
3375 return 0
3376 status_file = public.readFile(status_path)
3377 if not status_file:
3378 return 0
3379 rss = 0
3380 try:
3381 rss = int(re.search(r'VmRSS:\s*(\d+)\s*kB', status_file).groups()[0])
3382 except:
3383 pass
3384 rss = int(rss) * 1024
3385 return rss
3386
3387 def get_process_info_by_pid(self, pid):
3388 process_info = {}

Callers 1

Calls 3

readFileMethod · 0.80
existsMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected