1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 11:22:57 +08:00

Add display of polling rate

This commit is contained in:
Dean Herbert 2022-06-07 19:43:33 +09:00
parent 2e7a966218
commit 43a04010a7

View File

@ -69,6 +69,9 @@ namespace osu.Game.Screens
private int difficulty = 1; private int difficulty = 1;
private double lastPoll;
private int pollingMax;
[Resolved] [Resolved]
private GameHost host { get; set; } = null!; private GameHost host { get; set; } = null!;
@ -133,6 +136,14 @@ Do whatever you need to try and perceive the difference in latency, then choose
}; };
} }
protected override bool OnMouseMove(MouseMoveEvent e)
{
if (lastPoll > 0)
pollingMax = (int)Math.Max(pollingMax, 1000 / (Clock.CurrentTime - lastPoll));
lastPoll = Clock.CurrentTime;
return base.OnMouseMove(e);
}
public override void OnEntering(ScreenTransitionEvent e) public override void OnEntering(ScreenTransitionEvent e)
{ {
base.OnEntering(e); base.OnEntering(e);
@ -217,9 +228,9 @@ Do whatever you need to try and perceive the difference in latency, then choose
statusText.AddParagraph($"You scored {correctCount} out of {targetRoundCount} ({successRate:P0})!", cp => cp.Colour = isPass ? colours.Green : colours.Red); statusText.AddParagraph($"You scored {correctCount} out of {targetRoundCount} ({successRate:P0})!", cp => cp.Colour = isPass ? colours.Green : colours.Red);
statusText.AddParagraph($"Level {difficulty} (comparing {mapDifficultyToTargetFrameRate(difficulty):N0}hz with {host.UpdateThread.Clock.FramesPerSecond:N0}hz)", statusText.AddParagraph($"Level {difficulty} (comparing {mapDifficultyToTargetFrameRate(difficulty):N0}hz with {host.UpdateThread.Clock.FramesPerSecond:N0}hz)",
cp => cp.Font = OsuFont.Default.With(size: 15)); cp => cp.Font = OsuFont.Default.With(size: 24));
statusText.AddParagraph($"Refresh rate: {displayMode.RefreshRate:N0} ExclusiveFullscren: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15)); statusText.AddParagraph($"Input: {pollingMax}hz Monitor: {displayMode.RefreshRate:N0}hz Exclusive: {exclusive}", cp => cp.Font = OsuFont.Default.With(size: 15));
string cannotIncreaseReason = string.Empty; string cannotIncreaseReason = string.Empty;
@ -281,6 +292,8 @@ Do whatever you need to try and perceive the difference in latency, then choose
correctCount = 0; correctCount = 0;
round = 0; round = 0;
pollingMax = 0;
lastPoll = 0;
targetRoundCount = rounds_to_complete; targetRoundCount = rounds_to_complete;
difficulty = diff; difficulty = diff;