Skip to content

Commit

Permalink
FEX-Emu: Profile stats support
Browse files Browse the repository at this point in the history
This implements support for FEX-Emu's profiling stats interface behind a
command line option that isn't default enabled.

The purpose of these statistics in FEX-Emu is to expose statistics that
are high frequency and can't easily be collected in other ways due to
overhead. The reason why these are getting exposed in Mangohud versus
another path is to have that information readily available while running
a game. It's sometimes difficult to understand why a game has stuttered
in FEX and being able to attribute the stutter to FEX-Emu overheads.
This allows us to directly related these stats to frame time drops in
the game.

The attached example is a good indicator for why a game is having low
performance and how the stats look. We can see in the image that the
game (Celeste) is only running at 55FPS, with a CPU core being pegged to
100% and then the FEX stats lets us know that 33.7 million soft float
operations are happening, ~600k per frame.

The implementation is already in FEX-Emu upstream
(FEX-Emu/FEX#4291) and we aren't expecting the
implementation to change heavily, potentially just adding additional
sample events. We version these stats so that if they change in the
future, that the interface doesn't get broken on one side versus the
other.
  • Loading branch information
Sonicadvance1 authored and flightlessmango committed Feb 24, 2025
1 parent 359e971 commit 591e025
Show file tree
Hide file tree
Showing 11 changed files with 650 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu
| `winesync` | Show wine sync method in use |
| `present_mode` | Shows current vulkan [present mode](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPresentModeKHR.html) or vsync status in opengl |
| `network` | Show network interfaces tx and rx kb/s. You can specify interface with `network=eth0` |
| `fex_stats` | Show FEX-Emu statistics. Default = `status+apptype+hotthreads+jitload+sigbus+smc+softfloat` |

Example: `MANGOHUD_CONFIG=cpu_temp,gpu_temp,position=top-right,height=500,font_size=32`
Because comma is also used as option delimiter and needs to be escaped for values with a backslash, you can use `+` like `MANGOHUD_CONFIG=fps_limit=60+30+0` instead.
Expand Down
4 changes: 4 additions & 0 deletions data/MangoHud.conf
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ text_outline
### Disable / hide the hud by default
# no_display

### Show FEX-Emu statistics
## Only useful for Arm64 devices running applications under emulation
# fex_stats

### Hud position offset
# offset_x=0
# offset_y=0
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ option('mangohudctl', type: 'boolean', value : false)
option('tests', type: 'feature', value: 'auto', description: 'Run tests')
option('mangoplot', type: 'feature', value: 'enabled')
option('dynamic_string_tokens', type: 'boolean', value: true, description: 'Use dynamic string tokens in LD_PRELOAD')
option('with_fex', type : 'boolean', value : false)
Loading

0 comments on commit 591e025

Please sign in to comment.