tools/get_about_memory.py
def merge_files(dir, files):
    '''Merge the given memory reporter dump files into one giant file.'''
    dumps = [json.load(GzipFile(os.path.join(dir, f))) for f in files]

    merged_dump = dumps[0]
    for dump in dumps[1:]:
        # All of the properties other than 'reports' must be identical in all
        # dumps, otherwise we can't merge them.
        if set(dump.keys()) != set(merged_dump.keys()):
            print("Can't merge dumps because they don't have the "
                  "same set of properties.")
            return
        for prop in merged_dump:
            if prop != 'reports' and dump[prop] != merged_dump[prop]:
                print("Can't merge dumps because they don't have the "
                      "same value for property '%s'" % prop)

        merged_dump['reports'] += dump['reports']

    merged_reports_path = os.path.join (dir, 'memory-reports')
    json.dump(merged_dump,
              open(merged_reports_path, 'w'),
              indent=2)
    return merged_reports_path
Merge the given memory reporter dump files into one giant file.
Merge the given memory reporter dump files into one giant file.
Merge the given memory reporter dump files into one giant file .
def merge_files(dir, files):
    dumps = [json.load(GzipFile(os.path.join(dir, f))) for f in files]
    merged_dump = dumps[0]
    for dump in dumps[1:]:
        if set(dump.keys()) != set(merged_dump.keys()):
            print("Can't merge dumps because they don't have the "
                  "same set of properties.")
            return
        for prop in merged_dump:
            if prop != 'reports' and dump[prop] != merged_dump[prop]:
                print("Can't merge dumps because they don't have the "
                      "same value for property '%s'" % prop)
        merged_dump['reports'] += dump['reports']
    merged_reports_path = os.path.join (dir, 'memory-reports')
    json.dump(merged_dump,
              open(merged_reports_path, 'w'),
              indent=2)
    return merged_reports_path
def merge_files ( dir , files ) : dumps = [ json . load ( GzipFile ( os . path . join ( dir , f ) ) ) for f in files ] merged_dump = dumps [ 0 ] for dump in dumps [ 1 : ] : if set ( dump . keys ( ) ) != set ( merged_dump . keys ( ) ) : print ( "Can't merge dumps because they don't have the " "same set of properties." ) return for prop in merged_dump : if prop != 'reports' and dump [ prop ] != merged_dump [ prop ] : print ( "Can't merge dumps because they don't have the " "same value for property '%s'" % prop ) merged_dump [ 'reports' ] += dump [ 'reports' ] merged_reports_path = os . path . join ( dir , 'memory-reports' ) json . dump ( merged_dump , open ( merged_reports_path , 'w' ) , indent = 2 ) return merged_reports_path
Merge the given memory reporter dump files into one giant file.
Merge the given memory reporter dump files into one giant file .
'''Merge the given memory reporter dump files into one giant file.''' # All of the properties other than 'reports' must be identical in all # dumps, otherwise we can't merge them.
dir
files