From 64e86bcea7824b5508bde0c9f28e7a16f67d6bf7 Mon Sep 17 00:00:00 2001 From: Jason Villarreal Date: Wed, 19 Jul 2023 14:41:48 -0700 Subject: [PATCH] Modifying the host reads and writes to global memory tables to only print out average bandwidth utilization if device information is available Signed-off-by: Jason Villarreal --- .../profile/writer/vp_base/summary_writer.cpp | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/runtime_src/xdp/profile/writer/vp_base/summary_writer.cpp b/src/runtime_src/xdp/profile/writer/vp_base/summary_writer.cpp index e60bc811480..ebe2554cc91 100644 --- a/src/runtime_src/xdp/profile/writer/vp_base/summary_writer.cpp +++ b/src/runtime_src/xdp/profile/writer/vp_base/summary_writer.cpp @@ -778,6 +778,7 @@ namespace xdp { db->getStats().getHostReads(); if (hostReads.size() == 0) return; + bool printAverageBWUtilization = db->infoAvailable(info::device_offload); fout << "TITLE:Host Reads from Global Memory\n"; fout << "SECTION:Host Data Transfers,Host Reads from Global Memory\n"; @@ -796,9 +797,11 @@ namespace xdp { fout << "COLUMN:Transfer
Rate (MB/s),float," << "Rate of host reads (in MB/s): " << "Transfer Rate = (Total Bytes) / (Total Time in us),\n"; - fout << "COLUMN:Average
Bandwidth
Utilization (%)," - << "float,Average bandwidth of host reads: " - << "Bandwidth Utilization (%) = (100 * Transfer Rate) / (Max. Theoretical Rate),\n"; + if (printAverageBWUtilization) { + fout << "COLUMN:Average
Bandwidth
Utilization (%)," + << "float,Average bandwidth of host reads: " + << "Bandwidth Utilization (%) = (100 * Transfer Rate) / (Max. Theoretical Rate),\n"; + } fout << "COLUMN:Maximum
Time (ms),float," << "Maximum time of a single host read,\n"; fout << "COLUMN:Minimum
Time (ms),float," @@ -834,7 +837,8 @@ namespace xdp { aveBWUtil = one_hundred; fout << transferRate << ","; - fout << aveBWUtil << ","; + if (printAverageBWUtilization) + fout << aveBWUtil << ","; fout << (stats.maxTime / one_million) << ","; fout << (stats.minTime / one_million) << ","; fout << (stats.totalTime / one_million) << ","; @@ -850,6 +854,7 @@ namespace xdp { db->getStats().getHostWrites(); if (hostWrites.size() == 0) return; + bool printAverageBWUtilization = db->infoAvailable(info::device_offload); fout << "TITLE:Host Writes to Global Memory\n"; fout << "SECTION:Host Data Transfers,Host Writes to Global Memory\n"; @@ -867,9 +872,11 @@ namespace xdp { fout << "COLUMN:Transfer
Rate (MB/s),float," << "Rate of host writes (in MB/s): " << "Transfer Rate = (Total Bytes) / (Total Time in us),\n"; - fout << "COLUMN:Average
Bandwidth
Utilization (%)," - << "float,Average bandwidth of host writes: " - << "Bandwidth Utilization (%) = (100 * Transfer Rate) / (Max. Theoretical Rate),\n"; + if (printAverageBWUtilization) { + fout << "COLUMN:Average
Bandwidth
Utilization (%)," + << "float,Average bandwidth of host writes: " + << "Bandwidth Utilization (%) = (100 * Transfer Rate) / (Max. Theoretical Rate),\n"; + } fout << "COLUMN:Maximum
Time (ms),float," << "Maximum time of a single host write,\n"; fout << "COLUMN:Minimum
Time (ms),float," @@ -904,7 +911,8 @@ namespace xdp { aveBWUtil = one_hundred; fout << transferRate << ","; - fout << aveBWUtil << ","; + if (printAverageBWUtilization) + fout << aveBWUtil << ","; fout << (stats.maxTime / one_million) << ","; fout << (stats.minTime / one_million) << ","; fout << (stats.totalTime / one_million) << ",";