Fix timestamp conversion by using correct timestamp size mask

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-05-25 16:10:46 +00:00
committed by Compute-Runtime-Automation
parent 6e30f39acb
commit 8812f6250b
2 changed files with 5 additions and 2 deletions

View File

@ -32,11 +32,12 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, HwHelperTestXeHPAndLater, WhenGettingMaxBarriersPer
}
HWCMDTEST_F(IGFX_XE_HP_CORE, HwHelperTestXeHPAndLater, givenHwHelperWhenGetGpuTimeStampInNSIsCalledThenOnlyLow32BitsFromTimeStampAreUsedAndCorrectValueIsReturned) {
constexpr uint64_t mask = static_cast<uint64_t>(std::numeric_limits<typename FamilyType::TimestampPacketType>::max());
auto &helper = HwHelper::get(renderCoreFamily);
auto timeStamp = 0x00ff'ffff'ffff;
auto frequency = 123456.0;
auto result = static_cast<uint64_t>((timeStamp & 0xffff'ffff) * frequency);
auto result = static_cast<uint64_t>((timeStamp & mask) * frequency);
EXPECT_EQ(result, helper.getGpuTimeStampInNS(timeStamp, frequency));
}