[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 time
|
||||||
import types
|
import types
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
import psutil
|
||||||
try:
|
|
||||||
import psutil
|
|
||||||
except ImportError:
|
|
||||||
psutil = None
|
|
||||||
|
|
||||||
import tools
|
import tools
|
||||||
import openerp
|
import openerp
|
||||||
|
@ -222,7 +218,6 @@ def dispatch_rpc(service_name, method, params):
|
||||||
if rpc_request_flag or rpc_response_flag:
|
if rpc_request_flag or rpc_response_flag:
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
start_rss, start_vms = 0, 0
|
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:
|
if rpc_request and rpc_response_flag:
|
||||||
log(rpc_request,logging.DEBUG,'%s.%s'%(service_name,method), replace_request_password(params))
|
log(rpc_request,logging.DEBUG,'%s.%s'%(service_name,method), replace_request_password(params))
|
||||||
|
@ -244,7 +239,6 @@ def dispatch_rpc(service_name, method, params):
|
||||||
if rpc_request_flag or rpc_response_flag:
|
if rpc_request_flag or rpc_response_flag:
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
end_rss, end_vms = 0, 0
|
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)
|
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:
|
if rpc_response_flag:
|
||||||
|
|
Loading…
Reference in New Issue