|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
Reads frame metrics from MangoHud CSV log files. More...
#include <frame_metrics.h>
Public Member Functions | |
| MangoHudLogReader () | |
| ~MangoHudLogReader () override | |
| FrameMetrics | getMetrics () const override |
| Get the latest metrics. | |
| std::string | getSourceName () const override |
| Get the source name for this reader. | |
| bool | isActive () const override |
| Check if reader is actively collecting. | |
| bool | isAvailable () const override |
| Check if this reader is available on the system. | |
| void | setLogDirectory (const std::string &path) |
| Set the log directory to monitor. | |
| bool | start (int pid) override |
| Start collecting metrics for a process. | |
| void | stop () override |
| Stop collecting metrics. | |
| Public Member Functions inherited from IFrameMetricsReader | |
| virtual | ~IFrameMetricsReader ()=default |
Static Public Member Functions | |
| static std::string | buildLaunchConfigFile (const std::string &gameId, const std::string &userConfigFile={}) |
| Materialise a complete MangoHud config file for a launch. | |
| static std::string | getDefaultLogDirectory () |
| Get the default log directory. | |
| static std::string | getLoggingConfig () |
| Get the MangoHud config string for logging. | |
Reads frame metrics from MangoHud CSV log files.
MangoHud can log metrics to CSV files. This reader tails the log file and parses the latest entries for frame timing data.
Requires MangoHud to be launched with logging enabled: MANGOHUD_CONFIG="output_folder=/tmp/gamelauncher,autostart_log=1"
This is a fallback when gamescope is not being used.
Definition at line 316 of file frame_metrics.h.
| MangoHudLogReader::MangoHudLogReader | ( | ) |
Definition at line 282 of file frame_metrics.cpp.
References getDefaultLogDirectory().
|
override |
Definition at line 288 of file frame_metrics.cpp.
References stop().
|
static |
Materialise a complete MangoHud config file for a launch.
Writes our logging keys (output_folder/autostart_log/log_duration/ log_interval) to a file under the log directory. If userConfigFile is non-empty and exists, its contents are copied first so the user's overlay layout / display options are preserved; our logging keys are appended last and therefore win because parseConfigLine in MangoHud's src/config.cpp simply overwrites earlier values in the options map.
The returned path is intended to be passed via MANGOHUD_CONFIGFILE, which causes MangoHud's parseConfigFile (src/config.cpp) to skip enumerate_config_files and load only this file — fully isolating us from the user's ~/.config/MangoHud/MangoHud.conf (which goverlay 1.7.5 may populate with a competing log_duration).
| gameId | Identifier used to scope the file per-game |
| userConfigFile | Optional path to a user-provided MangoHud config |
Definition at line 392 of file frame_metrics.cpp.
References getDefaultLogDirectory(), and Logger::warn().
Referenced by FrameMetricsService::buildMangoHudLaunchConfigFile().
|
static |
Get the default log directory.
Definition at line 295 of file frame_metrics.cpp.
References core::SettingsController::readIsolateMangoHudLogsFromDisk(), and start().
Referenced by MangoHudLogReader(), buildLaunchConfigFile(), FrameMetricsService::cleanupOldLogs(), and getLoggingConfig().
|
static |
Get the MangoHud config string for logging.
Definition at line 373 of file frame_metrics.cpp.
References getDefaultLogDirectory().
Referenced by FrameMetricsService::getMangoHudLoggingConfig().
|
overridevirtual |
Get the latest metrics.
Implements IFrameMetricsReader.
Definition at line 812 of file frame_metrics.cpp.
|
inlineoverridevirtual |
Get the source name for this reader.
Implements IFrameMetricsReader.
Definition at line 326 of file frame_metrics.h.
|
overridevirtual |
Check if reader is actively collecting.
Implements IFrameMetricsReader.
Definition at line 807 of file frame_metrics.cpp.
|
overridevirtual |
Check if this reader is available on the system.
Implements IFrameMetricsReader.
Definition at line 511 of file frame_metrics.cpp.
Referenced by FrameMetricsService::isMangoHudLoggingAvailable().
| void MangoHudLogReader::setLogDirectory | ( | const std::string & | path | ) |
Set the log directory to monitor.
| path | Directory path where MangoHud writes logs |
Definition at line 505 of file frame_metrics.cpp.
|
overridevirtual |
Start collecting metrics for a process.
| pid | Process ID of the game |
Implements IFrameMetricsReader.
Definition at line 769 of file frame_metrics.cpp.
References stop().
Referenced by getDefaultLogDirectory().
|
overridevirtual |
Stop collecting metrics.
Implements IFrameMetricsReader.
Definition at line 797 of file frame_metrics.cpp.
Referenced by ~MangoHudLogReader(), and start().