Ejemplo n.º 1
0
    def testOpCount(self):
        totalOpCount = 0
        results = [Results() for i in xrange(10)]
        map(Results.startBenchmark, results)
        for r in results:
            for i in xrange(0, 5000):
                txn = random.choice(self.txnNames)
                id = r.startTransaction(txn)
                assert id != None
                ops = random.randint(1, 10)
                r.stopTransaction(id, ops)
                totalOpCount += ops
            ## FOR
        ## FOR
        map(Results.stopBenchmark, results)

        r = Results()
        map(r.append, results)
        self.assertEquals(totalOpCount, r.opCount)
Ejemplo n.º 2
0
    def testPickle(self):
        r = Results()
        r.startBenchmark()
        for i in xrange(0, 1000):
            txn = random.choice(self.txnNames)
            id = r.startTransaction(txn)
            assert id != None
            r.stopTransaction(id, 1)
        ## FOR

        # Serialize
        import pickle
        p = pickle.dumps(r, -1)
        assert p

        # Deserialize
        clone = pickle.loads(p)
        assert clone

        # Make sure the txn counts are equal
        self.compareResults(r, clone)
Ejemplo n.º 3
0
 def testPickle(self):
     r = Results()
     r.startBenchmark()
     for i in xrange(0, 1000):
         txn = random.choice(self.txnNames)
         id = r.startTransaction(txn)
         assert id != None
         r.stopTransaction(id, 1)
     ## FOR
     
     # Serialize
     import pickle
     p = pickle.dumps(r, -1)
     assert p
     
     # Deserialize
     clone = pickle.loads(p)
     assert clone
     
     # Make sure the txn counts are equal
     self.compareResults(r, clone)
Ejemplo n.º 4
0
    def testAppend(self):
        r1 = Results()
        r1.startBenchmark()
        for i in xrange(0, 5000):
            txn = random.choice(self.txnNames)
            id = r1.startTransaction(txn)
            assert id != None
            r1.stopTransaction(id, 1)
        ## FOR
        r1.stopBenchmark()
        print r1.show()

        # Append the time and then make sure they're the same
        r2 = Results()
        r2.append(r1)
        self.compareResults(r1, r2)
Ejemplo n.º 5
0
 def testAppend(self):
     r1 = Results()
     r1.startBenchmark()
     for i in xrange(0, 5000):
         txn = random.choice(self.txnNames)
         id = r1.startTransaction(txn)
         assert id != None
         r1.stopTransaction(id, 1)
     ## FOR
     r1.stopBenchmark()
     print r1.show()
     
     # Append the time and then make sure they're the same
     r2 = Results()
     r2.append(r1)
     self.compareResults(r1, r2)