wiki:GEC16Agenda/WiMAX-Tutorial/Coop/02

Version 4 (modified by Fraida Fund, 6 years ago) (diff)

--

Previous

Instrumenting Coopshim with OML

The coopshim application is written in Python. After verifying that it works, we used the instructions oml4py library homepage to instrument the script. We set up three measurement points (database tables) in the script:

  • req - used to store information about requests between nodes
  • recv - used to store information about recovered packets between nodes
  • sent - used to store information about recovery packets sent from nodes
from oml4py import OMLBase

class CoopShim(BaseShim):

  coop = {}

  coop['oml'] = OMLBase("coopshim","coopshim2","n3","tcp:omfserver-witest.poly.edu:3003")
  coop['oml'].addmp("req", "id:long total:long")
  coop['oml'].addmp("recv", "id:long total:long source:string")
  coop['oml'].addmp("sent", "id:long total:long dest:string")
  coop['oml'].start()


  ...

  self.coop['oml'].inject("req", [pkt_id, self.coop['n_req']])

  ...

  self.coop['oml'].inject("recv", [pkt_id, self.coop['n_recv'], str(srcip)])

  ... 

  self.coop['oml'].inject("sent", [str(pkt_id), self.coop['n_sent'], str(srcip)])


Note: In addition to the oml4py module for Python, there is also the oml4r gem for instrumenting Python applications, and a C library for C/C++ applications. There is also a text protocol which can be used with any language.


Next