def testThroughput(testName,
                   testFunOfN,
                   setupFunOfN=None,
                   transformOfN=None,
                   metadata=None,
                   maxNToSearch=1000000,
                   baseMultiplier=1,
                   timeoutInSec=30.0):
    counter = 0
    unitOfWork = counter
    unitsOfWorkCompleted = 0
    runtime = None

    timeUsed = 0

    while timeoutInSec < timeUsed and counter <= maxNToSearch:
        try:
            counter += 1

            unitOfWork = counter
            if transformOfN is not None:
                unitOfWork = transformOfN(counter)

            if setupFunOfN is not None:
                setupFunOfN(unitOfWork)

            t0 = time.time()
            testFunOfN(unitOfWork)
            runtime = time.time() - t0

            if timeUsed < timeoutInSec:
                unitsOfWorkCompleted += unitOfWork

            timeUsed += runtime

        except TimedOutException:
            break

    # we had at least one passing result before timing out
    assert runtime is not None
    assert unitsOfWorkCompleted > 0

    if isCurrentlyTesting():
        recordThroughputTest(testName, timeUsed, unitsOfWorkCompleted, baseMultiplier, metadata)
dataset/ETHPy150Open ufora/ufora/ufora/test/PerformanceTestReporter.py/testThroughput/swapped operands of `<`