예제 #1
0
def read_average(fin, nsec):
    (ev_pos, ev_name, ev_frac, ev_type) = ric.get_event_list()
    nev = len(ev_pos)
    sec_pos = ric.get_pos("sec")
    etm_pos = ric.get_pos("etime")
    VALUES = [[[0.0 for i in range(nev)] for j in range(nsec)] for k in range(MAX_NITERA)]

    ntmp = 0
    itera = -1
    for line in fin:
        if line.startswith("##T "):
            toks = line.split()
            secname = toks[sec_pos]
            etime = float(toks[etm_pos])
            isec = ric.get_sec_id(secname)
            for iev in range(nev):
                ipos = ev_pos[iev]
                val = float(toks[ipos])
                if ev_type[iev] == 1:
                    val *= etime
                VALUES[itera][isec][iev] += val
            ntmp += 1
        elif line.startswith("##C "):
            if itera == -1 or ntmp > 0:
                ntmp = 0
                itera += 1
        #
    if ntmp > 0:
        itera += 1
    nitera = itera
    secnames = ric.get_sec_names()
    etm_pos = ric.get_lpos("etime")
    for itera in range(nitera):
        for isec in range(nsec):
            etime = VALUES[itera][isec][etm_pos]
            for iev in range(nev):
                if ev_type[iev] == 1:
                    VALUES[itera][isec][iev] /= etime
    aves = [[0.0 for i in range(nev)] for j in range(nsec)]
    for itera in range(nitera):
        for isec in range(nsec):
            for iev in range(nev):
                aves[isec][iev] += VALUES[itera][isec][iev]
    for isec in range(nsec):
        for iev in range(nev):
            aves[isec][iev] /= nitera
    return (nsec, nev, aves)
예제 #2
0
        sys.exit(1)
    ubmt_table = sys.argv[1]
    app_max_header = sys.argv[2]
    app_min_header = sys.argv[3]
    if debug:
        print "##C ubmt_table       = %s" % ubmt_table
        print "##C app_max_header   = %s" % app_max_header
        print "##C app_min_header   = %s" % app_min_header

    npkgs = machine.get_npkgs()
    (rmaxpkg, rmaxdrm, rminpkg, rmindrm) = read.read_ubmt_table(ubmt_table)
    #
    secfiles = ric.get_sec_file_list(app_max_header)
    ric.reset_sec()
    nsec = ric.get_nsec_ric(secfiles)
    secnames = ric.get_sec_names()
    (app_maxpkg, app_maxdrm) = read_powers_all(app_max_header, nsec, npkgs)
    (app_minpkg, app_mindrm) = read_powers_all(app_min_header, nsec, npkgs)

    ave_ref_maxpkg = [0.0 for i in range(nsec)]
    ave_ref_maxdrm = [0.0 for i in range(nsec)]
    ave_ref_minpkg = [0.0 for i in range(nsec)]
    ave_ref_mindrm = [0.0 for i in range(nsec)]
    ave_app_maxpkg = [0.0 for i in range(nsec)]
    ave_app_maxdrm = [0.0 for i in range(nsec)]
    ave_app_minpkg = [0.0 for i in range(nsec)]
    ave_app_mindrm = [0.0 for i in range(nsec)]
    for ipkg in range(npkgs):
        for isec in range(nsec):
            if app_maxpkg[ipkg][isec] > 0.0 and app_minpkg[ipkg][isec] > 0.0:
                if rmaxpkg[ipkg] == 0.0 or rminpkg[ipkg] == 0: