summaryrefslogtreecommitdiff
path: root/lang/intel-compute-runtime/files/patch-no-perf
blob: 94690df93378431d1987bf1b68de3c549b668d5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Limit PMU counters to Linux

In file included from level_zero/tools/source/sysman/linux/os_sysman_imp.cpp:8:
In file included from level_zero/tools/source/sysman/linux/os_sysman_imp.h:16:
level_zero/tools/source/sysman/linux/pmu/pmu_imp.h:12:10: fatal error: 'linux/perf_event.h' file not found
#include <linux/perf_event.h>
         ^~~~~~~~~~~~~~~~~~~~

--- level_zero/tools/source/sysman/engine/linux/os_engine_imp.cpp.orig	2021-03-24 20:23:19 UTC
+++ level_zero/tools/source/sysman/engine/linux/os_engine_imp.cpp
@@ -49,9 +49,11 @@ ze_result_t LinuxEngineImp::getActivity(zes_engine_sta
         return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
     }
     uint64_t data[2] = {};
+#ifdef __linux__
     if (pPmuInterface->pmuRead(static_cast<int>(fd), data, sizeof(data)) < 0) {
         return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
     }
+#endif
     // In data[], First u64 is "active time", And second u64 is "timestamp". Both in nanoseconds
     pStats->activeTime = data[0] / microSecondsToNanoSeconds;
     pStats->timestamp = data[1] / microSecondsToNanoSeconds;
@@ -66,9 +68,11 @@ ze_result_t LinuxEngineImp::getProperties(zes_engine_p
 }
 
 void LinuxEngineImp::init() {
+#ifdef __linux
     auto i915EngineClass = engineToI915Map.find(engineGroup);
     // I915_PMU_ENGINE_BUSY macro provides the perf type config which we want to listen to get the engine busyness.
     fd = pPmuInterface->pmuInterfaceOpen(I915_PMU_ENGINE_BUSY(i915EngineClass->second, engineInstance), -1, PERF_FORMAT_TOTAL_TIME_ENABLED);
+#endif
 }
 
 LinuxEngineImp::LinuxEngineImp(OsSysman *pOsSysman, zes_engine_group_t type, uint32_t engineInstance) : engineGroup(type), engineInstance(engineInstance) {
--- level_zero/tools/source/sysman/linux/os_sysman_imp.cpp.orig	2021-02-08 19:32:47 UTC
+++ level_zero/tools/source/sysman/linux/os_sysman_imp.cpp
@@ -42,8 +42,10 @@ ze_result_t LinuxSysmanImp::init() {
     auto rootPciPathOfGpuDevice = getPciRootPortDirectoryPath(realRootPath);
     PlatformMonitoringTech::create(pParentSysmanDeviceImp->deviceHandles, pFsAccess, rootPciPathOfGpuDevice, mapOfSubDeviceIdToPmtObject);
 
+#ifdef __linux__
     pPmuInterface = PmuInterface::create(this);
     UNRECOVERABLE_IF(nullptr == pPmuInterface);
+#endif
 
     return ZE_RESULT_SUCCESS;
 }
--- level_zero/tools/source/sysman/linux/os_sysman_imp.h.orig	2021-02-08 19:32:47 UTC
+++ level_zero/tools/source/sysman/linux/os_sysman_imp.h
@@ -14,7 +14,9 @@
 #include "level_zero/tools/source/sysman/linux/firmware_util/firmware_util.h"
 #include "level_zero/tools/source/sysman/linux/fs_access.h"
 #include "level_zero/tools/source/sysman/linux/pmt/pmt.h"
+#ifdef __linux__
 #include "level_zero/tools/source/sysman/linux/pmu/pmu_imp.h"
+#endif
 #include "level_zero/tools/source/sysman/linux/xml_parser/xml_parser.h"
 #include "level_zero/tools/source/sysman/sysman_imp.h"
 
--- level_zero/tools/source/sysman/linux/pmu/CMakeLists.txt.orig	2020-09-11 07:53:58 UTC
+++ level_zero/tools/source/sysman/linux/pmu/CMakeLists.txt
@@ -9,7 +9,7 @@ set(L0_SRCS_TOOLS_SYSMAN_LINUX_PMU
     ${CMAKE_CURRENT_SOURCE_DIR}/pmu_imp.h
     ${CMAKE_CURRENT_SOURCE_DIR}/pmu.h
 )
-if(UNIX)
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
   target_sources(${L0_STATIC_LIB_NAME}
                  PRIVATE
                  ${L0_SRCS_TOOLS_SYSMAN_LINUX_PMU}