Exemplo n.º 1
0
def main(match_funcs = None, num_parallel = 1):
    if not match_funcs:
        fs_list = fsop.get_all_fs()
        match_funcs = fsop.get_matched_ops(fs_list, "*")

    if num_parallel > 1:
        pool = mp.Pool(num_parallel)    
        results = [pool.apply_async(match_each, args=(x,)) for x in match_funcs]

        while 1:
            if len(results) == 0:
                break
            print "> Unfinished jobs : ", len(results)
            print
            next_results = []
            for res in results:
                try:
                    print res.get(False),
                except mp.TimeoutError:
                    next_results.append(res)
                
            time.sleep(2)
            results = next_results

    for funcs in match_funcs:
        match_each(funcs)
    return
Exemplo n.º 2
0
def cmd_grep_decl(opts, args):
    """grep common fields (e.g., 'grep_decl ext4')"""

    if len(args) == 0:
        args = fsop.get_all_fs()

    for fs in args:
        fsop.dump_known_ops(os.path.join(opts.linux, "fs", fs))
Exemplo n.º 3
0
def cmd_grep_decl(opts, args):
    """grep common fields (e.g., 'grep_decl ext4')"""

    if len(args) == 0:
        args = fsop.get_all_fs()

    for fs in args:
        fsop.dump_known_ops(os.path.join(opts.linux, "fs", fs))
Exemplo n.º 4
0
def simple_mp_fs(fn, args):
    if len(args) == 0:
        args = fsop.get_all_fs()

    pool = mp.Pool(mp.cpu_count())
    for fs in args:
        pool.apply_async(fn, args=(fs,))
    pool.close()
    pool.join()
Exemplo n.º 5
0
def simple_mp_fs(fn, args):
    if len(args) == 0:
        args = fsop.get_all_fs()

    pool = mp.Pool(mp.cpu_count())
    for fs in args:
        pool.apply_async(fn, args=(fs, ))
    pool.close()
    pool.join()
Exemplo n.º 6
0
def cmd_status(opts, args):
    """check status of merge/clang"""
    def _get_size(pn):
        if pn is None or not os.path.exists(pn):
            return 0
        return os.stat(pn).st_size

    for fs in fsop.get_all_fs():
        one = _get_merged_file(fs)
        fss = _get_fss_file(fs)

        print "%-10s %10s B %10s B" % (fs, _get_size(one), _get_size(fss))
Exemplo n.º 7
0
def cmd_status(opts, args):
    """check status of merge/clang"""

    def _get_size(pn):
        if pn is None or not os.path.exists(pn):
            return 0
        return os.stat(pn).st_size

    for fs in fsop.get_all_fs():
        one = _get_merged_file(fs)
        fss = _get_fss_file(fs)

        print "%-10s %10s B %10s B" % (fs, _get_size(one), _get_size(fss))
Exemplo n.º 8
0
def main():
    fs_list = fsop.get_all_fs()
    print fs_list

    fs_func_dic = load_all_available_funcs_by_fs(fs_list)

    num_parallel = 30
    pool = mp.Pool(num_parallel)
    results = [pool.apply_async(count_fs, args=(fs,fs_func_dic[fs])) \
               for fs in fs_list]
    pool.close()
    pool.join()
    for res in results:
        print res.get(False)
        #res = count_fs(fs)
    return
Exemplo n.º 9
0
def main():
    fs_list = fsop.get_all_fs()
    print fs_list

    fs_func_dic = load_all_available_funcs_by_fs(fs_list)    

    num_parallel = 30
    pool = mp.Pool(num_parallel)
    results = [pool.apply_async(count_fs, args=(fs,fs_func_dic[fs])) \
               for fs in fs_list]
    pool.close()
    pool.join()
    for res in results:
        print res.get(False)
        #res = count_fs(fs)
    return
Exemplo n.º 10
0
def main(match_funcs = None, num_parallel = 1):
    if not match_funcs:
        fs_list = fsop.get_all_fs()
        match_funcs = fsop.get_matched_ops(fs_list, "*")

    if num_parallel > 1:
        pool = mp.Pool(num_parallel)    
        results = [pool.apply_async(match_each, args=(x,)) for x in match_funcs]
        pool.close()
        pool.join()
        
        for res in results:
            try:
                print res.get(False)
            except:
                print("")
    else:
        for funcs in match_funcs:            
            print match_each(funcs)            
    return
Exemplo n.º 11
0
def main(match_funcs=None, num_parallel=1):
    if not match_funcs:
        fs_list = fsop.get_all_fs()
        match_funcs = fsop.get_matched_ops(fs_list, "*")

    if num_parallel > 1:
        pool = mp.Pool(num_parallel)
        results = [
            pool.apply_async(match_each, args=(x, )) for x in match_funcs
        ]
        pool.close()
        pool.join()

        for res in results:
            try:
                print res.get(False)
            except:
                print("")
    else:
        for funcs in match_funcs:
            print match_each(funcs)
    return