Userspace Resource Manager
Loading...
Searching...
No Matches
CoreAPIsExamples.c
1// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2// SPDX-License-Identifier: BSD-3-Clause
3
9
10#include <stdio.h>
11#include <stdlib.h>
12
13#include <Urm/UrmAPIs.h>
14
15#define UCLAMP_MIN_RES 0x00030000
16#define UCLAMP_BOOST_VAL 750
17#define TUNE_DURATION 5000 #duration in msec
18#define FAIL -1
19
20static void tune_uclamp_min() {
21 int32_t properties = 0;
22
23 properties = SET_REQUEST_PRIORITY(properties, REQ_PRIORITY_LOW);
24 properties = ADD_ALLOWED_MODE(properties, MODE_SUSPEND);
25
26 SysResource resourceList[] = {
27 {
28 .mResCode = UCLAMP_MIN_RES,
29 .mResInfo = 0,
30 .mOptionalInfo = 0,
31 .mNumValues = 1,
32 .mResValue = {
33 .value = UCLAMP_BOOST_VAL,
34 }
35 }
36 };
37
38 int64_t handle = tuneResources(TUNE_DURATION, properties, 1, resourceList);
39 if(handle == FAIL) {
40 printf("Request Could not be Sent to the Resource Tuner Server\n");
41 } else {
42 printf("Handle Returned is: %ld\n", handle);
43 }
44}
45
46// Similary other ResourceTuner APIs can be used as well by C-based programs.
47
48int32_t main(int32_t argc, char* argv[]) {
49 tune_uclamp_min();
50}
51
52// Compilation Notes:
53// The executable needs to be linked to the RestuneClient lib, where these APIs
54// are defined. This can be done, as follows:
55// GCC: gcc ResourceTunerCoreAPIs.c -o ResourceTunerCoreAPIs -lClientAPIs
56// CMake: This can be done as part of the C/C++ project by adding the Library
57// to the target link libraries. For example, if the executalbe is called clientExec,
58// it can be linked as follows:
59// target_link_libraries(clientExec RestuneClient)
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 ...