Skip to content

Commit

Permalink
fixed bug in latency calculation (Xilinx#8715)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgschuey authored Jan 24, 2025
1 parent 81ca1b7 commit 613de25
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ namespace xdp::aie::profile {
// Read 3 - The sum of each event latency squared
// Read 4 - 31:16 Minimum measured latency, 16 bits
// 15:0 Maximum measured latency, 16 bits
std::vector<uint32_t> latencyValues;
std::vector<uint64_t> latencyValues;
for (uint32_t c=0; c < UC_MDM_PCDRR_LATENCY_READS; ++c) {
uint32_t val;
XAie_Read32(aieDevInst, tileOffset + UC_MDM_PCDRR, &val);
Expand All @@ -771,8 +771,8 @@ namespace xdp::aie::profile {

// 6. Calculate average latency
// NOTE: for now, only report average (we also have min and max; see above)
uint32_t numValues = latencyValues.at(0);
uint32_t totalLatency = latencyValues.at(1);
auto numValues = latencyValues.at(0);
auto totalLatency = latencyValues.at(1);
uint64_t avgLatency = (numValues == 0) ? 0 : (totalLatency / numValues);
values.push_back(avgLatency);
}
Expand Down

0 comments on commit 613de25

Please sign in to comment.