示例#1
0
 def recursive_a(n):
     if not n:
         return
     burn_cpu(0.1)
     burn_io_gevent(0.1)
     g = self.spawn_greenlet("rec", recursive_a, n - 1)
     return g.get()
示例#2
0
        def a(n):
            burn_cpu(0.1)
            burn_io_gevent(0.1)

            if (n == 0):
                raise Exception

            a(n - 1)
示例#3
0
        def a(n):
            if (n <= 0):
                return

            burn_io_gevent(0.001)
            burn_cpu(0.1)

            a(n - 1)
            a(n - 2)
示例#4
0
 def a(n):
     if n <= 0:
         return
     burn_io_gevent(0.1)
     burn_cpu(0.1)
     g1 = self.spawn_greenlet("a_%d" % (n - 1), a, n - 1)
     g1.get()
     g2 = self.spawn_greenlet("a_%d" % (n - 2), a, n - 2)
     g2.get()
示例#5
0
        def common():
            for _ in range(100):
                burn_io_gevent(0.001)

            burn_io(0.1)
            burn_cpu(0.2)

            for _ in range(100):
                burn_io_gevent(0.001)

            burn_io(0.1)
            burn_cpu(0.2)
示例#6
0
 def a():
     burn_io_gevent(0.1)
     burn_io(0.1)
     burn_io_gevent(0.1)
     burn_io(0.1)
     burn_io_gevent(0.1)
     burn_cpu(0.3)
示例#7
0
 def a():
     burn_io_gevent(0.3)
     burn_cpu(0.4)
示例#8
0
 def a_inner_3():
     burn_cpu(0.1)
     burn_io_gevent(0.1)