|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
Singleton service managing frame metrics collection. More...
#include <frame_metrics.h>
Public Member Functions | |
| std::string | buildMangoHudLaunchConfigFile (const std::string &gameId, const std::string &userConfigFile={}) const |
| Materialise a complete MangoHud config file for a launch. | |
| int | cleanupOldLogs (int maxAgeHours=24) |
| Clean up old MangoHud log files. | |
| std::string | getMangoHudLoggingConfig () const |
| Get MangoHud config for enabling logging. | |
| FrameMetrics | getMetrics (const std::string &gameId) const |
| Get current metrics for a game. | |
| bool | isCollecting (const std::string &gameId) const |
| Check if collection is active for a game. | |
| bool | isGamescopeAvailable () const |
| Check if gamescope is available. | |
| bool | isMangoHudLoggingAvailable () const |
| Check if MangoHud logging is available. | |
| bool | startCollection (const std::string &gameId, int pid, bool useGamescope=false, bool enableMangoHudLogging=true) |
| Start collecting metrics for a game. | |
| void | stopAll () |
| Stop all active collections. | |
| void | stopCollection (const std::string &gameId) |
| Stop collecting metrics for a game. | |
Static Public Member Functions | |
| static FrameMetricsService & | instance () |
| Get the singleton instance. | |
Singleton service managing frame metrics collection.
Provides a unified interface for collecting frame metrics from running games. Automatically selects the best available source (gamescope > mangohud).
Usage:
Definition at line 432 of file frame_metrics.h.
| std::string FrameMetricsService::buildMangoHudLaunchConfigFile | ( | const std::string & | gameId, |
| const std::string & | userConfigFile = {} ) const |
Materialise a complete MangoHud config file for a launch.
Thin wrapper over MangoHudLogReader::buildLaunchConfigFile. Returns a path suitable for passing via MANGOHUD_CONFIGFILE, which fully replaces the user's ~/.config/MangoHud/MangoHud.conf during the launch.
| gameId | Identifier used to scope the file per-game |
| userConfigFile | Optional path to a user-provided MangoHud config |
Definition at line 1059 of file frame_metrics.cpp.
References MangoHudLogReader::buildLaunchConfigFile().
Referenced by anonymous_namespace{game_process.cpp}::buildWrapperChain().
| int FrameMetricsService::cleanupOldLogs | ( | int | maxAgeHours = 24 | ) |
Clean up old MangoHud log files.
| maxAgeHours | Delete completed logs older than this (default 24 hours) |
Deletes completed MangoHud log files (those with _summary.csv siblings) that are older than the specified age. Active logs are never deleted.
Definition at line 1065 of file frame_metrics.cpp.
References Logger::debug(), MangoHudLogReader::getDefaultLogDirectory(), Logger::info(), and Logger::warn().
Referenced by MainWindow::MainWindow().
| std::string FrameMetricsService::getMangoHudLoggingConfig | ( | ) | const |
Get MangoHud config for enabling logging.
Definition at line 1053 of file frame_metrics.cpp.
References MangoHudLogReader::getLoggingConfig().
| FrameMetrics FrameMetricsService::getMetrics | ( | const std::string & | gameId | ) | const |
Get current metrics for a game.
| gameId | Game identifier |
Definition at line 1016 of file frame_metrics.cpp.
Referenced by DetailsPanelManager::Impl::update(), and DetailsPanelManager::Impl::updateRunningInfo().
|
static |
Get the singleton instance.
Definition at line 931 of file frame_metrics.cpp.
References instance().
Referenced by MainWindow::MainWindow(), GameProcess::attachToRunningProcess(), anonymous_namespace{game_process.cpp}::buildWrapperChain(), instance(), GameProcess::launch(), GameProcessManager::launchGame(), GameProcess::stop(), DetailsPanelManager::Impl::update(), GameProcess::update(), and DetailsPanelManager::Impl::updateRunningInfo().
| bool FrameMetricsService::isCollecting | ( | const std::string & | gameId | ) | const |
Check if collection is active for a game.
| gameId | Game identifier |
Definition at line 1029 of file frame_metrics.cpp.
Referenced by DetailsPanelManager::Impl::update(), and DetailsPanelManager::Impl::updateRunningInfo().
| bool FrameMetricsService::isGamescopeAvailable | ( | ) | const |
Check if gamescope is available.
Definition at line 1037 of file frame_metrics.cpp.
| bool FrameMetricsService::isMangoHudLoggingAvailable | ( | ) | const |
Check if MangoHud logging is available.
Definition at line 1047 of file frame_metrics.cpp.
References MangoHudLogReader::isAvailable().
| bool FrameMetricsService::startCollection | ( | const std::string & | gameId, |
| int | pid, | ||
| bool | useGamescope = false, | ||
| bool | enableMangoHudLogging = true ) |
Start collecting metrics for a game.
| gameId | Unique game identifier |
| pid | Process ID of the game |
| useGamescope | True if game is running through gamescope |
| enableMangoHudLogging | True to enable MangoHud logging config |
Definition at line 944 of file frame_metrics.cpp.
References Logger::debug(), and Logger::info().
Referenced by GameProcess::launch(), and GameProcessManager::launchGame().
| void FrameMetricsService::stopAll | ( | ) |
Stop all active collections.
Definition at line 1005 of file frame_metrics.cpp.
| void FrameMetricsService::stopCollection | ( | const std::string & | gameId | ) |
Stop collecting metrics for a game.
| gameId | Game identifier to stop |
Definition at line 992 of file frame_metrics.cpp.
References Logger::debug().
Referenced by GameProcess::stop(), and GameProcess::update().