Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/modula)
add_subdirectory(${CMAKE_SOURCE_DIR}/client)
add_subdirectory(${CMAKE_SOURCE_DIR}/extensions)

if(BUILD_TESTS OR BUILD_CLASSIFIER)
add_compile_definitions(ENABLE_TEST_VISIBILITY)
message(STATUS "Internal Visibility Enabled (Required for Tests or Classifier)")
endif()

# resource-tuner is a mandatory build
add_subdirectory(${CMAKE_SOURCE_DIR}/resource-tuner)

Expand Down
2 changes: 2 additions & 0 deletions resource-tuner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ else()
endif()

add_library(RestuneCore ${SOURCES})
target_compile_options(RestuneCore PRIVATE -fvisibility=hidden)

set_target_properties(RestuneCore PROPERTIES VERSION 1.0.0 SOVERSION 1)
target_link_libraries(RestuneCore PUBLIC ${LINK_LIBS})

Expand Down
4 changes: 3 additions & 1 deletion resource-tuner/core/Include/ClientDataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "Logger.h"
#include "Utils.h"

#include "RestuneVisibility.h"

#define PER_CLIENT_TID_CAP 32

typedef struct _client_info {
Expand All @@ -48,7 +50,7 @@ typedef struct {
* - Essentially ClientDataManager is a central storage for Client Data, and other Components
* like RateLimiter, PulseMonitor and RequestManager are clients of the ClientDataManager.
*/
class ClientDataManager {
class RESTUNE_INTERNAL_EXPORT ClientDataManager {
private:
static std::shared_ptr<ClientDataManager> mClientDataManagerInstance;
static std::mutex instanceProtectionLock;
Expand Down
4 changes: 2 additions & 2 deletions resource-tuner/core/Include/ClientGarbageCollector.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class ClientGarbageCollector {
}
};

ErrCode startClientGarbageCollectorDaemon();
void stopClientGarbageCollectorDaemon();
__attribute__((visibility("default"))) ErrCode startClientGarbageCollectorDaemon();
__attribute__((visibility("default"))) void stopClientGarbageCollectorDaemon();

#endif

Expand Down
2 changes: 1 addition & 1 deletion resource-tuner/core/Include/CocoTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
* The actual resource applier, teardown callbacks are invoked through
* the CocoTable.
*/
class CocoTable {
class __attribute__((visibility("default"))) CocoTable {
private:
static std::shared_ptr<CocoTable> mCocoTableInstance;
static std::mutex instanceProtectionLock;
Expand Down
4 changes: 3 additions & 1 deletion resource-tuner/core/Include/PropertiesRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
#include <memory>
#include <shared_mutex>

#include "RestuneVisibility.h"

/**
* @brief PropertiesRegistry
* @details Stores and manages all the properties parsed from the Properties Config files.
*/
class PropertiesRegistry {
class RESTUNE_INTERNAL_EXPORT PropertiesRegistry {
private:
static std::shared_ptr<PropertiesRegistry> propRegistryInstance;
std::unordered_map<std::string, std::string> mProperties;
Expand Down
4 changes: 2 additions & 2 deletions resource-tuner/core/Include/PulseMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class PulseMonitor {
}
};

ErrCode startPulseMonitorDaemon();
void stopPulseMonitorDaemon();
__attribute__((visibility("default"))) ErrCode startPulseMonitorDaemon();
__attribute__((visibility("default"))) void stopPulseMonitorDaemon();

#endif

Expand Down
4 changes: 3 additions & 1 deletion resource-tuner/core/Include/RateLimiter.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
// SPDX-License-Identifier: BSD-3-Clause-Clear

Expand Down Expand Up @@ -31,11 +32,12 @@
#include "ClientDataManager.h"
#include "UrmSettings.h"

#include "RestuneVisibility.h"
/**
* @brief RateLimiter
* @details Responsible for Tracking Client Behaviour, and Protect against System Abuse.
*/
class RateLimiter {
class RESTUNE_INTERNAL_EXPORT RateLimiter {
private:
static std::shared_ptr<RateLimiter> mRateLimiterInstance;
static std::mutex instanceProtectionLock;
Expand Down
2 changes: 1 addition & 1 deletion resource-tuner/core/Include/RequestQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @details It stores the pointer to the Requests and compares their priorities. The server thread picks up
* these requests in the order of their priorities and processes them.
*/
class RequestQueue : public OrderedQueue {
class __attribute__((visibility("default"))) RequestQueue : public OrderedQueue {
private:
static std::shared_ptr<RequestQueue> mRequestQueueInstance;
static std::mutex instanceProtectionLock;
Expand Down
2 changes: 1 addition & 1 deletion resource-tuner/core/Include/ResourceRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ typedef struct {
* @details Stores information Relating to all the Resources available for Tuning.
* Note: This information is extracted from Config YAML files.
*/
class ResourceRegistry {
class __attribute__((visibility("default"))) ResourceRegistry {
private:
static std::shared_ptr<ResourceRegistry> resourceRegistryInstance;
int32_t mTotalResources;
Expand Down
2 changes: 1 addition & 1 deletion resource-tuner/core/Include/RestuneInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void submitResProvisionRequest(Request* request, int8_t isVerified);

size_t submitPropGetRequest(void* request, std::string& result);

size_t submitPropGetRequest(const std::string& propName, std::string& result, const std::string& defVal);
__attribute__((visibility("default"))) size_t submitPropGetRequest(const std::string& propName, std::string& result, const std::string& defVal);

ErrCode translateToPhysicalIDs(Resource* resource);

Expand Down
13 changes: 13 additions & 0 deletions resource-tuner/core/Include/RestuneVisibility.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef RESTUNE_VISIBILITY_H
#define RESTUNE_VISIBILITY_H

// If we are building tests, we force these symbols to be visible (default)
#if defined(ENABLE_TEST_VISIBILITY)
#define RESTUNE_INTERNAL_EXPORT __attribute__((visibility("default")))

// If we are building for production (and not testing), we hide them
#else
#define RESTUNE_INTERNAL_EXPORT __attribute__((visibility("hidden")))
#endif

#endif // RESTUNE_VISIBILITY_H
2 changes: 1 addition & 1 deletion resource-tuner/core/Include/TargetRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ typedef struct {
* @details Stores all the target related info, fetched dynamically or provided
* statically via Target and Init Config files.
*/
class TargetRegistry {
class __attribute__((visibility("default"))) TargetRegistry {
private:
static std::shared_ptr<TargetRegistry> targetRegistryInstance;

Expand Down
4 changes: 2 additions & 2 deletions resource-tuner/core/Server/Include/RequestReceiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* appropriate module, using that module's registered callback.
* Note, the callback is invoked on a separate thread (taken from the ThreadPool)
*/
class RequestReceiver {
class __attribute__((visibility("default"))) RequestReceiver {
private:
static std::shared_ptr<RequestReceiver> mRequestReceiverInstance;

Expand All @@ -43,6 +43,6 @@ class RequestReceiver {
}
};

void listenerThreadStartRoutine();
__attribute__((visibility("default"))) void listenerThreadStartRoutine();

#endif
2 changes: 1 addition & 1 deletion resource-tuner/init/Include/RestuneParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
* Note, this class uses the YamlParser class for actually Reading and
* Parsing the YAML data.
*/
class RestuneParser {
class __attribute__((visibility("default"))) RestuneParser {
private:
ErrCode parseResourceConfigYamlNode(const std::string& filePath);
ErrCode parsePropertiesConfigYamlNode(const std::string& filePath);
Expand Down
4 changes: 3 additions & 1 deletion resource-tuner/signals/Include/AppConfigs.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "UrmPlatformAL.h"
#include "ErrCodes.h"

#include "RestuneVisibility.h"

typedef struct {
std::string mAppName;
int32_t mNumThreads;
Expand All @@ -22,7 +24,7 @@ typedef struct {
uint32_t* mSignalCodes;
} AppConfig;

class AppConfigs {
class RESTUNE_INTERNAL_EXPORT AppConfigs {
private:
static std::shared_ptr<AppConfigs> appConfigRegistryInstance;
std::unordered_map<std::string, AppConfig*> mAppConfig;
Expand Down
2 changes: 1 addition & 1 deletion resource-tuner/signals/Include/ExtFeaturesRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef void (*RelayFeature)(uint32_t, const std::string&, const std::string&, i
* @details Stores information Relating to all the Ext Features registered with resource-tuner.
* Note: This information is extracted from Config YAML files.
*/
class ExtFeaturesRegistry {
class __attribute__((visibility("default"))) ExtFeaturesRegistry {
private:
static std::shared_ptr<ExtFeaturesRegistry> extFeaturesRegistryInstance;
int32_t mTotalExtFeatures;
Expand Down
4 changes: 3 additions & 1 deletion resource-tuner/signals/Include/SignalRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "MemoryPool.h"
#include "UrmSettings.h"

#include "RestuneVisibility.h"

/**
* @struct SignalInfo
* @brief Representation of a single Signal Configuration
Expand Down Expand Up @@ -68,7 +70,7 @@ typedef struct {
* @details Stores information Relating to all the Signals available for Tuning.
* Note: This information is extracted from Config YAML files.
*/
class SignalRegistry {
class RESTUNE_INTERNAL_EXPORT SignalRegistry {
private:
static std::shared_ptr<SignalRegistry> signalRegistryInstance;

Expand Down