X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=python%2Fovs%2Fpoller.py;h=e459c5823e9cd5ec7f79cffa3351fc1a0c4a222b;hb=e878338bf1409f0dd6d23cb57822a2c4c1a69e0f;hp=2a0b2ecbb3be29653e9571222fdb7ff46df044fa;hpb=110b54816bb56b8ba4878812ad300a3a277abb06;p=openvswitch diff --git a/python/ovs/poller.py b/python/ovs/poller.py index 2a0b2ecb..e459c582 100644 --- a/python/ovs/poller.py +++ b/python/ovs/poller.py @@ -1,4 +1,4 @@ -# Copyright (c) 2010 Nicira Networks +# Copyright (c) 2010 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,9 +13,12 @@ # limitations under the License. import errno -import logging import select import ovs.timeval +import ovs.vlog + +vlog = ovs.vlog.Vlog("poller") + class Poller(object): """High-level wrapper around the "poll" system call. @@ -36,7 +39,7 @@ class Poller(object): be select.POLLIN or select.POLLOUT or their bitwise-OR). The following call to self.block() will wake up when 'fd' becomes ready for one or more of the requested events. - + The event registration is one-shot: only the following call to self.block() is affected. The event will need to be re-registered after self.block() is called if it is to persist. @@ -63,10 +66,10 @@ class Poller(object): self.__timer_wait(msec) def timer_wait_until(self, msec): - """Causes the following call to self.block() to wake up when the current - time, as returned by ovs.timeval.msec(), reaches 'msec' or later. If - 'msec' is earlier than the current time, the following call to - self.block() will not block at all. + """Causes the following call to self.block() to wake up when the + current time, as returned by ovs.timeval.msec(), reaches 'msec' or + later. If 'msec' is earlier than the current time, the following call + to self.block() will not block at all. The timer registration is one-shot: only the following call to self.block() is affected. The timer will need to be re-registered @@ -95,13 +98,13 @@ class Poller(object): # XXX rate-limit error, msg = e if error != errno.EINTR: - logging.error("poll: %s" % e[1]) + vlog.err("poll: %s" % e[1]) finally: self.__reset() def __log_wakeup(self, events): if not events: - logging.debug("%d-ms timeout" % self.timeout) + vlog.dbg("%d-ms timeout" % self.timeout) else: for fd, revents in events: if revents != 0: @@ -116,9 +119,8 @@ class Poller(object): s += "[POLLHUP]" if revents & select.POLLNVAL: s += "[POLLNVAL]" - logging.debug("%s on fd %d" % (s, fd)) + vlog.dbg("%s on fd %d" % (s, fd)) def __reset(self): self.poll = select.poll() - self.timeout = -1 - + self.timeout = -1