From 652e16a4b63b9d47241e79c706b76f2637584410 Mon Sep 17 00:00:00 2001 From: Ishita Ghosh <43157456+IshitaGhosh@users.noreply.github.com> Date: Fri, 13 Sep 2024 12:56:31 -0700 Subject: [PATCH] Use 64 bit timestamps in record timer data (#8416) Signed-off-by: Ishita Ghosh Co-authored-by: Ishita Ghosh --- .../ml_timeline/clientDev/ml_timeline.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/runtime_src/xdp/profile/plugin/ml_timeline/clientDev/ml_timeline.cpp b/src/runtime_src/xdp/profile/plugin/ml_timeline/clientDev/ml_timeline.cpp index 23bb650675c..27c05c08826 100644 --- a/src/runtime_src/xdp/profile/plugin/ml_timeline/clientDev/ml_timeline.cpp +++ b/src/runtime_src/xdp/profile/plugin/ml_timeline/clientDev/ml_timeline.cpp @@ -120,27 +120,33 @@ namespace xdp { // Record Timer TS in JSON // Assuming correct Stub has been called and Write Buffer contains valid data - uint32_t max_count = mBufSz / (2*sizeof(uint32_t)); - // Each record timer entry has 32bit ID and 32bit AIE Timer low value. + uint32_t max_count = mBufSz / (3*sizeof(uint32_t)); + // Each record timer entry has 32bit ID and 32bit AIE High Timer + 32bit AIE Low Timer value. uint32_t numEntries = max_count; std::stringstream msg; - msg << " A maximum of " << numEntries << " record can be accommodated in given buffer of bytes size" + msg << " A maximum of " << numEntries << " record can be accommodated in given buffer of bytes size " << std::hex << mBufSz << std::dec << std::endl; xrt_core::message::send(xrt_core::message::severity_level::debug, "XRT", msg.str()); if (numEntries <= max_count) { for (uint32_t i = 0 ; i < numEntries; i++) { boost::property_tree::ptree ptIdTS; + uint32_t id = *ptr; ptIdTS.put("id", *ptr); ptr++; - if (0 == *ptr) { - // Zero value for Timestamp in cycles indicates end of recorded data + + uint64_t ts64 = *ptr; + ts64 = ts64 << 32; + ptr++; + ts64 |= (*ptr); + if (0 == ts64 && 0 == id) { + // Zero value for Timestamp in cycles (and id too) indicates end of recorded data std::string msgEntries = " Got " + std::to_string(i) + " records in buffer"; xrt_core::message::send(xrt_core::message::severity_level::debug, "XRT", msgEntries); break; } - ptIdTS.put("cycle", *ptr); + ptIdTS.put("cycle", ts64); ptr++; ptRecordTimerTS.push_back(std::make_pair("", ptIdTS));