Resource Tuner
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 <cstdint>
12#include <string>
13
14#include "ErrCodes.h"
15
21 REQ_RESOURCE_TUNING,
22 REQ_RESOURCE_RETUNING,
23 REQ_RESOURCE_UNTUNING,
24 REQ_PROP_GET,
25 REQ_SIGNAL_TUNING,
26 REQ_SIGNAL_UNTUNING,
27 REQ_SIGNAL_RELAY
28};
29
40
48 SYSTEM_HIGH = 0, // Highest Level of Priority
49 SYSTEM_LOW,
50 THIRD_PARTY_HIGH,
51 THIRD_PARTY_LOW,
52 TOTAL_PRIORITIES
53};
54
67
68typedef struct {
69 char* buffer;
70 uint64_t bufferSize;
71 int64_t handle;
72} MsgForwardInfo;
73
74typedef struct {
75 std::string mPropName;
76 std::string mResult;
77 uint64_t mBufferSize;
78} PropConfig;
79
80// Global Typedefs: Declare Function Pointers as types
81typedef ErrCode (*EventCallback)(void*);
82typedef int8_t (*ServerOnlineCheckCallback)();
83typedef void (*ResourceTunerMessageReceivedCallback)(int32_t, MsgForwardInfo*);
84
85#define HIGH_TRANSFER_PRIORITY -1
86#define SERVER_CLEANUP_TRIGGER_PRIORITY -2
87
88// Config Names
89#define COMMON_RESOURCE "Common-Resource"
90#define CUSTOM_RESOURCE "Custom-Resource"
91#define COMMON_PROPERTIES "Common-Properties"
92#define CUSTOM_PROPERTIES "Custom-Properties"
93#define CUSTOM_TARGET "Custom-Target"
94#define COMMON_INIT "Common-Init"
95#define CUSTOM_INIT "Custom-Init"
96#define COMMON_SIGNAL "Common-Signal"
97#define CUSTOM_SIGNAL "Custom-Signal"
98#define CUSTOM_EXT_FEATURE "Ext-Features"
99
100// System Properties
101#define MAX_CONCURRENT_REQUESTS "resource_tuner.maximum.concurrent.requests"
102#define MAX_RESOURCES_PER_REQUEST "resource_tuner.maximum.resources.per.request"
103#define PULSE_MONITOR_DURATION "resource_tuner.pulse.duration"
104#define GARBAGE_COLLECTOR_DURATION "resource_tuner.garbage_collection.duration"
105#define GARBAGE_COLLECTOR_BATCH_SIZE "resource_tuner.garbage_collection.batch_size"
106#define RATE_LIMITER_DELTA "resource_tuner.rate_limiter.delta"
107#define RATE_LIMITER_PENALTY_FACTOR "resource_tuner.penalty.factor"
108#define RATE_LIMITER_REWARD_FACTOR "resource_tuner.reward.factor"
109#define LOGGER_LOGGING_LEVEL "resource_tuner.logging.level"
110#define LOGGER_LOGGING_LEVEL_TYPE "resource_tuner.logging.level.exact"
111#define LOGGER_LOGGING_OUTPUT_REDIRECT "resource_tuner.logging.redirect_to"
112
113#endif
ErrCode
Custom Error Codes used by Resource Tuner APIs and Internal Functions.
Definition ErrCodes.h:17
PriorityLevel
Resource Tuner Priority Levels.
Definition Utils.h:47
Permissions
Certain resources can be accessed only by system clients and some which have no such restrictions and...
Definition Utils.h:35
@ NUMBER_PERMISSIONS
Total number of permissions currently supported.
Definition Utils.h:38
@ PERMISSION_THIRD_PARTY
Third party clients. Default value.
Definition Utils.h:37
@ PERMISSION_SYSTEM
Special permission level for system clients.
Definition Utils.h:36
Policy
Different Resource Policies supported by Resource Tuner.
Definition Utils.h:61
@ HIGHER_BETTER
This policy first applies the request writing the highest value to the node.
Definition Utils.h:63
@ LAZY_APPLY
The requests are applied in a first-in-first-out manner.
Definition Utils.h:65
@ INSTANT_APPLY
This policy is for resources where the latest request needs to be honored.
Definition Utils.h:62
@ LOWER_BETTER
Self-explanatory. Works exactly opposite of the higher is better policy.
Definition Utils.h:64
RequestType
Enumeration for different types of Resource-Tuner Requests.
Definition Utils.h:20