Esempio n. 1
0
 def perf_spawn_throughput(self):
     # Measure the number of fibers we can spawn per second.
     t0 = t1 = time.time()
     count = [0]
     def dummy_fiber():
         count[0] += 1
     while t1 - t0 < 0.2:
         fiber = Fiber(dummy_fiber)
         fiber.start()
         gruvi.sleep(0)
         t1 = time.time()
     speed = count[0] / (t1 - t0)
     self.add_result(speed)
Esempio n. 2
0
    def perf_spawn_throughput(self):
        # Measure the number of fibers we can spawn per second.
        t0 = t1 = time.time()
        count = [0]

        def dummy_fiber():
            count[0] += 1

        while t1 - t0 < 0.2:
            fiber = Fiber(dummy_fiber)
            fiber.start()
            gruvi.sleep(0)
            t1 = time.time()
        speed = count[0] / (t1 - t0)
        self.add_result(speed)
Esempio n. 3
0
 def perf_switch_throughput(self):
     # Measure the number of switches we can do per second.
     t0 = t1 = time.time()
     count = [0]
     def switch_parent():
         while True:
             gruvi.sleep(0)
     fiber = Fiber(switch_parent)
     fiber.start()
     while t1 - t0 < 0.2:
         gruvi.sleep(0)
         count[0] += 1
         t1 = time.time()
     speed = count[0] / (t1 - t0)
     self.add_result(speed)
     fiber.cancel()
     gruvi.sleep(0)
Esempio n. 4
0
    def perf_switch_throughput(self):
        # Measure the number of switches we can do per second.
        t0 = t1 = time.time()
        count = [0]

        def switch_parent():
            while True:
                gruvi.sleep(0)

        fiber = Fiber(switch_parent)
        fiber.start()
        while t1 - t0 < 0.2:
            gruvi.sleep(0)
            count[0] += 1
            t1 = time.time()
        speed = count[0] / (t1 - t0)
        self.add_result(speed)
        fiber.cancel()
        gruvi.sleep(0)