Commit f65762d8 authored by Vincent Pelletier's avatar Vincent Pelletier

More profiling decorators.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2008 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 0d2d90f3
......@@ -1015,6 +1015,7 @@ class Application(object):
return history_list
@profiler_decorator
def importFrom(self, source, start, stop, tryToResolveConflict):
serials = {}
def updateLastSerial(oid, result):
......
......@@ -86,6 +86,7 @@ class HandlerSwitcher(object):
def getHandler(self):
return self._pending[0][1]
@profiler_decorator
def emit(self, request):
# register the request in the current handler
_pending = self._pending
......@@ -97,6 +98,7 @@ class HandlerSwitcher(object):
assert msg_id not in request_dict, "Packet id already expected"
request_dict[msg_id] = answer_class
@profiler_decorator
def handle(self, packet):
assert len(self._pending) == 1 or self._pending[0][0]
PACKET_LOGGER.dispatch(self._connection, packet, 'from')
......@@ -121,6 +123,7 @@ class HandlerSwitcher(object):
del self._pending[0]
logging.debug('Apply handler %r', self._pending[0][1])
@profiler_decorator
def setHandler(self, handler):
if len(self._pending) == 1 and not self._pending[0][0]:
# nothing is pending, change immediately
......@@ -601,6 +604,7 @@ class MTClientConnection(ClientConnection):
finally:
self.unlock()
@profiler_decorator
def ask(self, packet, timeout=CRITICAL_TIMEOUT):
self.lock()
try:
......
......@@ -18,6 +18,7 @@
from time import time
from neo.epoll import Epoll
from neo.profiling import profiler_decorator
class EpollEventManager(object):
"""This class manages connections and events based on epoll(5)."""
......@@ -173,6 +174,7 @@ class EpollEventManager(object):
self.reader_set.remove(fd)
self.epoll.modify(fd, 0, fd in self.writer_set)
@profiler_decorator
def addWriter(self, conn):
connector = conn.getConnector()
assert connector is not None, conn.whoSetConnector()
......
......@@ -209,6 +209,7 @@ def _decodeString(buf, name, offset=0):
raise PacketMalformedError("can't read string <%s>" % name)
return (string, buf[offset+4+size:])
@profiler_decorator
def _encodeString(buf):
return pack('!L', len(buf)) + buf
......@@ -272,6 +273,7 @@ class Packet(object):
return (pack(PACKET_HEADER_FORMAT, self._id, self._code, length),
content)
@profiler_decorator
def __len__(self):
return PACKET_HEADER_SIZE + len(self._body)
......@@ -881,6 +883,7 @@ class AskStoreObject(Packet):
"""
_header_format = '!8s8s8sBL'
@profiler_decorator
def _encode(self, oid, serial, compression, checksum, data, tid):
if serial is None:
serial = INVALID_TID
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment