예제 #1
0
    def __init__ (self, name, component=None, domain=None):
        '''
        Constructor.

        Params:
        - name is the channel name in string format
        - component is the component this supplier has been instantiated from
        (if applicable). This parameter is likely to become mandatory in future
        version of ACS
        - domain is the name of the domain of notification channels the channel
        belongs to

        Returns: Nothing

        Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
        '''
        self.logger = getLogger(str(name) + "-Consumer")

        #Call the super's constructor
        CommonNC.__init__(self, name, component, domain)
        
        #CORBA ref to the channels consumer admin
        self.consumerAdmin = None  
        #CORBA ref to this consumers structured proxy push supplier
        self.spps = None
        #Dictionary containing handler functions for different object types
        self.handlers = {}
        #dictionary mapping events to the total amount of time they have
        #to finish
        self.handlerTimeoutDict = getEventHandlerTimeoutDict(name)
        #profiler to time how long it takes events to be processed
        self.profiler = Profiler()
        #Is the consumer suspended?
        self.suspended = False
        #Lock used to read & write suspended attribute
        self.lockAction = threading.Lock()
       
        #Handle all of the CORBA stuff now
        CommonNC.initCORBA(self)
        self.initCORBA()
        self.__buffer_max_size = 100
        self.__buffer = Queue.Queue(self.__buffer_max_size);
        self.__stop_thread = False
        self.__thread = Thread(target=self.__process_event)
        self.__thread.setDaemon(True)
        self.__thread.start()
예제 #2
0
    def method(self):
        '''
        void method();
        '''
        profiler = Profiler()

        tString = ""
        for i in range(0, self.size):
            tString = tString + "*"

        joe = perftest.charSeqStruct(tString)

        for i in range(0, self.count):
            profiler.start()
            self.supplier.publishEvent(joe)
            profiler.stop()
            self.waitAwhile()

        profiler.fullDescription(
            "Event Channel Event of Size '" + str(self.size) +
            "' Bytes from within a CharacteristicComponent")
        return
예제 #3
0
    def method(self):
        '''
        void method();
        '''
        profiler = Profiler()
        
        tString=""
        for i in range(0, self.size):
            tString = tString + "*"

        joe = perftest.charSeqStruct(tString)

        for i in range(0, self.count):
            profiler.start()
            self.supplier.publishEvent(joe)
            profiler.stop()
            self.waitAwhile()

        profiler.fullDescription("Event Channel Event of Size '" + str(self.size) + "' Bytes from within a CharacteristicComponent")
        return
예제 #4
0
and sample usage could be:
  componentGenericTest FRIDGE1 7 dummieMethod()
  
'''
from sys import argv
from Acspy.Clients.SimpleClient import PySimpleClient
from Acspy.Util.Profiler import Profiler

compName = argv[1]
invocations = int(argv[2])
compMethod = argv[3]

msg = argv[4]

# Make an instance of the PySimpleClient
profiler = Profiler()
simpleClient = PySimpleClient()
comp = simpleClient.getComponent(compName)


for i in range(0, invocations):
  try:
    profiler.start()
    exec "comp." + compMethod
    profiler.stop()
  except Exception, e:
    profiler.stop()
    print "An exception occured:", e

profiler.fullDescription(msg)
예제 #5
0
    def method(self):
        '''
        void method();
        '''
        
        profiler = Profiler()
        
        tString=""
        for i in range(0, self.size):
            tString = tString + "*"

        for i in range(0, self.count):
            profiler.start()
            self.getLogger().logInfo(tString)
            profiler.stop()
            self.waitAwhile()

        if environ.has_key("ACS_LOG_STDOUT"):
            profiler.addData("ACS_LOG_STDOUT", environ["ACS_LOG_STDOUT"])
        else:
            profiler.addData("ACS_LOG_STDOUT", "None")
        profiler.fullDescription("ACS Log of Size '" + str(self.size) + "' Bytes from within a CharacteristicComponent")
        return 
예제 #6
0
    def method(self):
        '''
        void method();
        '''

        profiler = Profiler()

        tString = ""
        for i in range(0, self.size):
            tString = tString + "*"

        for i in range(0, self.count):
            profiler.start()
            self.getLogger().logInfo(tString)
            profiler.stop()
            self.waitAwhile()

        if environ.has_key("ACS_LOG_STDOUT"):
            profiler.addData("ACS_LOG_STDOUT", environ["ACS_LOG_STDOUT"])
        else:
            profiler.addData("ACS_LOG_STDOUT", "None")
        profiler.fullDescription(
            "ACS Log of Size '" + str(self.size) +
            "' Bytes from within a CharacteristicComponent")
        return
예제 #7
0
#------------------------------------------------------------------------------
'''
Sample usage:
   componentsMethodTestPy FRIDGE1 1000 100
'''
from sys import argv
from Acspy.Clients.SimpleClient import PySimpleClient
from Acspy.Util.Profiler import Profiler

compName = argv[1]
count = long(argv[2])
size = long(argv[3])
waitTime = long(argv[4])
msg = argv[5]

# Make an instance of the PySimpleClient
profiler = Profiler()
simpleClient = PySimpleClient()
comp = simpleClient.getComponent(compName)
comp.setup(count, size, waitTime)

for i in range(0, count):
    profiler.start()
    comp.testReturnSize()
    profiler.stop()

profiler.fullDescription(msg)

simpleClient.releaseComponent(compName)
simpleClient.disconnect()