示例#1
0
    pool = mp.Pool(10)
    _uimap = profiled(**config)(pool.imap_unordered)
    for i in _uimap(work, range(-10,0)):
        print(i)

    # deactivate all profiling
    disable_profiling() # in the main thread
    tuple(_uimap(disable_profiling, range(10))) # in the workers
    for i in _uimap(work, range(-20,-10)):
        print(i)
    """

    # activate profiling, but remove profiling from the worker
    enable_profiling()
    for i in imap(not_profiled(work), range(-30,-20)):
        print(i)

    # print stats for profile of 'import math' in another process
    def import_ppft(*args):
        import ppft

    import pathos.pools as pp
    pool = pp.ProcessPool(1)
    profile('cumtime', pipe=pool.pipe)(import_ppft)
    pool.close()
    pool.join()
    pool.clear()


# EOF
示例#2
0
    pool = mp.Pool(10)
    _uimap = profiled(**config)(pool.imap_unordered)
    for i in _uimap(work, range(-10,0)):
        print(i)

    # deactivate all profiling
    disable_profiling() # in the main thread
    tuple(_uimap(disable_profiling, range(10))) # in the workers
    for i in _uimap(work, range(-20,-10)):
        print(i)
    """

    # activate profiling, but remove profiling from the worker
    enable_profiling()
    for i in map(not_profiled(work), range(-30,-20)):
        print(i)

    # print stats for profile of 'import math' in another process
    def import_ppft(*args):
        import ppft

    import pathos.pools as pp
    pool = pp.ProcessPool(1)
    profile('cumulative', pipe=pool.pipe)(import_ppft)
    pool.close()
    pool.join()
    pool.clear()


# EOF
示例#3
0
    # profile the map, with work profiled in another thread
    pool = mp.Pool(10)
    _uimap = profiled(**config)(pool.imap_unordered)
    for i in _uimap(work, range(-10,0)):
        print(i)

    # deactivate all profiling
    disable_profiling() # in the main thread
    tuple(_uimap(disable_profiling, range(10))) # in the workers
    for i in _uimap(work, range(-20,-10)):
        print(i)
    """

    # activate profiling, but remove profiling from the worker
    enable_profiling()
    for i in imap(not_profiled(work), range(-30, -20)):
        print(i)

    # print stats for profile of 'import math' in another process
    def import_ppft(*args):
        import ppft

    import pathos.pools as pp
    pool = pp.ProcessPool(1)
    profile('cumtime', pipe=pool.pipe)(import_ppft)
    pool.close()
    pool.join()
    pool.clear()

# EOF