[REF] netsvc: always use psutil: it is needed in service.workers (and listed in setup.py).
bzr revid: vmt@openerp.com-20130328110605-2kw367x1om7wzhvm
This commit is contained in:
parent
443486ce68
commit
fc4d9c8633
|
@ -30,11 +30,7 @@ import threading
|
|||
import time
|
||||
import types
|
||||
from pprint import pformat
|
||||
|
||||
try:
|
||||
import psutil
|
||||
except ImportError:
|
||||
psutil = None
|
||||
import psutil
|
||||
|
||||
import tools
|
||||
import openerp
|
||||
|
@ -222,8 +218,7 @@ def dispatch_rpc(service_name, method, params):
|
|||
if rpc_request_flag or rpc_response_flag:
|
||||
start_time = time.time()
|
||||
start_rss, start_vms = 0, 0
|
||||
if psutil:
|
||||
start_rss, start_vms = psutil.Process(os.getpid()).get_memory_info()
|
||||
start_rss, start_vms = psutil.Process(os.getpid()).get_memory_info()
|
||||
if rpc_request and rpc_response_flag:
|
||||
log(rpc_request,logging.DEBUG,'%s.%s'%(service_name,method), replace_request_password(params))
|
||||
|
||||
|
@ -244,8 +239,7 @@ def dispatch_rpc(service_name, method, params):
|
|||
if rpc_request_flag or rpc_response_flag:
|
||||
end_time = time.time()
|
||||
end_rss, end_vms = 0, 0
|
||||
if psutil:
|
||||
end_rss, end_vms = psutil.Process(os.getpid()).get_memory_info()
|
||||
end_rss, end_vms = psutil.Process(os.getpid()).get_memory_info()
|
||||
logline = '%s.%s time:%.3fs mem: %sk -> %sk (diff: %sk)' % (service_name, method, end_time - start_time, start_vms / 1024, end_vms / 1024, (end_vms - start_vms)/1024)
|
||||
if rpc_response_flag:
|
||||
log(rpc_response,logging.DEBUG, logline, result)
|
||||
|
|
Loading…
Reference in New Issue