def run_lat_cmd_sweep(nfp, outdir): """Run Latency tests to determine any cache or IO-MMU effects""" twr = TableWriter(nfp.lat_fmt) win_szs = [x * 1024 for x in [1, 4, 16, 256, 512]] + \ [x * 1024 * 1024 for x in [1, 1.5, 2, 3, 4, 8, 16, 32, 64]] trans_szs = [8, 64] access = nfp.FLAGS_RANDOM for test_no in [nfp.LAT_CMD_RD, nfp.LAT_CMD_WRRD]: for trans_sz in trans_szs: out_name = "lat_cmd_sweep_" out_name += "rd_" if test_no == nfp.LAT_CMD_RD else "wrrd_" out_name += "seq_" if access == 0 else "rnd_" out_name += "%02d" % trans_sz twr.open(outdir + out_name, TableWriter.ALL) twr.msg("\n\nPCIe CMD %s latency over different windows " "sizes with %s access" % ("Read" if test_no == nfp.LAT_CMD_RD else "Write/Read", "sequential" if access == 0 else "random")) for flags in [ 0, nfp.FLAGS_THRASH, nfp.FLAGS_WARM, nfp.FLAGS_HOSTWARM ]: twr.sec() for win_sz in win_szs: _ = nfp.lat_test(twr, test_no, access | flags, win_sz, trans_sz, 0, 0) twr.close(TableWriter.ALL)
def run_bw_dma_off(nfp, outdir): """Run Bandwidth tests to with different host offset""" twr = TableWriter(nfp.bw_fmt) win_sz = 8192 trans_szs = [64, 128, 256, 407, 416, 1024, 2048] offsets = [0, 1, 2, 3, 4, 6, 8, 12, 16, 20, 25, 32, 41, 48, 63] for flags in [0, nfp.FLAGS_HOSTWARM]: for test_no in [nfp.BW_DMA_RD, nfp.BW_DMA_WR]: out_name = "bw_dma_off_%s" % \ ("rd" if test_no == nfp.BW_DMA_RD else "wr") # With DDIO, no point in running cold/warm WRRD tests if flags == 0 and test_no == nfp.LAT_DMA_WRRD: continue if flags == 0: out_name += "_cold" twr.open(outdir + out_name, TableWriter.ALL) twr.msg("\nPCIe DMA %s Bandwidth with different host offset" % ("Read" if test_no == nfp.LAT_DMA_RD else "Write")) for trans_sz in trans_szs: twr.sec() for off in offsets: _ = nfp.bw_test(twr, test_no, flags, win_sz, trans_sz, off, 0) twr.sec() for off in offsets: _ = nfp.bw_test(twr, test_no, flags, win_sz, trans_sz, 0, off) twr.close(TableWriter.ALL)
def run_lat_dma_off(nfp, outdir): """Run Latency tests to with different host offset""" twr = TableWriter(nfp.lat_fmt) flags = nfp.FLAGS_HOSTWARM win_sz = 8192 trans_szs = [64, 128, 256, 407, 416, 1024, 2048] offsets = [0, 1, 2, 3, 4, 6, 8, 12, 16, 20, 25, 32, 41, 48, 63] for test_no in [nfp.LAT_DMA_RD, nfp.LAT_DMA_WRRD]: out_name = "lat_dma_off_%s" % \ ("rd" if test_no == nfp.LAT_DMA_RD else "wrrd") twr.open(outdir + out_name, TableWriter.ALL) twr.msg("\nPCIe DMA %s latency with different host offset" % ("Read" if test_no == nfp.LAT_DMA_RD else "Write/Read")) for trans_sz in trans_szs: twr.sec() for off in offsets: _ = nfp.lat_test(twr, test_no, flags, win_sz, trans_sz, off, 0) twr.sec() for off in offsets: _ = nfp.lat_test(twr, test_no, flags, win_sz, trans_sz, 0, off) twr.close(TableWriter.ALL)
def run_bw_dma_win_sweep(nfp, outdir): """Run Bandwidth tests with differnt windows sizes""" twr = TableWriter(nfp.bw_fmt) win_szs = [x * 1024 for x in [4, 16, 256, 512]] + \ [x * 1024 * 1024 for x in [1, 1.5, 2, 3, 4, 8, 16, 32, 64]] trans_szs = [64, 128, 256, 512] access = nfp.FLAGS_RANDOM for test_no in [nfp.BW_DMA_RD, nfp.BW_DMA_WR]: for trans_sz in trans_szs: out_name = "bw_dma_win_sweep_" out_name += "rd" if test_no == nfp.BW_DMA_RD else "wr" out_name += "_rnd_" out_name += "%02d" % trans_sz twr.open(outdir + out_name, TableWriter.ALL) twr.msg("\n\nPCIe DMA %s bandwidth over different windows " "sizes with Random access" % ("Read" if test_no == nfp.BW_DMA_RD else "Write")) for flags in [ 0, nfp.FLAGS_THRASH, nfp.FLAGS_WARM, nfp.FLAGS_HOSTWARM ]: twr.sec() for win_sz in win_szs: nfp.bw_test(twr, test_no, flags | access, win_sz, trans_sz, 0, 0) twr.close(TableWriter.ALL)
def run_dbg_mem(nfp, outdir): """Debug memory, trying to hit the same cachelines over and over""" twr = TableWriter(nfp.bw_fmt) twr.open(outdir + "dbg_mem", TableWriter.ALL) flags = nfp.FLAGS_HOSTWARM test_no = nfp.BW_DMA_RD trans_szs = [64, 128, 256, 512, 1024] for trans_sz in trans_szs: nfp.bw_test(twr, test_no, flags, trans_sz, trans_sz, 0, 0) nfp.bw_test(twr, test_no, flags, 8192, trans_sz, 0, 0) twr.close(TableWriter.ALL)
def run_lat_cmd(nfp, outdir): """Run basic Latency tests for different sizes using the PCIe commands""" twr = TableWriter(nfp.lat_fmt) twr.open(outdir + "lat_cmd_sizes", TableWriter.ALL) twr.msg("\nPCIe CMD Latency with different transfer sizes") win_sz = 4096 trans_szs = [4, 8, 16, 24, 32, 48, 64] flags = nfp.FLAGS_HOSTWARM for test_no in [nfp.LAT_CMD_RD, nfp.LAT_CMD_WRRD]: twr.sec() for trans_sz in trans_szs: _ = nfp.lat_test(twr, test_no, flags, win_sz, trans_sz, 0, 0) twr.close(TableWriter.ALL)
def run_lat_dma_byte(nfp, outdir): """Run basic Latency tests for different sizes using the PCIe commands""" twr = TableWriter(nfp.lat_fmt) twr.open(outdir + "lat_dma_sizes_byte_inc", TableWriter.ALL) twr.msg("\nPCIe DMA Latency with different transfer sizes") win_sz = 8192 flags = nfp.FLAGS_HOSTWARM for mid_sz in [256, 1024]: trans_szs = range(mid_sz - 16, mid_sz + 16) for test_no in [nfp.LAT_DMA_RD, nfp.LAT_DMA_WRRD]: twr.sec() for trans_sz in trans_szs: _ = nfp.lat_test(twr, test_no, flags, win_sz, trans_sz, 0, 0) twr.close(TableWriter.ALL)
def run_lat_dma(nfp, outdir): """Run basic Latency tests for different sizes using the PCIe commands""" twr = TableWriter(nfp.lat_fmt) twr.open(outdir + "lat_dma_sizes", TableWriter.ALL) twr.msg("\nPCIe DMA Latency with different transfer sizes") win_sz = 8192 flags = nfp.FLAGS_HOSTWARM trans_szs = [ 4, 8, 16, 24, 32, 48, 64, 128, 256, 512, 768, 1024, 1280, 1520, 2048 ] for test_no in [nfp.LAT_DMA_RD, nfp.LAT_DMA_WRRD]: twr.sec() for trans_sz in trans_szs: _ = nfp.lat_test(twr, test_no, flags, win_sz, trans_sz, 0, 0) twr.close(TableWriter.ALL)
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)
def run_lat_cmd_off(nfp, outdir): """Run Latency tests to with different host offset""" twr = TableWriter(nfp.lat_fmt) win_szs = [4096, 8 * 1024 * 1024] trans_szs = [8, 64] for test_no in [nfp.LAT_CMD_RD, nfp.LAT_CMD_WRRD]: out_name = "lat_cmd_off_%s" % \ ("rd" if test_no == nfp.LAT_CMD_RD else "wrrd") twr.open(outdir + out_name, TableWriter.ALL) twr.msg("\nPCIe CMD %s latency with different host offset" % ("Read" if test_no == nfp.LAT_CMD_RD else "Write/Read")) for trans_sz in trans_szs: for win_sz in win_szs: for flags in [0, nfp.FLAGS_HOSTWARM]: twr.sec() for off in [0, 1, 2, 3, 4, 6, 8, 16, 32, 48]: _ = nfp.lat_test(twr, test_no, flags, win_sz, trans_sz, off, 0) twr.close(TableWriter.ALL)
def run_bw_dma_sz_sweep(nfp, outdir): """Run Bandwidth tests across different DMA sizes""" twr = TableWriter(nfp.bw_fmt) win_sz = 8192 # kinda assume MPS of 256 trans_szs = [ 16, 32, 63, 64, 65, 127, 128, 129, 192, 255, 256, 257, 320, 384, 511, 512, 513, 576, 640, 704, 767, 768, 769, 832, 896, 960, 1023, 1024, 1025, 1279, 1280, 1281, 1535, 1536, 1537, 1791, 1792, 1793, 2047, 2048 ] flags = nfp.FLAGS_RANDOM | nfp.FLAGS_HOSTWARM out_name = "bw_dma_sz_sweep" twr.open(outdir + out_name, TableWriter.ALL) for test_no in [nfp.BW_DMA_RD, nfp.BW_DMA_WR, nfp.BW_DMA_RW]: twr.sec() for trans_sz in trans_szs: nfp.bw_test(twr, test_no, flags, win_sz, trans_sz, 0, 0) twr.close(TableWriter.ALL)
def run_dbg_bw(nfp, wr_flag, rw_flag, win_sz, trans_sz, h_off, d_off, rnd, cache_flags, outdir): """Run bandwidth debug test""" if wr_flag and rw_flag: raise Exception("Illegal combination of flags") if wr_flag: test_no = nfp.BW_DMA_WR elif rw_flag: test_no = nfp.BW_DMA_RW else: test_no = nfp.BW_DMA_RD twr = TableWriter(nfp.bw_fmt) twr.open(outdir + "dbg_bw", TableWriter.ALL) flags = cache_flags if rnd: flags |= nfp.FLAGS_RANDOM nfp.bw_test(twr, test_no, flags, win_sz, trans_sz, h_off, d_off) twr.close(TableWriter.ALL)
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()