Example #1
0
def read_ave_pwrs_with_freq( header, ifreq ):
    coef = 1.3
    pkg_max  = coef * machine.get_tdp_pkg()
    drm_max  = coef * machine.get_tdp_drm()
    secfiles = ric.get_sec_file_list( header )
    ric.reset_sec()
    nsec     = ric.get_nsec_ric( secfiles )
    npkgs    = machine.get_npkgs()
    tfreq    = 0.1 * float( ifreq )

    aves_pkg = [[0.0 for isec in range(nsec)] for ipkg in range(npkgs)]
    aves_drm = [[0.0 for isec in range(nsec)] for ipkg in range(npkgs)]
    for secfile in secfiles:
        try:
            f = open( secfile, "r" )
        except IOError:
            print "ERROR: Failure opening file %s" % secfile
            sys.exit(1)
        #
        pkgid = machine.get_pkgid( f )
        #
        f.seek(0)
        (nitera, etms, pkgs, drms, tots, frqs) = \
                ric.etime_pwrs_freq_by_trial( f )

        for isec in range(nsec):
            ave_pkg = 0.0
            ave_drm = 0.0
            neff = 0
            for itera in range(nitera):
                dif = fabs( tfreq - frqs[itera][isec] )
                if dif < 0.01:
                    pkg = pkgs[itera][isec]
                    drm = drms[itera][isec]
                    if pkg < pkg_max and drm < drm_max:
                        ave_pkg += pkg
                        ave_drm += drm
                        neff += 1
                else:   # debug
                    print "warning: %s iter=%d" % (secfile, itera)
            #
            if neff < 1:
                print "ERROR: No effective data in %s" % secfile
                f.close()
            #
            aves_pkg[pkgid][isec] = ave_pkg/float(neff)
            aves_drm[pkgid][isec] = ave_drm/float(neff)
        #
        f.close()
    #
    return ( aves_pkg, aves_drm )
Example #2
0
def read_powers_all(header, nsec, npkgs):
    ric.init_event_list(3)
    pkgpwr_pos = ric.get_lpos("pkgpwr")
    drmpwr_pos = ric.get_lpos("drmpwr")
    secfiles = ric.get_sec_file_list(header)
    pkgpwr = [[0.0 for i in range(nsec)] for j in range(npkgs)]
    drmpwr = [[0.0 for i in range(nsec)] for j in range(npkgs)]

    for secfile in secfiles:
        with open(secfile) as f:
            for line in f:
                if line.startswith("##C "):
                    pkg_id = machine.get_pkg_id(line)
                    break
            f.seek(0)
            (lnsec, lnev, lpwr) = read_average(f, nsec)
            for isec in range(nsec):
                pkgpwr[pkg_id][isec] = lpwr[isec][pkgpwr_pos]
                drmpwr[pkg_id][isec] = lpwr[isec][drmpwr_pos]
            f.close()
    #
    return (pkgpwr, drmpwr)
Example #3
0
    argc = len(sys.argv)
    if argc < 4:
        print "Usage: %s ubmt_table app_max app_min" % sys.argv[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):