Пример #1
0
def run_dbg_lat(nfp, dma, write_read, win_sz, trans_sz, h_off, d_off, rnd,
                long_run, cache_flags, outdir):
    """Run latency debug test"""
    twr = TableWriter(nfp.lat_fmt)
    twr.open(outdir + "dbg_lat", TableWriter.ALL)

    cdfwr = TableWriter(LAT_TEST_CDF_FMT, stdout=False)
    cdfwr.open(outdir + "dbg_lat_details_cdf", TableWriter.ALL)

    flags = cache_flags

    if rnd:
        flags |= nfp.FLAGS_RANDOM

    if long_run:
        flags |= nfp.FLAGS_LONG

    if dma:
        if write_read:
            test_no = nfp.LAT_DMA_WRRD
        else:
            test_no = nfp.LAT_DMA_RD
    else:
        if write_read:
            test_no = nfp.LAT_CMD_WRRD
        else:
            test_no = nfp.LAT_CMD_RD

    lat_stats = nfp.lat_test(twr, test_no, flags, win_sz, trans_sz, h_off,
                             d_off)

    h_cyc = lat_stats.histo()
    cdf_cyc = histo2cdf(h_cyc)

    vals = sorted(cdf_cyc.keys())
    cdfwr.sec("test=%s trans_sz=%d win_sz=%d" %
              (nfp.TEST_NAMES[test_no], trans_sz, win_sz))
    cdfwr.out((vals[0], nfp.cyc2ns(vals[0]), 0))
    for val in vals:
        cdfwr.out((val, nfp.cyc2ns(val), cdf_cyc[val]))

    cdfwr.close(TableWriter.ALL)
    twr.close(TableWriter.ALL)
Пример #2
0
def run_lat_details(nfp, outdir):
    """Run a longer test and perform some analysis"""

    win_szs = [8192, 64 * 1024 * 1024]
    common_flags = nfp.FLAGS_LONG | nfp.FLAGS_RANDOM

    # Commands latencies
    trans_szs = [8]
    twr = TableWriter(nfp.lat_fmt)
    twr.open(outdir + "lat_cmd_details", TableWriter.ALL)
    cdfwr = TableWriter(LAT_TEST_CDF_FMT, stdout=False)
    cdfwr.open(outdir + "lat_cmd_details_cdf", TableWriter.ALL)
    raw = open(outdir + "lat_cmd_details_raw.dat", 'w')
    twr.msg("\nPCIe CMD latencies with more details")

    for test_no in [nfp.LAT_CMD_RD, nfp.LAT_CMD_WRRD]:
        twr.sec()
        for trans_sz in trans_szs:
            for win_sz in win_szs:
                for flags in [common_flags, common_flags | nfp.FLAGS_HOSTWARM]:
                    lat_stats = nfp.lat_test(twr, test_no, flags, win_sz,
                                             trans_sz, 0, 0)

                    h_cyc = lat_stats.histo()
                    cdf_cyc = histo2cdf(h_cyc)

                    vals = sorted(cdf_cyc.keys())
                    cdfwr.sec("test=%s trans_sz=%d win_sz=%d cache=%s" %
                              (nfp.TEST_NAMES[test_no], trans_sz, win_sz,
                               "hwarm" if flags & nfp.FLAGS_HOSTWARM \
                               else "cold"))
                    cdfwr.out((vals[0], nfp.cyc2ns(vals[0]), 0))
                    for val in vals:
                        cdfwr.out((val, nfp.cyc2ns(val), cdf_cyc[val]))

                    # write raw data
                    raw.write(
                        "# %s %s Winsz=%d trans_sz=%d (values in ns)\n" %
                        (nfp.TEST_NAMES[test_no], "Warm" if flags
                         & nfp.FLAGS_HOSTWARM else "Cold", win_sz, trans_sz))
                    for t in lat_stats.list:
                        raw.write("%.0f\n" % nfp.cyc2ns(t))
                    raw.write("\n\n")

    cdfwr.close(TableWriter.ALL)
    twr.close(TableWriter.ALL)
    raw.close()

    # DMA latencies
    trans_szs = [64, 2048]
    twr = TableWriter(nfp.lat_fmt)
    twr.open(outdir + "lat_dma_details", TableWriter.ALL)
    cdfwr = TableWriter(LAT_TEST_CDF_FMT, stdout=False)
    cdfwr.open(outdir + "lat_dma_details_cdf", TableWriter.ALL)
    raw = open(outdir + "lat_dma_details_raw.dat", 'w')
    twr.msg("\nPCIe DMA latencies with more details")

    for test_no in [nfp.LAT_DMA_RD, nfp.LAT_DMA_WRRD]:
        twr.sec()
        for trans_sz in trans_szs:
            for win_sz in win_szs:
                for flags in [common_flags, common_flags | nfp.FLAGS_HOSTWARM]:
                    lat_stats = nfp.lat_test(twr, test_no, flags, win_sz,
                                             trans_sz, 0, 0)

                    h_cyc = lat_stats.histo()
                    cdf_cyc = histo2cdf(h_cyc)

                    vals = sorted(cdf_cyc.keys())
                    cdfwr.sec("test=%s trans_sz=%d win_sz=%d cache=%s" %
                              (nfp.TEST_NAMES[test_no], trans_sz, win_sz,
                               "hwarm" if flags & nfp.FLAGS_HOSTWARM \
                               else "cold"))
                    cdfwr.out((vals[0], nfp.cyc2ns(vals[0]), 0))
                    for val in vals:
                        cdfwr.out((val, nfp.cyc2ns(val), cdf_cyc[val]))

                    # write raw data
                    raw.write(
                        "# %s %s Winsz=%d trans_sz=%d (values in ns)\n" %
                        (nfp.TEST_NAMES[test_no], "Warm" if flags
                         & nfp.FLAGS_HOSTWARM else "Cold", win_sz, trans_sz))
                    for t in lat_stats.list:
                        raw.write("%.0f\n" % nfp.cyc2ns(t))
                    raw.write("\n\n")

    cdfwr.close(TableWriter.ALL)
    twr.close(TableWriter.ALL)
    raw.close()