memory_advice::MemoryAdviceImpl

Summary

Constructors and Destructors

MemoryAdviceImpl(const char *params, IMetricsProvider *metrics_provider, IPredictor *realtime_predictor, IPredictor *available_predictor)

Public functions

BaseTests()
int32_t
Perform basic checking.
GenerateBaselineMetrics()
Json::object
Reads the baseline part of the advisor_parameters_ and reports metrics for those fields.
GenerateConstantMetrics()
Json::object
Reads the constant part of the advisor_parameters_ and reports metrics for those fields.
GenerateVariableMetrics()
Json::object
Reads the variable part of the advisor_parameters_ and reports metrics for those fields.
GetAdvice()
Json::object
Creates an advice object by reading variable metrics and feeding them into the provided machine learning model.
GetAvailableMemory()
int64_t
Evaluates information from the current metrics and returns an estimate for how much more memory is available, in bytes.
GetMemoryState()
Evaluates information from the current metrics and returns a memory state.
GetPercentageAvailableMemory()
float
Evaluates information from the current metrics and returns an estimate for how much more memory is available, as a percentage of the total memory.
GetTotalMemory()
int64_t
Returns the total memory of the device, as reported by ActivityManager::getMemoryInfo()
InitializationErrorCode() const
RegisterWatcher(uint64_t intervalMillis, MemoryAdvice_WatcherCallback callback, void *user_data)
Register watcher callback.
UnregisterWatcher(MemoryAdvice_WatcherCallback callback)
Unregister watcher callback.

Public functions

BaseTests

int32_t BaseTests()

Perform basic checking.

GenerateBaselineMetrics

Json::object GenerateBaselineMetrics()

Reads the baseline part of the advisor_parameters_ and reports metrics for those fields.

GenerateConstantMetrics

Json::object GenerateConstantMetrics()

Reads the constant part of the advisor_parameters_ and reports metrics for those fields.

GenerateVariableMetrics

Json::object GenerateVariableMetrics()

Reads the variable part of the advisor_parameters_ and reports metrics for those fields.

GetAdvice

Json::object GetAdvice()

Creates an advice object by reading variable metrics and feeding them into the provided machine learning model.

GetAvailableMemory

int64_t GetAvailableMemory()

Evaluates information from the current metrics and returns an estimate for how much more memory is available, in bytes.

GetMemoryState

MemoryAdvice_MemoryState GetMemoryState()

Evaluates information from the current metrics and returns a memory state.

GetPercentageAvailableMemory

float GetPercentageAvailableMemory()

Evaluates information from the current metrics and returns an estimate for how much more memory is available, as a percentage of the total memory.

GetTotalMemory

int64_t GetTotalMemory()

Returns the total memory of the device, as reported by ActivityManager::getMemoryInfo()

InitializationErrorCode

MemoryAdvice_ErrorCode InitializationErrorCode() const 

MemoryAdviceImpl

 MemoryAdviceImpl(
  const char *params,
  IMetricsProvider *metrics_provider,
  IPredictor *realtime_predictor,
  IPredictor *available_predictor
)

RegisterWatcher

MemoryAdvice_ErrorCode RegisterWatcher(
  uint64_t intervalMillis,
  MemoryAdvice_WatcherCallback callback,
  void *user_data
)

Register watcher callback.

UnregisterWatcher

MemoryAdvice_ErrorCode UnregisterWatcher(
  MemoryAdvice_WatcherCallback callback
)

Unregister watcher callback.