Example #1
0
def main():

    csw.call_start(1)  # Start code snippet
    add(1, 100000)
    csw.call_stop(1)   # Stop code snippet

    # Print the results
    csw.resultc()
Example #2
0
def main():

    csw.call_start(2)  # Start code snippet (loop)
    for inxAdd in range(100):
        csw.call_start(1)  # Start code snippet (add)
        add(1, 100000)
        csw.call_stop(1)  # Stop code snippet (add)
    csw.call_stop(2)  # Stop code snippet (loop)

    # Print the results
    csw.resultc()
Example #3
0
def main():

    csw.call_start(csw.reg_code("100 x add"))  # Start code snippet (loop)
    for inxAdd in range(100):
        csw.call_start(csw.reg_code("add"))  # Start code snippet (add)
        add(1, 100000)
        csw.call_stop(csw.reg_code("add"))  # Stop code snippet (add)
    csw.call_stop(csw.reg_code("100 x add"))  # Stop code snippet (loop)

    # Print the results
    csw.resultc()
Example #4
0
def main():

    # Register the code snippets
    iRego1 = csw.reg_code("add(1, 100000)")
    iRego2 = csw.reg_code("100 x add(1, 100000)")
    iRego3 = csw.reg_code("add(1, 10000)")
    iRego4 = csw.reg_code("100 x add(1, 10000)")

    # Start the main CoSniWa time
    csw.start()

    csw.call_start(iRego2)  # Start loop 100 x add(1, 100000)
    for inxAdd in range(100):
        csw.call_start(iRego1)  # Start code snippet (add(1, 100000))
        add(1, 100000)
        csw.call_stop(iRego1)  # Stop code snippet (add(1, 100000))
    csw.call_stop(iRego2)  # Stop loop 100 x add(1, 100000)

    csw.call_start(iRego4)  # Start loop 100 x add(1, 10000)
    for inxAdd in range(100):
        csw.call_start(iRego3)  # Start code snippet (add(1, 10000))
        add(1, 10000)
        csw.call_stop(iRego3)  # Stop code snippet (add(1, 10000))
    csw.call_stop(iRego4)  # Stop loop 100 x add(1, 10000)

    # Stop the main CoSniWa time
    csw.stop()

    # Print the results
    csw.resultc()
Example #5
0
def main():

    # Register the code snippets
    iRego1 = csw.reg_code("add")
    iRego2 = csw.reg_code("100 x add")

    csw.call_start(iRego2)  # Start code snippet (loop)
    for inxAdd in range(100):
        csw.call_start(iRego1)  # Start code snippet (add)
        add(1, 100000)
        csw.call_stop(iRego1)  # Stop code snippet (add)
    csw.call_stop(iRego2)  # Stop code snippet (loop)

    # Print the results
    csw.resultc()
Example #6
0
def test_usleep(tSleep, iRego):
    """
    test_usleep:  TEST 'sleep()' by calling it 1000 times

    Parameters:
     ius:    [int]       Argument for sleep() function
     iRego:  [int]       Cosniwa registration for the current test
     csw:    [Cosniwa*]  Pointer to Cosniwa class
    """

    # Call sleep() function 1000 times
    for inxCall in range(1000):
        csw.call_start(iRego)
        time.sleep(tSleep)
        csw.call_stop(iRego)
Example #7
0
def time_objects(iN):
    """
    time_objects:

    Function generates the requested number of objects and measures time of
    changing a class variable in all the objects.

    Parameters:

          iN:  [integer number]  The number of objects which will be generated
                                 and traversed.
    """

    # Register traverse through objects
    iRegoTr = csw.reg_code(' %d objects' % iN)

    # Generate the required number of objects
    lObj = generate_objects(iN)

    # Traverse through all the objects
    csw.call_start(iRegoTr)
    traverse_objects(lObj, iN)
    csw.call_stop(iRegoTr)