Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
92c8bd4b
There was an error fetching the commit references. Please try again later.
Commit
92c8bd4b
authored
8 years ago
by
Yuri Kunde Schlesner
Browse files
Options
Downloads
Patches
Plain Diff
PerfStats: Add method to get the instantaneous time ratio
parent
c75ae6c5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/core/frontend/emu_window.cpp
+2
-3
2 additions, 3 deletions
src/core/frontend/emu_window.cpp
src/core/perf_stats.cpp
+11
-3
11 additions, 3 deletions
src/core/perf_stats.cpp
src/core/perf_stats.h
+9
-1
9 additions, 1 deletion
src/core/perf_stats.h
with
22 additions
and
7 deletions
src/core/frontend/emu_window.cpp
+
2
−
3
View file @
92c8bd4b
...
...
@@ -5,7 +5,7 @@
#include
<algorithm>
#include
<cmath>
#include
"common/assert.h"
#include
"co
mmon/profiler_reporting
.h"
#include
"co
re/core
.h"
#include
"core/frontend/emu_window.h"
#include
"core/frontend/key_map.h"
#include
"video_core/video_core.h"
...
...
@@ -104,8 +104,7 @@ void EmuWindow::AccelerometerChanged(float x, float y, float z) {
void
EmuWindow
::
GyroscopeChanged
(
float
x
,
float
y
,
float
z
)
{
constexpr
float
FULL_FPS
=
60
;
float
coef
=
GetGyroscopeRawToDpsCoefficient
();
float
stretch
=
FULL_FPS
/
Common
::
Profiling
::
GetTimingResultsAggregator
()
->
GetAggregatedResults
().
fps
;
float
stretch
=
Core
::
System
::
GetInstance
().
perf_stats
.
Lock
()
->
GetLastFrameTimeScale
();
std
::
lock_guard
<
std
::
mutex
>
lock
(
gyro_mutex
);
gyro_x
=
static_cast
<
s16
>
(
x
*
coef
*
stretch
);
gyro_y
=
static_cast
<
s16
>
(
y
*
coef
*
stretch
);
...
...
This diff is collapsed.
Click to expand it.
src/core/perf_stats.cpp
+
11
−
3
View file @
92c8bd4b
...
...
@@ -6,6 +6,9 @@
#include
"core/hw/gpu.h"
#include
"core/perf_stats.h"
using
DoubleSecs
=
std
::
chrono
::
duration
<
double
,
std
::
chrono
::
seconds
::
period
>
;
using
std
::
chrono
::
duration_cast
;
namespace
Core
{
void
PerfStats
::
BeginSystemFrame
()
{
...
...
@@ -16,6 +19,9 @@ void PerfStats::EndSystemFrame() {
auto
frame_end
=
Clock
::
now
();
accumulated_frametime
+=
frame_end
-
frame_begin
;
system_frames
+=
1
;
previous_frame_length
=
frame_end
-
previous_frame_end
;
previous_frame_end
=
frame_end
;
}
void
PerfStats
::
EndGameFrame
()
{
...
...
@@ -23,9 +29,6 @@ void PerfStats::EndGameFrame() {
}
PerfStats
::
Results
PerfStats
::
GetAndResetStats
(
u64
current_system_time_us
)
{
using
DoubleSecs
=
std
::
chrono
::
duration
<
double
,
std
::
chrono
::
seconds
::
period
>
;
using
std
::
chrono
::
duration_cast
;
auto
now
=
Clock
::
now
();
// Walltime elapsed since stats were reset
auto
interval
=
duration_cast
<
DoubleSecs
>
(
now
-
reset_point
).
count
();
...
...
@@ -50,4 +53,9 @@ PerfStats::Results PerfStats::GetAndResetStats(u64 current_system_time_us) {
return
results
;
}
double
PerfStats
::
GetLastFrameTimeScale
()
{
constexpr
double
FRAME_LENGTH
=
1.0
/
GPU
::
SCREEN_REFRESH_RATE
;
return
duration_cast
<
DoubleSecs
>
(
previous_frame_length
).
count
()
/
FRAME_LENGTH
;
}
}
// namespace Core
This diff is collapsed.
Click to expand it.
src/core/perf_stats.h
+
9
−
1
View file @
92c8bd4b
...
...
@@ -30,11 +30,19 @@ public:
Results
GetAndResetStats
(
u64
current_system_time_us
);
/**
* Gets the ratio between walltime and the emulated time of the previous system frame. This is
* useful for scaling inputs or outputs moving between the two time domains.
*/
double
GetLastFrameTimeScale
();
private
:
Clock
::
time_point
reset_point
=
Clock
::
now
();
Clock
::
time_point
frame_begin
;
Clock
::
time_point
frame_begin
=
reset_point
;
Clock
::
time_point
previous_frame_end
=
reset_point
;
Clock
::
duration
accumulated_frametime
=
Clock
::
duration
::
zero
();
Clock
::
duration
previous_frame_length
=
Clock
::
duration
::
zero
();
u64
reset_point_system_us
=
0
;
u32
system_frames
=
0
;
u32
game_frames
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment