From 4fca0e16b650e885b6245597b6cd8d2b2bd67a1f Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Mon, 4 Dec 2023 14:34:08 +0000 Subject: [PATCH] refactor: correct variable naming Signed-off-by: Mateusz Jablonski --- .../linux/sysman_os_memory_imp_prelim.cpp | 2 +- .../memory/windows/sysman_os_memory_imp.cpp | 2 +- .../sysman/source/api/pci/sysman_pci_imp.cpp | 24 +++++++++---------- level_zero/sysman/source/sysman_const.h | 12 +++++----- .../linux/test_sysman_memory_prelim.cpp | 2 +- .../memory/windows/test_zes_memory.cpp | 2 +- .../sources/pci/linux/test_zes_pci.cpp | 22 ++++++++--------- .../memory/linux/os_memory_imp_prelim.cpp | 2 +- .../sysman/memory/windows/os_memory_imp.cpp | 2 +- .../tools/source/sysman/pci/pci_imp.cpp | 24 +++++++++---------- level_zero/tools/source/sysman/sysman_const.h | 12 +++++----- .../linux/test_sysman_memory_prelim.cpp | 2 +- .../sysman/memory/windows/test_zes_memory.cpp | 2 +- .../sources/sysman/pci/linux/test_zes_pci.cpp | 22 ++++++++--------- 14 files changed, 66 insertions(+), 66 deletions(-) diff --git a/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp_prelim.cpp b/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp_prelim.cpp index d76537cb55..f5a17f8135 100644 --- a/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp_prelim.cpp +++ b/level_zero/sysman/source/api/memory/linux/sysman_os_memory_imp_prelim.cpp @@ -193,7 +193,7 @@ ze_result_t LinuxMemoryImp::getBandwidthForDg2(zes_mem_bandwidth_t *pBandwidth) if (result != ZE_RESULT_SUCCESS) { NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pSysfsAccess->read returning error:0x%x \n", __FUNCTION__, result); } - pBandwidth->maxBandwidth = maxBw * MbpsToBytesPerSecond; + pBandwidth->maxBandwidth = maxBw * mbpsToBytesPerSecond; pBandwidth->timestamp = SysmanDevice::getSysmanTimestamp(); return ZE_RESULT_SUCCESS; } diff --git a/level_zero/sysman/source/api/memory/windows/sysman_os_memory_imp.cpp b/level_zero/sysman/source/api/memory/windows/sysman_os_memory_imp.cpp index 1c6eaa6a12..f3c1e89d82 100644 --- a/level_zero/sysman/source/api/memory/windows/sysman_os_memory_imp.cpp +++ b/level_zero/sysman/source/api/memory/windows/sysman_os_memory_imp.cpp @@ -204,7 +204,7 @@ ze_result_t WddmMemoryImp::getBandwidth(zes_mem_bandwidth_t *pBandwidth) { pBandwidth->maxBandwidth = 0; if (vResponses[0].returnCode == KmdSysman::Success) { memcpy_s(&retValu32, sizeof(uint32_t), vResponses[0].dataBuffer, sizeof(uint32_t)); - pBandwidth->maxBandwidth = static_cast(retValu32) * static_cast(MbpsToBytesPerSecond); + pBandwidth->maxBandwidth = static_cast(retValu32) * static_cast(mbpsToBytesPerSecond); } pBandwidth->readCounter = 0; diff --git a/level_zero/sysman/source/api/pci/sysman_pci_imp.cpp b/level_zero/sysman/source/api/pci/sysman_pci_imp.cpp index 489f75d1af..6f8824a500 100644 --- a/level_zero/sysman/source/api/pci/sysman_pci_imp.cpp +++ b/level_zero/sysman/source/api/pci/sysman_pci_imp.cpp @@ -30,9 +30,9 @@ namespace Sysman { // int64_t convertPcieSpeedFromGTsToBs(double maxLinkSpeedInGt) { double pcieSpeedWithEnc; - if ((maxLinkSpeedInGt == PciLinkSpeeds::Pci32_0GigatransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::Pci16_0GigatransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::Pci8_0GigatransfersPerSecond)) { + if ((maxLinkSpeedInGt == PciLinkSpeeds::pci32GigaTransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::pci16GigaTransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::pci8GigaTransfersPerSecond)) { pcieSpeedWithEnc = maxLinkSpeedInGt * 1000 * 128 / 130; - } else if ((maxLinkSpeedInGt == PciLinkSpeeds::Pci5_0GigatransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::Pci2_5GigatransfersPerSecond)) { + } else if ((maxLinkSpeedInGt == PciLinkSpeeds::pci5GigaTransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::pci2Dot5GigaTransfersPerSecond)) { pcieSpeedWithEnc = maxLinkSpeedInGt * 1000 * 8 / 10; } else { pcieSpeedWithEnc = 0; @@ -50,19 +50,19 @@ int64_t convertPcieSpeedFromGTsToBs(double maxLinkSpeedInGt) { double convertPciGenToLinkSpeed(uint32_t gen) { switch (gen) { case PciGenerations::PciGen1: { - return PciLinkSpeeds::Pci2_5GigatransfersPerSecond; + return PciLinkSpeeds::pci2Dot5GigaTransfersPerSecond; } break; case PciGenerations::PciGen2: { - return PciLinkSpeeds::Pci5_0GigatransfersPerSecond; + return PciLinkSpeeds::pci5GigaTransfersPerSecond; } break; case PciGenerations::PciGen3: { - return PciLinkSpeeds::Pci8_0GigatransfersPerSecond; + return PciLinkSpeeds::pci8GigaTransfersPerSecond; } break; case PciGenerations::PciGen4: { - return PciLinkSpeeds::Pci16_0GigatransfersPerSecond; + return PciLinkSpeeds::pci16GigaTransfersPerSecond; } break; case PciGenerations::PciGen5: { - return PciLinkSpeeds::Pci32_0GigatransfersPerSecond; + return PciLinkSpeeds::pci32GigaTransfersPerSecond; } break; default: { return 0.0; @@ -71,15 +71,15 @@ double convertPciGenToLinkSpeed(uint32_t gen) { } int32_t convertLinkSpeedToPciGen(double speed) { - if (speed == PciLinkSpeeds::Pci2_5GigatransfersPerSecond) { + if (speed == PciLinkSpeeds::pci2Dot5GigaTransfersPerSecond) { return PciGenerations::PciGen1; - } else if (speed == PciLinkSpeeds::Pci5_0GigatransfersPerSecond) { + } else if (speed == PciLinkSpeeds::pci5GigaTransfersPerSecond) { return PciGenerations::PciGen2; - } else if (speed == PciLinkSpeeds::Pci8_0GigatransfersPerSecond) { + } else if (speed == PciLinkSpeeds::pci8GigaTransfersPerSecond) { return PciGenerations::PciGen3; - } else if (speed == PciLinkSpeeds::Pci16_0GigatransfersPerSecond) { + } else if (speed == PciLinkSpeeds::pci16GigaTransfersPerSecond) { return PciGenerations::PciGen4; - } else if (speed == PciLinkSpeeds::Pci32_0GigatransfersPerSecond) { + } else if (speed == PciLinkSpeeds::pci32GigaTransfersPerSecond) { return PciGenerations::PciGen5; } else { return -1; diff --git a/level_zero/sysman/source/sysman_const.h b/level_zero/sysman/source/sysman_const.h index 59d31993d0..180f3d9bcc 100644 --- a/level_zero/sysman/source/sysman_const.h +++ b/level_zero/sysman/source/sysman_const.h @@ -12,7 +12,7 @@ const std::string vendorIntel("Intel(R) Corporation"); const std::string unknown("unknown"); const std::string intelPciId("0x8086"); const std::string guid64BitMemoryCounters("0xb15a0ede"); -constexpr uint32_t MbpsToBytesPerSecond = 125000; +constexpr uint32_t mbpsToBytesPerSecond = 125000; constexpr double milliVoltsFactor = 1000.0; constexpr uint32_t maxRasErrorCategoryCount = 7; @@ -37,11 +37,11 @@ struct SteadyClock { } // namespace L0 namespace PciLinkSpeeds { -constexpr double Pci2_5GigatransfersPerSecond = 2.5; -constexpr double Pci5_0GigatransfersPerSecond = 5.0; -constexpr double Pci8_0GigatransfersPerSecond = 8.0; -constexpr double Pci16_0GigatransfersPerSecond = 16.0; -constexpr double Pci32_0GigatransfersPerSecond = 32.0; +constexpr double pci2Dot5GigaTransfersPerSecond = 2.5; +constexpr double pci5GigaTransfersPerSecond = 5.0; +constexpr double pci8GigaTransfersPerSecond = 8.0; +constexpr double pci16GigaTransfersPerSecond = 16.0; +constexpr double pci32GigaTransfersPerSecond = 32.0; } // namespace PciLinkSpeeds enum PciGenerations { diff --git a/level_zero/sysman/test/unit_tests/sources/memory/linux/test_sysman_memory_prelim.cpp b/level_zero/sysman/test/unit_tests/sources/memory/linux/test_sysman_memory_prelim.cpp index fb4f0cd859..c5f4ba0bc1 100644 --- a/level_zero/sysman/test/unit_tests/sources/memory/linux/test_sysman_memory_prelim.cpp +++ b/level_zero/sysman/test/unit_tests/sources/memory/linux/test_sysman_memory_prelim.cpp @@ -572,7 +572,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemo EXPECT_EQ(expectedReadCounters, bandwidth.readCounter); expectedWriteCounters = numberMcChannels * mockIdiWriteVal * transactionSize; EXPECT_EQ(expectedWriteCounters, bandwidth.writeCounter); - expectedBandwidth = mockMaxBwDg2 * MbpsToBytesPerSecond; + expectedBandwidth = mockMaxBwDg2 * mbpsToBytesPerSecond; EXPECT_EQ(expectedBandwidth, bandwidth.maxBandwidth); EXPECT_GT(bandwidth.timestamp, 0u); } diff --git a/level_zero/sysman/test/unit_tests/sources/memory/windows/test_zes_memory.cpp b/level_zero/sysman/test/unit_tests/sources/memory/windows/test_zes_memory.cpp index c8ffff54a4..c566faf23e 100644 --- a/level_zero/sysman/test/unit_tests/sources/memory/windows/test_zes_memory.cpp +++ b/level_zero/sysman/test/unit_tests/sources/memory/windows/test_zes_memory.cpp @@ -159,7 +159,7 @@ TEST_F(SysmanDeviceMemoryFixture, DISABLED_GivenValidMemoryHandleWhenGettingBand ze_result_t result = zesMemoryGetBandwidth(handle, &bandwidth); EXPECT_EQ(result, ZE_RESULT_SUCCESS); - EXPECT_EQ(bandwidth.maxBandwidth, pKmdSysManager->mockMemoryMaxBandwidth * MbpsToBytesPerSecond); + EXPECT_EQ(bandwidth.maxBandwidth, pKmdSysManager->mockMemoryMaxBandwidth * mbpsToBytesPerSecond); EXPECT_EQ(bandwidth.readCounter, pKmdSysManager->mockMemoryCurrentBandwidthRead); EXPECT_EQ(bandwidth.writeCounter, pKmdSysManager->mockMemoryCurrentBandwidthWrite); EXPECT_GT(bandwidth.timestamp, 0u); diff --git a/level_zero/sysman/test/unit_tests/sources/pci/linux/test_zes_pci.cpp b/level_zero/sysman/test/unit_tests/sources/pci/linux/test_zes_pci.cpp index 2ffec52e11..cf075cdf82 100644 --- a/level_zero/sysman/test/unit_tests/sources/pci/linux/test_zes_pci.cpp +++ b/level_zero/sysman/test/unit_tests/sources/pci/linux/test_zes_pci.cpp @@ -610,17 +610,17 @@ TEST_F(ZesPciFixture, WhenConvertingLinkSpeedThenResultIsCorrect) { // maxLinkSpeedInGt * (Gigabit to Megabit) * Encoding * (Mb/s to bytes/second) = // maxLinkSpeedInGt * convertGigabitToMegabit * Encoding * convertMegabitsPerSecondToBytesPerSecond; -TEST_F(ZesPciFixture, WhenConvertingLinkSpeedFromGigatransfersPerSecondToBytesPerSecondThenResultIsCorrect) { - int64_t speedPci320 = L0::Sysman::convertPcieSpeedFromGTsToBs(PciLinkSpeeds::Pci32_0GigatransfersPerSecond); - EXPECT_EQ(speedPci320, static_cast(PciLinkSpeeds::Pci32_0GigatransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); - int64_t speedPci160 = L0::Sysman::convertPcieSpeedFromGTsToBs(PciLinkSpeeds::Pci16_0GigatransfersPerSecond); - EXPECT_EQ(speedPci160, static_cast(PciLinkSpeeds::Pci16_0GigatransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); - int64_t speedPci80 = L0::Sysman::convertPcieSpeedFromGTsToBs(PciLinkSpeeds::Pci8_0GigatransfersPerSecond); - EXPECT_EQ(speedPci80, static_cast(PciLinkSpeeds::Pci8_0GigatransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); - int64_t speedPci50 = L0::Sysman::convertPcieSpeedFromGTsToBs(PciLinkSpeeds::Pci5_0GigatransfersPerSecond); - EXPECT_EQ(speedPci50, static_cast(PciLinkSpeeds::Pci5_0GigatransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen1Gen2)); - int64_t speedPci25 = L0::Sysman::convertPcieSpeedFromGTsToBs(PciLinkSpeeds::Pci2_5GigatransfersPerSecond); - EXPECT_EQ(speedPci25, static_cast(PciLinkSpeeds::Pci2_5GigatransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen1Gen2)); +TEST_F(ZesPciFixture, WhenConvertingLinkSpeedFromGigaTransfersPerSecondToBytesPerSecondThenResultIsCorrect) { + int64_t speedPci320 = L0::Sysman::convertPcieSpeedFromGTsToBs(PciLinkSpeeds::pci32GigaTransfersPerSecond); + EXPECT_EQ(speedPci320, static_cast(PciLinkSpeeds::pci32GigaTransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); + int64_t speedPci160 = L0::Sysman::convertPcieSpeedFromGTsToBs(PciLinkSpeeds::pci16GigaTransfersPerSecond); + EXPECT_EQ(speedPci160, static_cast(PciLinkSpeeds::pci16GigaTransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); + int64_t speedPci80 = L0::Sysman::convertPcieSpeedFromGTsToBs(PciLinkSpeeds::pci8GigaTransfersPerSecond); + EXPECT_EQ(speedPci80, static_cast(PciLinkSpeeds::pci8GigaTransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); + int64_t speedPci50 = L0::Sysman::convertPcieSpeedFromGTsToBs(PciLinkSpeeds::pci5GigaTransfersPerSecond); + EXPECT_EQ(speedPci50, static_cast(PciLinkSpeeds::pci5GigaTransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen1Gen2)); + int64_t speedPci25 = L0::Sysman::convertPcieSpeedFromGTsToBs(PciLinkSpeeds::pci2Dot5GigaTransfersPerSecond); + EXPECT_EQ(speedPci25, static_cast(PciLinkSpeeds::pci2Dot5GigaTransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen1Gen2)); EXPECT_EQ(0, L0::Sysman::convertPcieSpeedFromGTsToBs(0.0)); } diff --git a/level_zero/tools/source/sysman/memory/linux/os_memory_imp_prelim.cpp b/level_zero/tools/source/sysman/memory/linux/os_memory_imp_prelim.cpp index 40d2c02bc3..550b7660ad 100644 --- a/level_zero/tools/source/sysman/memory/linux/os_memory_imp_prelim.cpp +++ b/level_zero/tools/source/sysman/memory/linux/os_memory_imp_prelim.cpp @@ -198,7 +198,7 @@ ze_result_t LinuxMemoryImp::getBandwidthForDg2(zes_mem_bandwidth_t *pBandwidth) if (result != ZE_RESULT_SUCCESS) { NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s():pSysfsAccess->read returning error:0x%x \n", __FUNCTION__, result); } - pBandwidth->maxBandwidth = maxBw * MbpsToBytesPerSecond; + pBandwidth->maxBandwidth = maxBw * mbpsToBytesPerSecond; pBandwidth->timestamp = SysmanDevice::getSysmanTimestamp(); return ZE_RESULT_SUCCESS; } diff --git a/level_zero/tools/source/sysman/memory/windows/os_memory_imp.cpp b/level_zero/tools/source/sysman/memory/windows/os_memory_imp.cpp index 4e0c34ddd7..7312e4f379 100644 --- a/level_zero/tools/source/sysman/memory/windows/os_memory_imp.cpp +++ b/level_zero/tools/source/sysman/memory/windows/os_memory_imp.cpp @@ -197,7 +197,7 @@ ze_result_t WddmMemoryImp::getBandwidth(zes_mem_bandwidth_t *pBandwidth) { pBandwidth->maxBandwidth = 0; if (vResponses[0].returnCode == KmdSysman::Success) { memcpy_s(&retValu32, sizeof(uint32_t), vResponses[0].dataBuffer, sizeof(uint32_t)); - pBandwidth->maxBandwidth = static_cast(retValu32) * static_cast(MbpsToBytesPerSecond); + pBandwidth->maxBandwidth = static_cast(retValu32) * static_cast(mbpsToBytesPerSecond); } pBandwidth->readCounter = 0; diff --git a/level_zero/tools/source/sysman/pci/pci_imp.cpp b/level_zero/tools/source/sysman/pci/pci_imp.cpp index 3958677712..6562cb34bf 100644 --- a/level_zero/tools/source/sysman/pci/pci_imp.cpp +++ b/level_zero/tools/source/sysman/pci/pci_imp.cpp @@ -29,9 +29,9 @@ namespace L0 { // int64_t convertPcieSpeedFromGTsToBs(double maxLinkSpeedInGt) { double pcieSpeedWithEnc; - if ((maxLinkSpeedInGt == PciLinkSpeeds::Pci32_0GigatransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::Pci16_0GigatransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::Pci8_0GigatransfersPerSecond)) { + if ((maxLinkSpeedInGt == PciLinkSpeeds::pci32GigaTransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::pci16GigaTransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::pci8GigaTransfersPerSecond)) { pcieSpeedWithEnc = maxLinkSpeedInGt * 1000 * 128 / 130; - } else if ((maxLinkSpeedInGt == PciLinkSpeeds::Pci5_0GigatransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::Pci2_5GigatransfersPerSecond)) { + } else if ((maxLinkSpeedInGt == PciLinkSpeeds::pci5GigaTransfersPerSecond) || (maxLinkSpeedInGt == PciLinkSpeeds::pci2Dot5GigaTransfersPerSecond)) { pcieSpeedWithEnc = maxLinkSpeedInGt * 1000 * 8 / 10; } else { pcieSpeedWithEnc = 0; @@ -49,19 +49,19 @@ int64_t convertPcieSpeedFromGTsToBs(double maxLinkSpeedInGt) { double convertPciGenToLinkSpeed(uint32_t gen) { switch (gen) { case PciGenerations::PciGen1: { - return PciLinkSpeeds::Pci2_5GigatransfersPerSecond; + return PciLinkSpeeds::pci2Dot5GigaTransfersPerSecond; } break; case PciGenerations::PciGen2: { - return PciLinkSpeeds::Pci5_0GigatransfersPerSecond; + return PciLinkSpeeds::pci5GigaTransfersPerSecond; } break; case PciGenerations::PciGen3: { - return PciLinkSpeeds::Pci8_0GigatransfersPerSecond; + return PciLinkSpeeds::pci8GigaTransfersPerSecond; } break; case PciGenerations::PciGen4: { - return PciLinkSpeeds::Pci16_0GigatransfersPerSecond; + return PciLinkSpeeds::pci16GigaTransfersPerSecond; } break; case PciGenerations::PciGen5: { - return PciLinkSpeeds::Pci32_0GigatransfersPerSecond; + return PciLinkSpeeds::pci32GigaTransfersPerSecond; } break; default: { return 0.0; @@ -70,15 +70,15 @@ double convertPciGenToLinkSpeed(uint32_t gen) { } int32_t convertLinkSpeedToPciGen(double speed) { - if (speed == PciLinkSpeeds::Pci2_5GigatransfersPerSecond) { + if (speed == PciLinkSpeeds::pci2Dot5GigaTransfersPerSecond) { return PciGenerations::PciGen1; - } else if (speed == PciLinkSpeeds::Pci5_0GigatransfersPerSecond) { + } else if (speed == PciLinkSpeeds::pci5GigaTransfersPerSecond) { return PciGenerations::PciGen2; - } else if (speed == PciLinkSpeeds::Pci8_0GigatransfersPerSecond) { + } else if (speed == PciLinkSpeeds::pci8GigaTransfersPerSecond) { return PciGenerations::PciGen3; - } else if (speed == PciLinkSpeeds::Pci16_0GigatransfersPerSecond) { + } else if (speed == PciLinkSpeeds::pci16GigaTransfersPerSecond) { return PciGenerations::PciGen4; - } else if (speed == PciLinkSpeeds::Pci32_0GigatransfersPerSecond) { + } else if (speed == PciLinkSpeeds::pci32GigaTransfersPerSecond) { return PciGenerations::PciGen5; } else { return -1; diff --git a/level_zero/tools/source/sysman/sysman_const.h b/level_zero/tools/source/sysman/sysman_const.h index 57ea31ad8c..d1ee4004c2 100644 --- a/level_zero/tools/source/sysman/sysman_const.h +++ b/level_zero/tools/source/sysman/sysman_const.h @@ -12,7 +12,7 @@ const std::string vendorIntel("Intel(R) Corporation"); const std::string unknown("unknown"); const std::string intelPciId("0x8086"); const std::string guid64BitMemoryCounters("0xb15a0ede"); -constexpr uint32_t MbpsToBytesPerSecond = 125000; +constexpr uint32_t mbpsToBytesPerSecond = 125000; constexpr double milliVoltsFactor = 1000.0; constexpr uint32_t maxRasErrorCategoryCount = 7; namespace L0 { @@ -30,11 +30,11 @@ struct SteadyClock { } // namespace L0 namespace PciLinkSpeeds { -constexpr double Pci2_5GigatransfersPerSecond = 2.5; -constexpr double Pci5_0GigatransfersPerSecond = 5.0; -constexpr double Pci8_0GigatransfersPerSecond = 8.0; -constexpr double Pci16_0GigatransfersPerSecond = 16.0; -constexpr double Pci32_0GigatransfersPerSecond = 32.0; +constexpr double pci2Dot5GigaTransfersPerSecond = 2.5; +constexpr double pci5GigaTransfersPerSecond = 5.0; +constexpr double pci8GigaTransfersPerSecond = 8.0; +constexpr double pci16GigaTransfersPerSecond = 16.0; +constexpr double pci32GigaTransfersPerSecond = 32.0; } // namespace PciLinkSpeeds enum PciGenerations { diff --git a/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/test_sysman_memory_prelim.cpp b/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/test_sysman_memory_prelim.cpp index 6628afac06..026ddb0232 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/test_sysman_memory_prelim.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/test_sysman_memory_prelim.cpp @@ -764,7 +764,7 @@ TEST_F(SysmanDeviceMemoryFixture, GivenValidMemoryHandleWhenCallingzesSysmanMemo EXPECT_EQ(expectedReadCounters, bandwidth.readCounter); expectedWriteCounters = numberMcChannels * mockIdiWriteVal * transactionSize; EXPECT_EQ(expectedWriteCounters, bandwidth.writeCounter); - expectedBandwidth = mockMaxBwDg2 * MbpsToBytesPerSecond; + expectedBandwidth = mockMaxBwDg2 * mbpsToBytesPerSecond; EXPECT_EQ(expectedBandwidth, bandwidth.maxBandwidth); EXPECT_GT(bandwidth.timestamp, 0u); } diff --git a/level_zero/tools/test/unit_tests/sources/sysman/memory/windows/test_zes_memory.cpp b/level_zero/tools/test/unit_tests/sources/sysman/memory/windows/test_zes_memory.cpp index ba3b8b7542..8c20b4debf 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/memory/windows/test_zes_memory.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/memory/windows/test_zes_memory.cpp @@ -186,7 +186,7 @@ TEST_F(SysmanDeviceMemoryFixture, DISABLED_GivenValidMemoryHandleWhenGettingBand ze_result_t result = zesMemoryGetBandwidth(handle, &bandwidth); EXPECT_EQ(result, ZE_RESULT_SUCCESS); - EXPECT_EQ(bandwidth.maxBandwidth, pKmdSysManager->mockMemoryMaxBandwidth * MbpsToBytesPerSecond); + EXPECT_EQ(bandwidth.maxBandwidth, pKmdSysManager->mockMemoryMaxBandwidth * mbpsToBytesPerSecond); EXPECT_EQ(bandwidth.readCounter, pKmdSysManager->mockMemoryCurrentBandwidthRead); EXPECT_EQ(bandwidth.writeCounter, pKmdSysManager->mockMemoryCurrentBandwidthWrite); EXPECT_GT(bandwidth.timestamp, 0u); diff --git a/level_zero/tools/test/unit_tests/sources/sysman/pci/linux/test_zes_pci.cpp b/level_zero/tools/test/unit_tests/sources/sysman/pci/linux/test_zes_pci.cpp index e0b171d049..16e835bddd 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/pci/linux/test_zes_pci.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/pci/linux/test_zes_pci.cpp @@ -636,17 +636,17 @@ TEST_F(ZesPciFixture, WhenConvertingLinkSpeedThenResultIsCorrect) { // maxLinkSpeedInGt * (Gigabit to Megabit) * Encoding * (Mb/s to bytes/second) = // maxLinkSpeedInGt * convertGigabitToMegabit * Encoding * convertMegabitsPerSecondToBytesPerSecond; -TEST_F(ZesPciFixture, WhenConvertingLinkSpeedFromGigatransfersPerSecondToBytesPerSecondThenResultIsCorrect) { - int64_t speedPci320 = convertPcieSpeedFromGTsToBs(PciLinkSpeeds::Pci32_0GigatransfersPerSecond); - EXPECT_EQ(speedPci320, static_cast(PciLinkSpeeds::Pci32_0GigatransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); - int64_t speedPci160 = convertPcieSpeedFromGTsToBs(PciLinkSpeeds::Pci16_0GigatransfersPerSecond); - EXPECT_EQ(speedPci160, static_cast(PciLinkSpeeds::Pci16_0GigatransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); - int64_t speedPci80 = convertPcieSpeedFromGTsToBs(PciLinkSpeeds::Pci8_0GigatransfersPerSecond); - EXPECT_EQ(speedPci80, static_cast(PciLinkSpeeds::Pci8_0GigatransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); - int64_t speedPci50 = convertPcieSpeedFromGTsToBs(PciLinkSpeeds::Pci5_0GigatransfersPerSecond); - EXPECT_EQ(speedPci50, static_cast(PciLinkSpeeds::Pci5_0GigatransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen1Gen2)); - int64_t speedPci25 = convertPcieSpeedFromGTsToBs(PciLinkSpeeds::Pci2_5GigatransfersPerSecond); - EXPECT_EQ(speedPci25, static_cast(PciLinkSpeeds::Pci2_5GigatransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen1Gen2)); +TEST_F(ZesPciFixture, WhenConvertingLinkSpeedFromGigaTransfersPerSecondToBytesPerSecondThenResultIsCorrect) { + int64_t speedPci320 = convertPcieSpeedFromGTsToBs(PciLinkSpeeds::pci32GigaTransfersPerSecond); + EXPECT_EQ(speedPci320, static_cast(PciLinkSpeeds::pci32GigaTransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); + int64_t speedPci160 = convertPcieSpeedFromGTsToBs(PciLinkSpeeds::pci16GigaTransfersPerSecond); + EXPECT_EQ(speedPci160, static_cast(PciLinkSpeeds::pci16GigaTransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); + int64_t speedPci80 = convertPcieSpeedFromGTsToBs(PciLinkSpeeds::pci8GigaTransfersPerSecond); + EXPECT_EQ(speedPci80, static_cast(PciLinkSpeeds::pci8GigaTransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen3andAbove)); + int64_t speedPci50 = convertPcieSpeedFromGTsToBs(PciLinkSpeeds::pci5GigaTransfersPerSecond); + EXPECT_EQ(speedPci50, static_cast(PciLinkSpeeds::pci5GigaTransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen1Gen2)); + int64_t speedPci25 = convertPcieSpeedFromGTsToBs(PciLinkSpeeds::pci2Dot5GigaTransfersPerSecond); + EXPECT_EQ(speedPci25, static_cast(PciLinkSpeeds::pci2Dot5GigaTransfersPerSecond * convertMegabitsPerSecondToBytesPerSecond * convertGigabitToMegabit * encodingGen1Gen2)); EXPECT_EQ(0, convertPcieSpeedFromGTsToBs(0.0)); } TEST_F(SysmanDeviceFixture, GivenValidSysmanHandleWhenCallingzesSysmanPciGetStateThenVerifyzetSysmanPciGetStatsCallReturnNotSupported) {