Userspace Resource Manager
Loading...
Searching...
No Matches
Plugin.cpp
1// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2// SPDX-License-Identifier: BSD-3-Clause
3
12
13#include "Extensions.h"
14
15void customApplyCB(void* context) {
16 // Actual Processing
17}
18
19void customTearCB(void* context) {
20 // Actual Processing
21}
22
23__attribute__((constructor))
24void registerWithUrm() {
25 // Associate the callback (handler) to the desired Resource (ResCode).
26 URM_REGISTER_RES_APPLIER_CB(0x00030000, customApplyCB);
27 URM_REGISTER_RES_TEAR_CB(0x00040a22, customTearCB);
28}
29
30/*
31 * Compilation Notes:
32 * To build the above code, it needs to be linked with UrmExtAPIs lib exposed by Resource Tuner,
33 * and built as a shared lib:
34 * => Create the shared lib:
35 * "g++ -fPIC -shared -o libplugin.so Plugin.cpp -lExtAPIs"
36 * This creates a shared lib, libplugin.so
37 * => Copy this lib to "/etc/urm/custom", the location where Resource Tuner expects
38 * the custom Extensions lib to be placed.
39 * => Make sure the lib file has appropriate permissions:
40 * "sudo chmod o+r /etc/urm/custom/libplugin.so"
41 */