[pox-dev] destructor of MyController class is not being called.
Karthik Sharma
karthik.sharma at gmail.com
Sun May 12 15:46:39 PDT 2013
I have a class called MyController where I use the destructor to print some
statistics.
class MyController (object):
def __init__ (self, connection):
self.connection = connection
connection.addListeners(self)
# Use this table to keep track of which ethernet address is on
# which switch port (keys are MACs, values are ports).
self.mac_to_port = {}
# This will keep track of the traffic matrix.
# matrix[i][j]=number of times a packet from i went to j
self.matrix={}
self.total_ins_time = 0
self.total_query_time = 0
self.total_ins_count = 0
self.total_query_count = 0
def __del__(self):
print "avg insert time ",(self.total_ins_time/self.total_ins_count);
print "avg query
time",(self.total_query_time/self.total_query_count);
I have a function
def act_like_switch (self, packet, packet_in):
which implements the logic.It is called from
def _handle_PacketIn (self, event):
Is the destructor of the MyController class a good place to print the
statistics that I collect during the running of the controller? If not
where should I do it? and also why is the destructor of MyController class
not being called.As you would have guessed,I am new to Python.
Regards,
Karthik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20130513/7ab18afa/attachment.htm>
More information about the pox-dev
mailing list