Resource Tuner
Loading...
Searching...
No Matches
ConfigProcessor.h
1// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2// SPDX-License-Identifier: BSD-3-Clause-Clear
3
4#ifndef SERVER_CONFIG_PROCESSOR_H
5#define SERVER_CONFIG_PROCESSOR_H
6
7#include <string>
8#include <vector>
9#include <stack>
10#include <fstream>
11#include <memory>
12#include <sstream>
13#include <cerrno>
14#include <stdexcept>
15
16#include "YamlParser.h"
17#include "Logger.h"
18#include "ResourceRegistry.h"
19#include "PropertiesRegistry.h"
20#include "TargetRegistry.h"
21#include "Utils.h"
22#include "AuxRoutines.h"
23
24// Resource Config
25#define RESOURCE_CONFIGS_ROOT "ResourceConfigs"
26#define RESOURCE_CONFIGS_ELEM_RESOURCE_TYPE "ResType"
27#define RESOURCE_CONFIGS_ELEM_RESOURCE_ID "ResID"
28#define RESOURCE_CONFIGS_ELEM_RESOURCENAME "Name"
29#define RESOURCE_CONFIGS_ELEM_RESOURCEPATH "Path"
30#define RESOURCE_CONFIGS_ELEM_SUPPORTED "Supported"
31#define RESOURCE_CONFIGS_ELEM_HIGHTHRESHOLD "HighThreshold"
32#define RESOURCE_CONFIGS_ELEM_LOWTHRESHOLD "LowThreshold"
33#define RESOURCE_CONFIGS_ELEM_PERMISSIONS "Permissions"
34#define RESOURCE_CONFIGS_ELEM_MODES "Modes"
35#define RESOURCE_CONFIGS_ELEM_POLICY "Policy"
36#define RESOURCE_CONFIGS_ELEM_APPLY_TYPE "ApplyType"
37
38// Target Info Config
39#define TARGET_CONFIGS_ROOT "TargetConfig"
40#define TARGET_NAME_LIST "TargetName"
41#define TARGET_CLUSTER_INFO "ClusterInfo"
42#define TARGET_CLUSTER_INFO_LOGICAL_ID "LgcId"
43#define TARGET_CLUSTER_INFO_PHYSICAL_ID "PhyId"
44#define TARGET_CLUSTER_SPREAD "ClusterSpread"
45#define TARGET_PER_CLUSTER_CORE_COUNT "NumCores"
46
47// CGroup Config
48#define INIT_CONFIGS_ROOT "InitConfigs"
49#define INIT_CONFIGS_ELEM_CGROUPS_LIST "CgroupsInfo"
50#define INIT_CONFIGS_ELEM_CGROUP_NAME "Name"
51#define INIT_CONFIGS_ELEM_CGROUP_IDENTIFIER "ID"
52#define INIT_CONFIGS_ELEM_CGROUP_CREATION "Create"
53#define INIT_CONFIGS_ELEM_CGROUP_THREADED "IsThreaded"
54
55// Cluster Map
56#define INIT_CONFIGS_ELEM_CLUSTER_MAP "ClusterMap"
57#define INIT_CONFIGS_ELEM_CLUSTER_MAP_CLUSTER_ID "Id"
58#define INIT_CONFIGS_ELEM_CLUSTER_MAP_CLUSTER_TYPE "Type"
59
60// Mpam Config
61#define INIT_CONFIGS_ELEM_MPAM_GROUPS_LIST "MPAMgroupsInfo"
62#define INIT_CONFIGS_ELEM_MPAM_GROUP_NAME "Name"
63#define INIT_CONFIGS_ELEM_MPAM_GROUP_ID "ID"
64#define INIT_CONFIGS_ELEM_MPAM_GROUP_PRIORITY "Priority"
65
66// Cache Info
67#define INIT_CONFIGS_ELEM_CACHE_INFO_LIST "CacheInfo"
68#define INIT_CONFIGS_ELEM_CACHE_INFO_TYPE "Type"
69#define INIT_CONFIGS_ELEM_CACHE_INFO_BLK_CNT "NumCacheBlocks"
70#define INIT_CONFIGS_ELEM_CACHE_INFO_PRIO_AWARE "PriorityAware"
71
72// Properties
73#define PROPERTY_CONFIGS_ROOT "PropertyConfigs"
74#define PROPERTY_CONFIGS_ELEM_NAME "Name"
75#define PROPERTY_CONFIGS_ELEM_VALUE "Value"
76
221private:
222 ErrCode parseResourceConfigYamlNode(const std::string& filePath, int8_t isBuSpecified);
223 ErrCode parsePropertiesConfigYamlNode(const std::string& filePath);
224 ErrCode parseInitConfigYamlNode(const std::string& filePath);
225 ErrCode parseTargetConfigYamlNode(const std::string& filePath);
226
227public:
228 ErrCode parseResourceConfigs(const std::string& filePath, int8_t isBuSpecified=false);
229 ErrCode parsePropertiesConfigs(const std::string& filePath);
230 ErrCode parseInitConfigs(const std::string& filePath);
231 ErrCode parseTargetConfigs(const std::string& filePath);
232 ErrCode parse(ConfigType configType, const std::string& filePath, int8_t isBuSpecified=false);
233};
234
235#endif
ErrCode
Custom Error Codes used by Resource Tuner APIs and Internal Functions.
Definition ErrCodes.h:17
ConfigType
Different Config (via YAML) Types supported.
Definition Extensions.h:23
ConfigProcessor.