def print_greenlet_stacks():
    stacks = collections.defaultdict(int)
    loops = {}
    for obj in gc.get_objects():
        if not isinstance(obj, diesel.Loop) or not obj.running:
            continue
        if obj.id == diesel.core.current_loop.id:
            continue
        fr = obj.coroutine.gr_frame
        stack = ''.join(traceback.format_stack(fr))
        stacks[stack] += 1
        loops[stack] = obj
    for stack, count in sorted(stacks.iteritems(), key=itemgetter(1)):
        loop = loops[stack]
        loop_id = address_stripper.sub('', str(loop.loop_callable))
        print '[%d] === %s ===' % (count, loop_id)
        print stack
Prints the stacks of greenlets from running loops.
dataset/ETHPy150Open dieseldev/diesel/diesel/util/debugtools.py/print_greenlet_stacks