Userspace Resource Manager
Loading...
Searching...
No Matches
Utils.h
Go to the documentation of this file.
1// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2// SPDX-License-Identifier: BSD-3-Clause-Clear
3
8#ifndef UTILS_H
9#define UTILS_H
10
11#include <string>
12
13#include "ErrCodes.h"
14
19enum ModuleID : int8_t {
20 MOD_RESTUNE,
21 MOD_CLASSIFIER,
22};
23
29 REQ_RESOURCE_TUNING,
30 REQ_RESOURCE_RETUNING,
31 REQ_RESOURCE_UNTUNING,
32 REQ_PROP_GET,
33 REQ_SIGNAL_TUNING,
34 REQ_SIGNAL_UNTUNING,
35 REQ_SIGNAL_RELAY
36};
37
48
56 SYSTEM_HIGH = 0, // Highest Level of Priority
57 SYSTEM_LOW,
58 THIRD_PARTY_HIGH,
59 THIRD_PARTY_LOW,
60 TOTAL_PRIORITIES
61};
62
76
77enum TranslationUnit {
78 U_NA = 1,
79 U_BYTE = 1,
80 U_KB = 1024,
81 U_MB = 1024 * 1024,
82 U_GB = 1024 * 1024 * 1024,
83 U_Hz = 1,
84 U_KHz = 1000,
85 U_MHz = 1000 * 1000,
86 U_GHz = 1000 * 1000 * 1000,
87};
88
89typedef struct {
90 int8_t mModuleID;
91 int8_t mRequestType;
92 uint64_t mBufferSize;
93 int64_t mHandle;
94 char* mBuffer;
95} MsgForwardInfo;
96
97typedef struct {
98 std::string mPropName;
99 std::string mResult;
100 uint64_t mBufferSize;
101} PropConfig;
102
103// Anywhere better ??
104typedef struct {
105 pid_t mPid;
106 uint32_t mSigId;
107 uint32_t mSigSubtype;
108} PostProcessCBData;
109
110// Global Typedefs: Declare Function Pointers as types
111typedef ErrCode (*EventCallback)(void*);
112typedef int8_t (*ServerOnlineCheckCallback)();
113typedef void (*MessageReceivedCallback)(int32_t, MsgForwardInfo*);
114
115#define HIGH_TRANSFER_PRIORITY -1
116#define SERVER_CLEANUP_TRIGGER_PRIORITY -2
117
118// Config Names
119#define COMMON_RESOURCE "Common-Resource"
120#define CUSTOM_RESOURCE "Custom-Resource"
121#define COMMON_PROPERTIES "Common-Properties"
122#define CUSTOM_PROPERTIES "Custom-Properties"
123#define CUSTOM_TARGET "Custom-Target"
124#define COMMON_INIT "Common-Init"
125#define CUSTOM_INIT "Custom-Init"
126#define COMMON_SIGNAL "Common-Signal"
127#define CUSTOM_SIGNAL "Custom-Signal"
128#define CUSTOM_EXT_FEATURE "Ext-Features"
129#define CUSTOM_APP_CONF "App-Config"
130
131// System Properties
132#define MAX_CONCURRENT_REQUESTS "resource_tuner.maximum.concurrent.requests"
133#define MAX_RESOURCES_PER_REQUEST "resource_tuner.maximum.resources.per.request"
134#define PULSE_MONITOR_DURATION "resource_tuner.pulse.duration"
135#define GARBAGE_COLLECTOR_DURATION "resource_tuner.garbage_collection.duration"
136#define GARBAGE_COLLECTOR_BATCH_SIZE "resource_tuner.garbage_collection.batch_size"
137#define RATE_LIMITER_DELTA "resource_tuner.rate_limiter.delta"
138#define RATE_LIMITER_PENALTY_FACTOR "resource_tuner.penalty.factor"
139#define RATE_LIMITER_REWARD_FACTOR "resource_tuner.reward.factor"
140#define LOGGER_LOGGING_LEVEL "urm.logging.level"
141#define LOGGER_LOGGING_LEVEL_TYPE "urm.logging.level.exact"
142#define LOGGER_LOGGING_OUTPUT_REDIRECT "urm.logging.redirect_to"
143
144#endif
ErrCode
Custom Error Codes used by Resource Tuner APIs and Internal Functions.
Definition ErrCodes.h:19
PriorityLevel
Resource Tuner Priority Levels.
Definition Utils.h:55
Permissions
Certain resources can be accessed only by system clients and some which have no such restrictions and...
Definition Utils.h:43
@ NUMBER_PERMISSIONS
Total number of permissions currently supported.
Definition Utils.h:46
@ PERMISSION_THIRD_PARTY
Third party clients. Default value.
Definition Utils.h:45
@ PERMISSION_SYSTEM
Special permission level for system clients.
Definition Utils.h:44
Policy
Different Resource Policies supported by Resource Tuner.
Definition Utils.h:69
@ HIGHER_BETTER
This policy first applies the request writing the highest value to the node.
Definition Utils.h:71
@ LAZY_APPLY
The requests are applied in a first-in-first-out manner.
Definition Utils.h:73
@ INSTANT_APPLY
This policy is for resources where the latest request needs to be honored.
Definition Utils.h:70
@ LOWER_BETTER
Self-explanatory. Works exactly opposite of the higher is better policy.
Definition Utils.h:72
RequestType
Enumeration for different types of Resource-Tuner Requests.
Definition Utils.h:28