tuned-switcher 1.1.0
Performance profile manager
Loading...
Searching...
No Matches
TunedManager Class Reference

#include <tunedmanager.h>

Inheritance diagram for TunedManager:
Collaboration diagram for TunedManager:

Public Types

enum class  ServiceMethod { MethodEnable , MethodDisable , MethodReload , MethodShutdown }
 

Signals

void ProfileChangedSignal (const QString &, const bool, const QString &)
 

Public Member Functions

 TunedManager (QObject *parent=nullptr)
 
QString GetActiveProfile () const
 
QStringList GetAvailableProfiles () const
 
QTunedProfileList GetAvailableProfiles2 () const
 
QTunedProfileMode GetProfileMode () const
 
bool IsProfileModeAuto () const
 
bool IsProfileRunning () const
 
bool IsProfileEmpty () const
 
QTunedResult SetProfileModeAuto () const
 
QTunedResult SetActiveProfile (const QString &) const
 
bool IsRunning () const
 
bool Enable () const
 
bool Disable () const
 
bool Reload () const
 
bool Shutdown () const
 
bool RunServiceMethod (const ServiceMethod) const
 

Private Slots

void ProfileChangedEvent (const QString &, const bool, const QString &)
 

Private Attributes

const QString TunedBusName = QStringLiteral("com.redhat.tuned")
 
const QString TunedBusPath = QStringLiteral("/Tuned")
 
const QString TunedBusInterface = QStringLiteral("com.redhat.tuned.control")
 
const QString TunedBusMethodNameActiveProfile = QStringLiteral("active_profile")
 
const QString TunedBusMethodNameProfiles = QStringLiteral("profiles")
 
const QString TunedBusMethodNameSwitchProfile = QStringLiteral("switch_profile")
 
const QString TunedBusMethodNameProfileMode = QStringLiteral("profile_mode")
 
const QString TunedBusMethodNameAutoProfile = QStringLiteral("auto_profile")
 
const QString TunedBusSignalNameProfileChanged = QStringLiteral("profile_changed")
 
const QString TunedBusMethodNameProfiles2 = QStringLiteral("profiles2")
 
const QString TunedBusMethodNameIsRunning = QStringLiteral("is_running")
 
const QString TunedBusMethodNameStart = QStringLiteral("start")
 
const QString TunedBusMethodNameStop = QStringLiteral("stop")
 
const QString TunedBusMethodNameReload = QStringLiteral("reload")
 
const QString TunedBusMethodNameDisable = QStringLiteral("disable")
 
const QString TunedBusValueAutoProfile = QStringLiteral("auto")
 
QDBusConnection DBusInstance = QDBusConnection::systemBus()
 

Detailed Description

Class for working with the Tuned service.

Member Enumeration Documentation

◆ ServiceMethod

enum class TunedManager::ServiceMethod
strong

Enum with IDs of service methods, used by various methods.

Constructor & Destructor Documentation

◆ TunedManager()

TunedManager::TunedManager ( QObject * parent = nullptr)
explicit

Main constructor of the TunedManager class.

Parameters
parentParent.

Member Function Documentation

◆ Disable()

bool TunedManager::Disable ( ) const

Disable the Tuned service.

Returns
Result of current operation.
Return values
trueTuned was successfully disabled.
falseAn error occurred when trying to disable the Tuned service.

◆ Enable()

bool TunedManager::Enable ( ) const

Enable the Tuned service.

Returns
Result of current operation.
Return values
trueTuned was successfully enabled.
falseAn error occurred when trying to enable the Tuned service.

◆ GetActiveProfile()

QString TunedManager::GetActiveProfile ( ) const

Get active Tuned profile.

Returns
Active Tuned profile.

◆ GetAvailableProfiles()

QStringList TunedManager::GetAvailableProfiles ( ) const

Get the list of available Tuned profiles.

Returns
Available Tuned profiles.

◆ GetAvailableProfiles2()

QTunedProfileList TunedManager::GetAvailableProfiles2 ( ) const

Get the list of available Tuned profiles with additional useful information like profile descriptions.

Returns
Available Tuned profiles.

◆ GetProfileMode()

QTunedProfileMode TunedManager::GetProfileMode ( ) const

Get current Tuned mode: manual or auto.

Returns
Current Tuned mode.

◆ IsProfileEmpty()

bool TunedManager::IsProfileEmpty ( ) const

Check whether the Tuned profile is empty.

Returns
Whether the Tuned profile is empty.
Return values
trueThe Tuned profile is empty.
falseThe Tuned profile is not empty.

◆ IsProfileModeAuto()

bool TunedManager::IsProfileModeAuto ( ) const

Check if the Tuned is working in automatic mode.

Returns
Automatic mode on/off.
Return values
trueTuned is working in automatic mode.
falseTuned is working in manual mode.

◆ IsProfileRunning()

bool TunedManager::IsProfileRunning ( ) const

Check whether the Tuned profile is running.

Returns
Whether the Tuned profile is running.
Return values
trueThe Tuned profile is running.
falseThe Tuned profile is not running.

◆ IsRunning()

bool TunedManager::IsRunning ( ) const

Check whether the Tuned service is running.

Returns
Whether the Tuned sevice is running.
Return values
trueThe Tuned sevice is running.
falseThe Tuned sevice is not running.

◆ ProfileChangedEvent

void TunedManager::ProfileChangedEvent ( const QString & NewProfile,
const bool SwitchResult,
const QString & ResultMessage )
privateslot

Tuned profile changed event slot.

Parameters
NewProfileRecently switched profile name.
SwitchResultSwitch result: true - success; false - failure.
ResultMessageResult message (OK on success).

◆ ProfileChangedSignal

void TunedManager::ProfileChangedSignal ( const QString & ,
const bool ,
const QString &  )
signal

Tuned profile changed event signal.

◆ Reload()

bool TunedManager::Reload ( ) const

Reload the Tuned service configuration.

Returns
Result of current operation.
Return values
trueTuned service configuration was reloaded.
falseAn error occurred when trying to reload the Tuned service configuration.

◆ RunServiceMethod()

bool TunedManager::RunServiceMethod ( const ServiceMethod method) const

Run the specified service control method.

Parameters
methodService control method name.
Returns
Result of the requested service control operation.
Return values
trueThe requested service control operation completed successfully.
falseAn error occurred when trying to perform the requested operation.

◆ SetActiveProfile()

QTunedResult TunedManager::SetActiveProfile ( const QString & Profile) const

Switch Tuned to the the specified profile.

Parameters
ProfileNew Tuned profile name.
Returns
Result of current operation.

◆ SetProfileModeAuto()

QTunedResult TunedManager::SetProfileModeAuto ( ) const

Switch Tuned to automatic mode.

Returns
Result of current operation.

◆ Shutdown()

bool TunedManager::Shutdown ( ) const

Shutdown the Tuned service and disable all configurations.

Returns
Result of current operation.
Return values
trueTuned service configuration was shut down and configurations disabled.
falseAn error occurred when trying to shut down the Tuned service and disable configurations.

Member Data Documentation

◆ DBusInstance

QDBusConnection TunedManager::DBusInstance = QDBusConnection::systemBus()
private

Stores DBus instance.

◆ TunedBusInterface

const QString TunedManager::TunedBusInterface = QStringLiteral("com.redhat.tuned.control")
private

Stores the Tuned DBus interface.

◆ TunedBusMethodNameActiveProfile

const QString TunedManager::TunedBusMethodNameActiveProfile = QStringLiteral("active_profile")
private

Stores the Tuned DBus ActiveProfile method name.

◆ TunedBusMethodNameAutoProfile

const QString TunedManager::TunedBusMethodNameAutoProfile = QStringLiteral("auto_profile")
private

Stores the Tuned DBus AutoProfile method name.

◆ TunedBusMethodNameDisable

const QString TunedManager::TunedBusMethodNameDisable = QStringLiteral("disable")
private

Stores the Tuned DBus Disable method name.

◆ TunedBusMethodNameIsRunning

const QString TunedManager::TunedBusMethodNameIsRunning = QStringLiteral("is_running")
private

Stores the Tuned DBus IsRunning method name.

◆ TunedBusMethodNameProfileMode

const QString TunedManager::TunedBusMethodNameProfileMode = QStringLiteral("profile_mode")
private

Stores the Tuned DBus SetProfileMode method name.

◆ TunedBusMethodNameProfiles

const QString TunedManager::TunedBusMethodNameProfiles = QStringLiteral("profiles")
private

Stores the Tuned DBus AvailableProfiles method name.

◆ TunedBusMethodNameProfiles2

const QString TunedManager::TunedBusMethodNameProfiles2 = QStringLiteral("profiles2")
private

Stores the Tuned DBus AvailableProfiles2 method name.

◆ TunedBusMethodNameReload

const QString TunedManager::TunedBusMethodNameReload = QStringLiteral("reload")
private

Stores the Tuned DBus Reload method name.

◆ TunedBusMethodNameStart

const QString TunedManager::TunedBusMethodNameStart = QStringLiteral("start")
private

Stores the Tuned DBus Start method name.

◆ TunedBusMethodNameStop

const QString TunedManager::TunedBusMethodNameStop = QStringLiteral("stop")
private

Stores the Tuned DBus Stop method name.

◆ TunedBusMethodNameSwitchProfile

const QString TunedManager::TunedBusMethodNameSwitchProfile = QStringLiteral("switch_profile")
private

Stores the Tuned DBus SwitchProfile method name.

◆ TunedBusName

const QString TunedManager::TunedBusName = QStringLiteral("com.redhat.tuned")
private

Stores the Tuned DBus interface name.

◆ TunedBusPath

const QString TunedManager::TunedBusPath = QStringLiteral("/Tuned")
private

Stores the Tuned DBus object path.

◆ TunedBusSignalNameProfileChanged

const QString TunedManager::TunedBusSignalNameProfileChanged = QStringLiteral("profile_changed")
private

Stores the Tuned DBus ProfileChanged signal name.

◆ TunedBusValueAutoProfile

const QString TunedManager::TunedBusValueAutoProfile = QStringLiteral("auto")
private

Stores the Tuned DBus AutoProfile value.


The documentation for this class was generated from the following files: