Skip to content

Commit e4aa8b0

Browse files
authored
Add option to fetch cluster mask with max capacity (#195)
--- Signed-off-by: Kartik Nema <kartnema@qti.qualcomm.com>
1 parent ae2f28e commit e4aa8b0

8 files changed

Lines changed: 22 additions & 10 deletions

File tree

modula/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ list(APPEND HEADER_FILES
2626
${CMAKE_CURRENT_SOURCE_DIR}/Common/Include/Utils.h
2727
${CMAKE_CURRENT_SOURCE_DIR}/Components/Include/Logger.h
2828
${CMAKE_CURRENT_SOURCE_DIR}/Components/Include/DLManager.h
29+
${CMAKE_CURRENT_SOURCE_DIR}/Components/Include/SafeOps.h
30+
${CMAKE_CURRENT_SOURCE_DIR}/Components/Include/ClientEndpoint.h
31+
${CMAKE_CURRENT_SOURCE_DIR}/CoreModules/Include/AuxRoutines.h
32+
${CMAKE_CURRENT_SOURCE_DIR}/CoreModules/Include/UrmSettings.h
2933
)
3034

3135
install(

modula/CoreModules/Include/AuxRoutines.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <mutex>
88
#include <queue>
9+
#include <memory>
910
#include <string>
1011
#include <cstring>
1112
#include <sstream>
@@ -17,10 +18,9 @@
1718
#include <unordered_set>
1819

1920
#include "Logger.h"
20-
#include "Signal.h"
21-
#include "Request.h"
22-
#include "UrmSettings.h"
2321
#include "ClientEndpoint.h"
22+
#include "UrmSettings.h"
23+
#include "SafeOps.h"
2424

2525
class AuxRoutines {
2626
private:

modula/CoreModules/Include/UrmSettings.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#include <unordered_map>
88

99
#include "ErrCodes.h"
10-
#include "MemoryPool.h"
11-
#include "SafeOps.h"
1210
#include "Utils.h"
1311

1412
#define URM_IDENTIFIER "urm"

resource-tuner/core/Include/TargetRegistry.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,19 @@
2222

2323
#include "Logger.h"
2424
#include "ErrCodes.h"
25-
#include "UrmSettings.h"
2625
#include "AuxRoutines.h"
27-
#include "RestuneDBus.h"
2826

2927
#define POLICY_DIR_PATH "/sys/devices/system/cpu/cpufreq/"
3028
#define ONLINE_CPU_FILE_PATH "/sys/devices/system/cpu/online"
3129
#define CPU_CAPACITY_FILE_PATH "/sys/devices/system/cpu/cpu%d/cpu_capacity"
3230

3331
enum TargetQueries {
34-
GET_MASK,
32+
GET_MASK = 801,
3533
GET_CLUSTER_COUNT,
3634
GET_CORE_COUNT,
3735
GET_PHYSICAL_CLUSTER_ID,
3836
GET_PHYSICAL_CORE_ID,
37+
GET_MAX_CLUSTER,
3938
};
4039

4140
/**

resource-tuner/core/TargetRegistry.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
22
// SPDX-License-Identifier: BSD-3-Clause-Clear
33
#include "TargetRegistry.h"
4+
#include "UrmSettings.h"
5+
#include "RestuneDBus.h"
46

57
// Create all the CGroups specified via InitConfig.yaml during the init phase.
68
static ErrCode createCGroup(CGroupConfigInfo* cGroupConfig) {
@@ -831,8 +833,13 @@ uint64_t getTargetInfo(int32_t option,
831833

832834
int32_t cluster = args[0];
833835
int32_t coreCount = args[1];
834-
int32_t physicalClusterId = targetRegistry->getPhysicalClusterId(cluster);
835836

837+
if(cluster == GET_MAX_CLUSTER) {
838+
int32_t clusterCount = UrmSettings::targetConfigs.mTotalClusterCount;
839+
cluster = clusterCount - 1;
840+
}
841+
842+
int32_t physicalClusterId = targetRegistry->getPhysicalClusterId(cluster);
836843
ClusterInfo* clusInfo = targetRegistry->getClusterInfo(physicalClusterId);
837844
if(clusInfo == nullptr) {
838845
return 0;

resource-tuner/init/RestuneInit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static ErrCode fetchTargetInfo() {
287287
for(int32_t i = 0; i < 4; i++) {
288288
std::string filePath = customConfPaths[i];
289289
if(filePath.length() > 0 && AuxRoutines::fileExists(filePath)) {
290-
opStatus = parseUtil(filePath, "target-custom", ConfigType::RESOURCE_CONFIG);
290+
opStatus = parseUtil(filePath, "target-custom", ConfigType::TARGET_CONFIG);
291291
if(RC_IS_NOTOK(opStatus)) {
292292
return opStatus;
293293
}

tests/Component/ClientDataManagerTests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
22
// SPDX-License-Identifier: BSD-3-Clause-Clear
33

4+
#include <thread>
5+
46
#include "ErrCodes.h"
57
#include "TestUtils.h"
68
#include "AuxRoutines.h"

tests/Integration/IntegrationTests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
22
// SPDX-License-Identifier: BSD-3-Clause-Clear
33

4+
#include <thread>
5+
46
#include "ErrCodes.h"
57
#include "UrmPlatformAL.h"
68
#include "Utils.h"

0 commit comments

Comments
 (0)