mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 23:56:39 +08:00
fix: Returns Correct No. of VF Engine Stats as requested.
- When the requested engine count is less than the actual engine stats available, then only requested no. of engine stats are retrieved. Related-To: NEO-13525 Signed-off-by: Pratik Bari <pratik.bari@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1dc7cd9f21
commit
fc1c08a570
@@ -110,19 +110,17 @@ ze_result_t LinuxVfImp::getEngineUtilization(uint32_t *pCount, zes_vf_util_engin
|
||||
|
||||
if (pEngineUtil != nullptr) {
|
||||
PmuInterface *pPmuInterface = pLinuxSysmanImp->getPmuInterface();
|
||||
uint32_t index = 0;
|
||||
for (auto pEngineUtilsData : pEngineUtils) {
|
||||
for (uint32_t i = 0; i < *pCount; i++) {
|
||||
uint64_t pmuData[4] = {};
|
||||
auto ret = pPmuInterface->pmuRead(static_cast<int>(pEngineUtilsData.busyTicksFd), pmuData, sizeof(pmuData));
|
||||
auto ret = pPmuInterface->pmuRead(static_cast<int>(pEngineUtils[i].busyTicksFd), pmuData, sizeof(pmuData));
|
||||
if (ret < 0) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pmuRead is returning value:%d and error:0x%x \n", __FUNCTION__, ret, ZE_RESULT_ERROR_UNKNOWN);
|
||||
*pCount = 0;
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
pEngineUtil[index].vfEngineType = pEngineUtilsData.engineType;
|
||||
pEngineUtil[index].activeCounterValue = pmuData[2];
|
||||
pEngineUtil[index].samplingCounterValue = pmuData[3];
|
||||
index++;
|
||||
pEngineUtil[i].vfEngineType = pEngineUtils[i].engineType;
|
||||
pEngineUtil[i].activeCounterValue = pmuData[2];
|
||||
pEngineUtil[i].samplingCounterValue = pmuData[3];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,26 @@ TEST_F(ZesVfFixturePrelim, GivenValidVfHandleWhenCallingZesVFManagementGetVFEngi
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ZesVfFixturePrelim, GivenValidVfHandleWhenCallingZesVFManagementGetVFEngineUtilizationExp2WithEngineStatsCountLessThanActualThenCorrectEngineStatsCountIsReturned) {
|
||||
|
||||
auto handles = getEnabledVfHandles(mockHandleCount);
|
||||
for (auto handleVf : handles) {
|
||||
ASSERT_NE(nullptr, handleVf);
|
||||
uint32_t count = 0;
|
||||
auto result = zesVFManagementGetVFEngineUtilizationExp2(handleVf, &count, nullptr);
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(count, numberMockedEngines);
|
||||
count = count - 1;
|
||||
std::vector<zes_vf_util_engine_exp2_t> engineUtils(count);
|
||||
result = zesVFManagementGetVFEngineUtilizationExp2(handleVf, &count, engineUtils.data());
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(count, engineUtils.size());
|
||||
EXPECT_EQ(engineUtils[0].vfEngineType, ZES_ENGINE_GROUP_COMPUTE_SINGLE);
|
||||
EXPECT_EQ(engineUtils[0].activeCounterValue, mockActiveTime);
|
||||
EXPECT_EQ(engineUtils[0].samplingCounterValue, mockTimestamp);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ZesVfFixturePrelim, GivenValidVfHandleWhenQueryingEngineUtilizationMultipleTimesThenCorrectEngineStatsAreReturned) {
|
||||
|
||||
auto handles = getEnabledVfHandles(mockHandleCount);
|
||||
|
||||
Reference in New Issue
Block a user