Userspace Resource Manager
Loading...
Searching...
No Matches
Plugin.cpp

Sample Usage of Resource Tuner's Extension APIs.

Sample Usage of Resource Tuner's Extension APIs.This files covers examples of the following APIs:

  • URM_REGISTER_RES_APPLIER_CB
  • URM_REGISTER_CONFIG
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
// SPDX-License-Identifier: BSD-3-Clause
#include "Extensions.h"
void customApplyCB(void* context) {
// Actual Processing
}
void customTearCB(void* context) {
// Actual Processing
}
__attribute__((constructor))
void registerWithUrm() {
// Associate the callback (handler) to the desired Resource (ResCode).
URM_REGISTER_RES_APPLIER_CB(0x00030000, customApplyCB);
URM_REGISTER_RES_TEAR_CB(0x00040a22, customTearCB);
}
/*
* Compilation Notes:
* To build the above code, it needs to be linked with UrmExtAPIs lib exposed by Resource Tuner,
* and built as a shared lib:
* => Create the shared lib:
* "g++ -fPIC -shared -o libplugin.so Plugin.cpp -lExtAPIs"
* This creates a shared lib, libplugin.so
* => Copy this lib to "/etc/urm/custom", the location where Resource Tuner expects
* the custom Extensions lib to be placed.
* => Make sure the lib file has appropriate permissions:
* "sudo chmod o+r /etc/urm/custom/libplugin.so"
*/