#include <iostream>
#include <ResourceTuner/ResourceTunerAPIs.h>
#define UCLAMP_MIN_RES 0x00030000
#define UCLAMP_BOOST_VAL 750
#define TUNE_DURATION 5000
#define FAIL -1
void func1() {
int64_t duration = 5000;
int32_t properties = 0;
properties = SET_REQUEST_PRIORITY(properties, REQ_PRIORITY_LOW);
{
.mResInfo = 0,
.mOptionalInfo = 0,
.mNumValues = 1,
.mResValue = {
.value = UCLAMP_BOOST_VAL,
}
}
};
int64_t handle =
tuneResources(duration, properties, 1, resourceList);
if(handle == -1) {
std::cout<<"Request Could not be Sent to the Resource Tuner Server"<<std::endl;
} else {
std::cout<<"Handle Returned is: "<<handle<<std::endl;
}
}
void func2() {
int64_t duration = -1;
int32_t properties = 0;
properties = SET_REQUEST_PRIORITY(properties, REQ_PRIORITY_HIGH);
properties = ADD_ALLOWED_MODE(properties, MODE_RESUME);
properties = ADD_ALLOWED_MODE(properties, MODE_SUSPEND);
int64_t handle =
tuneResources(duration, properties, 1, resourceList);
if(handle == -1) {
std::cout<<"Tune Request could not be sent to the Resource Tuner Server"<<std::endl;
return;
} else {
std::cout<<"Handle Returned is: "<<handle<<std::endl;
}
if(status == -1) {
std::cout<<"Untune Request could not be sent to the Resource Tuner Server"<<std::endl;
}
}
void func3() {
int64_t duration = 8000;
int32_t properties = 0;
properties = SET_REQUEST_PRIORITY(properties, REQ_PRIORITY_HIGH);
properties = ADD_ALLOWED_MODE(properties, MODE_RESUME);
int64_t handle =
tuneResources(duration, properties, 1, resourceList);
if(handle == -1) {
std::cout<<"Tune Request could not be sent to the Resource Tuner Server"<<std::endl;
return;
} else {
std::cout<<"Handle Returned is: "<<handle<<std::endl;
}
int64_t newDuration = 20000;
if(status == -1) {
std::cout<<"Untune Request could not be sent to the Resource Tuner Server"<<std::endl;
}
}
int32_t main(int32_t argc, char* argv[]) {
func1();
}
int64_t tuneResources(int64_t duration, int32_t prop, int32_t numRes, SysResource *resourceList)
Tune Resource Values for finite or finite duration.
int8_t retuneResources(int64_t handle, int64_t duration)
Modify the duration of a previously issued Tune Request.
int8_t untuneResources(int64_t handle)
Release (or free) the Request with the given handle.
Used to store information regarding Resources / Tunables which need to be Provisioned as part of the ...
int32_t value
Use this field for single Valued Resources.
uint32_t mResCode
A uniqued 32-bit (unsigned) identifier for the Resource.
int32_t mNumValues
Number of values to be configured for the Resource, both single-valued and multi-valued Resources are...
int32_t mResInfo
Holds Logical Core and Cluster Information:
int32_t mOptionalInfo
Field to hold optional information for Request Processing.
union SysResource::@0 mResValue
The value to be Configured for this Resource Node.