Resource Tuner APIs can be integrated and called as part of a C-based program as well. This file provides an example of using the APIs with C.
Resource Tuner APIs can be integrated and called as part of a C-based program as well. This file provides an example of using the APIs with C.
#include <stdio.h>
#include <stdlib.h>
#include <ResourceTuner/ResourceTunerAPIs.h>
#define UCLAMP_MIN_RES 0x00030000
#define UCLAMP_BOOST_VAL 750
#define TUNE_DURATION 5000 #duration in msec
#define FAIL -1
static void tune_uclamp_min() {
int32_t properties = 0;
properties = SET_REQUEST_PRIORITY(properties, REQ_PRIORITY_LOW);
properties = ADD_ALLOWED_MODE(properties, MODE_SUSPEND);
{
.mResInfo = 0,
.mOptionalInfo = 0,
.mNumValues = 1,
.mResValue = {
.value = UCLAMP_BOOST_VAL,
}
}
};
int64_t handle =
tuneResources(TUNE_DURATION, properties, 1, resourceList);
if(handle == FAIL) {
printf("Request Could not be Sent to the Resource Tuner Server\n");
} else {
printf("Handle Returned is: %ld\n", handle);
}
}
int32_t main(int32_t argc, char* argv[]) {
tune_uclamp_min();
}
int64_t tuneResources(int64_t duration, int32_t prop, int32_t numRes, SysResource *resourceList)
Tune Resource Values for finite or finite duration.
Used to store information regarding Resources / Tunables which need to be Provisioned as part of the ...
uint32_t mResCode
A uniqued 32-bit (unsigned) identifier for the Resource.