mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 01:35:20 +08:00
Dynamically read timestamp resolution on Linux.
Related-To: NEO-2492 Change-Id: Ic76815496289ccecd8a76484e417e71b78b04932 Signed-off-by: Zdunowski, Piotr <piotr.zdunowski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
474c25eca6
commit
4f9840246f
@@ -194,6 +194,40 @@ TEST_F(DrmTimeTest, detect) {
|
||||
delete drm;
|
||||
}
|
||||
|
||||
TEST_F(DrmTimeTest, givenGpuTimestampResolutionQueryWhenIoctlFailsThenDefaultResolutionIsReturned) {
|
||||
auto defaultResolution = platformDevices[0]->capabilityTable.defaultProfilingTimerResolution;
|
||||
|
||||
auto drm = std::make_unique<DrmMockCustom>();
|
||||
osTime->updateDrm(drm.get());
|
||||
|
||||
drm->getParamRetValue = 0;
|
||||
drm->ioctl_res = -1;
|
||||
|
||||
auto result = osTime->getDynamicDeviceTimerResolution(*platformDevices[0]);
|
||||
EXPECT_DOUBLE_EQ(result, defaultResolution);
|
||||
}
|
||||
|
||||
TEST_F(DrmTimeTest, givenGpuTimestampResolutionQueryWhenNoDrmThenDefaultResolutionIsReturned) {
|
||||
osTime->updateDrm(nullptr);
|
||||
|
||||
auto defaultResolution = platformDevices[0]->capabilityTable.defaultProfilingTimerResolution;
|
||||
|
||||
auto result = osTime->getDynamicDeviceTimerResolution(*platformDevices[0]);
|
||||
EXPECT_DOUBLE_EQ(result, defaultResolution);
|
||||
}
|
||||
|
||||
TEST_F(DrmTimeTest, givenGpuTimestampResolutionQueryWhenIoctlSuccedsThenCorrectResolutionIsReturned) {
|
||||
auto drm = std::make_unique<DrmMockCustom>();
|
||||
osTime->updateDrm(drm.get());
|
||||
|
||||
// 19200000 is frequency yelding 52.083ns resolution
|
||||
drm->getParamRetValue = 19200000;
|
||||
drm->ioctl_res = 0;
|
||||
|
||||
auto result = osTime->getDynamicDeviceTimerResolution(*platformDevices[0]);
|
||||
EXPECT_DOUBLE_EQ(result, 52.08333333333333);
|
||||
}
|
||||
|
||||
TEST_F(DrmTimeTest, givenAlwaysFailingResolutionFuncWhenGetHostTimerResolutionIsCalledThenReturnsZero) {
|
||||
osTime->setResolutionFunc(resolutionFuncFalse);
|
||||
auto retVal = osTime->getHostTimerResolution();
|
||||
|
||||
Reference in New Issue
Block a user