Perf tests: linux version of adb search
This commit is contained in:
parent
db4b72c1ba
commit
49d33f6109
@ -126,16 +126,27 @@ def getRunningProcessExePathByName_win32(name) :
|
|||||||
CloseHandle( hProcessSnap )
|
CloseHandle( hProcessSnap )
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
def getRunningProcessExePathByName_posix(name):
|
||||||
|
pids= [pid for pid in os.listdir('/proc') if pid.isdigit()]
|
||||||
|
for pid in pids:
|
||||||
|
try:
|
||||||
|
path = os.readlink(os.path.join('/proc', pid, 'exe'))
|
||||||
|
if path and path.endswith(name):
|
||||||
|
return path
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def getRunningProcessExePathByName(name):
|
def getRunningProcessExePathByName(name):
|
||||||
try:
|
try:
|
||||||
if hostos == "nt":
|
if hostos == "nt":
|
||||||
return getRunningProcessExePathByName_win32(name)
|
return getRunningProcessExePathByName_win32(name)
|
||||||
|
elif hostos == "posix":
|
||||||
|
return getRunningProcessExePathByName_posix(name)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class RunInfo(object):
|
class RunInfo(object):
|
||||||
def __init__(self, path, configuration = None):
|
def __init__(self, path, configuration = None):
|
||||||
self.path = path
|
self.path = path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user