Skip to content

Commit 9bb6251

Browse files
Enable Linux performance counters.
Change-Id: I688d3669d1791081074626ef474ab1edbc018034
1 parent 9cc493e commit 9bb6251

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

runtime/os_interface/linux/hw_info_config.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include "runtime/os_interface/linux/drm_neo.h"
1818
#include "runtime/os_interface/linux/os_interface.h"
1919

20+
#include "instrumentation.h"
21+
2022
#include <cstring>
2123

2224
namespace NEO {
@@ -145,7 +147,7 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou
145147
hwHelper.adjustDefaultEngineType(outHwInfo);
146148
outHwInfo->capabilityTable.defaultEngineType = getChosenEngineType(*outHwInfo);
147149

148-
outHwInfo->capabilityTable.instrumentationEnabled = false;
150+
outHwInfo->capabilityTable.instrumentationEnabled &= haveInstrumentation;
149151
outHwInfo->capabilityTable.ftrRenderCompressedBuffers = false;
150152
outHwInfo->capabilityTable.ftrRenderCompressedImages = false;
151153

unit_tests/fixtures/device_instrumentation_fixture.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
namespace NEO {
1414
void DeviceInstrumentationFixture::SetUp(bool instrumentation) {
1515
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
16-
if (instrumentation)
17-
hwInfo->capabilityTable.instrumentationEnabled = true;
16+
hwInfo->capabilityTable.instrumentationEnabled = instrumentation;
1817
device = std::unique_ptr<Device>(Device::create<Device>(executionEnvironment, 0));
1918
}
2019
} // namespace NEO

unit_tests/os_interface/linux/hw_info_config_linux_tests.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,3 +379,17 @@ TEST_F(HwInfoConfigTestLinuxDummy, givenPointerToHwInfoWhenConfigureHwInfoCalled
379379
EXPECT_EQ(0, ret);
380380
EXPECT_EQ(outHwInfo.gtSystemInfo.CsrSizeInMb * MemoryConstants::megaByte, outHwInfo.capabilityTable.requiredPreemptionSurfaceSize);
381381
}
382+
383+
TEST_F(HwInfoConfigTestLinuxDummy, givenInstrumentationForHardwareIsEnabledOrDisabledWhenConfiguringHwInfoThenOverrideItUsingHaveInstrumentation) {
384+
int ret;
385+
386+
pInHwInfo.capabilityTable.instrumentationEnabled = false;
387+
ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
388+
ASSERT_EQ(0, ret);
389+
EXPECT_FALSE(outHwInfo.capabilityTable.instrumentationEnabled);
390+
391+
pInHwInfo.capabilityTable.instrumentationEnabled = true;
392+
ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
393+
ASSERT_EQ(0, ret);
394+
EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled == haveInstrumentation);
395+
}

0 commit comments

Comments
 (0)