summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Lioncash2018-08-31 12:21:34 -0400
committerGravatar Lioncash2018-08-31 16:30:14 -0400
commit4a587b81b285bcd41246329e89591be7cfe37c8a (patch)
tree8eda46d4aac083d23a52223e1a3fc46bc6690a6c /src/core
parentMerge pull request #1205 from bunnei/improve-rasterizer-cache-2 (diff)
downloadyuzu-4a587b81b285bcd41246329e89591be7cfe37c8a.tar.gz
yuzu-4a587b81b285bcd41246329e89591be7cfe37c8a.tar.xz
yuzu-4a587b81b285bcd41246329e89591be7cfe37c8a.zip
core/core: Replace includes with forward declarations where applicable
The follow-up to e2457418dae19b889b2ad85255bb95d4cd0e4bff, which replaces most of the includes in the core header with forward declarations. This makes it so that if any of the headers the core header was previously including change, then no one will need to rebuild the bulk of the core, due to core.h being quite a prevalent inclusion. This should make turnaround for changes much faster for developers.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic.cpp1
-rw-r--r--src/core/core.cpp19
-rw-r--r--src/core/core.h56
-rw-r--r--src/core/file_sys/savedata_factory.cpp1
-rw-r--r--src/core/file_sys/savedata_factory.h1
-rw-r--r--src/core/hle/kernel/address_arbiter.cpp2
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp1
-rw-r--r--src/core/hle/kernel/server_session.cpp6
-rw-r--r--src/core/hle/kernel/svc.cpp4
-rw-r--r--src/core/hle/kernel/thread.cpp3
-rw-r--r--src/core/hle/service/filesystem/filesystem.h1
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp1
-rw-r--r--src/core/loader/elf.cpp1
-rw-r--r--src/core/loader/nro.cpp1
-rw-r--r--src/core/loader/nso.cpp1
-rw-r--r--src/core/perf_stats.cpp4
-rw-r--r--src/core/perf_stats.h24
-rw-r--r--src/core/telemetry_session.cpp1
18 files changed, 85 insertions, 43 deletions
diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp
index f96e08212..de44ccebd 100644
--- a/src/core/arm/dynarmic/arm_dynarmic.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic.cpp
@@ -9,6 +9,7 @@
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "core/arm/dynarmic/arm_dynarmic.h" 10#include "core/arm/dynarmic/arm_dynarmic.h"
11#include "core/core.h" 11#include "core/core.h"
12#include "core/core_cpu.h"
12#include "core/core_timing.h" 13#include "core/core_timing.h"
13#include "core/hle/kernel/process.h" 14#include "core/hle/kernel/process.h"
14#include "core/hle/kernel/svc.h" 15#include "core/hle/kernel/svc.h"
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 75c259068..2cfae18df 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -2,24 +2,35 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <array>
6#include <map>
5#include <memory> 7#include <memory>
8#include <thread>
6#include <utility> 9#include <utility>
10
7#include "common/logging/log.h" 11#include "common/logging/log.h"
8#include "common/string_util.h" 12#include "common/string_util.h"
13#include "core/arm/exclusive_monitor.h"
9#include "core/core.h" 14#include "core/core.h"
15#include "core/core_cpu.h"
10#include "core/core_timing.h" 16#include "core/core_timing.h"
11#include "core/gdbstub/gdbstub.h" 17#include "core/gdbstub/gdbstub.h"
12#include "core/hle/kernel/client_port.h" 18#include "core/hle/kernel/client_port.h"
13#include "core/hle/kernel/kernel.h" 19#include "core/hle/kernel/kernel.h"
14#include "core/hle/kernel/process.h" 20#include "core/hle/kernel/process.h"
21#include "core/hle/kernel/scheduler.h"
15#include "core/hle/kernel/thread.h" 22#include "core/hle/kernel/thread.h"
16#include "core/hle/service/service.h" 23#include "core/hle/service/service.h"
17#include "core/hle/service/sm/controller.h" 24#include "core/hle/service/sm/controller.h"
18#include "core/hle/service/sm/sm.h" 25#include "core/hle/service/sm/sm.h"
19#include "core/loader/loader.h" 26#include "core/loader/loader.h"
27#include "core/perf_stats.h"
20#include "core/settings.h" 28#include "core/settings.h"
29#include "core/telemetry_session.h"
21#include "file_sys/vfs_concat.h" 30#include "file_sys/vfs_concat.h"
22#include "file_sys/vfs_real.h" 31#include "file_sys/vfs_real.h"
32#include "video_core/debug_utils/debug_utils.h"
33#include "video_core/gpu.h"
23#include "video_core/renderer_base.h" 34#include "video_core/renderer_base.h"
24#include "video_core/video_core.h" 35#include "video_core/video_core.h"
25 36
@@ -258,7 +269,7 @@ struct System::Impl {
258 } 269 }
259 } 270 }
260 271
261 PerfStats::Results GetAndResetPerfStats() { 272 PerfStatsResults GetAndResetPerfStats() {
262 return perf_stats.GetAndResetStats(CoreTiming::GetGlobalTimeUs()); 273 return perf_stats.GetAndResetStats(CoreTiming::GetGlobalTimeUs());
263 } 274 }
264 275
@@ -326,7 +337,7 @@ void System::PrepareReschedule() {
326 CurrentCpuCore().PrepareReschedule(); 337 CurrentCpuCore().PrepareReschedule();
327} 338}
328 339
329PerfStats::Results System::GetAndResetPerfStats() { 340PerfStatsResults System::GetAndResetPerfStats() {
330 return impl->GetAndResetPerfStats(); 341 return impl->GetAndResetPerfStats();
331} 342}
332 343
@@ -433,11 +444,11 @@ std::shared_ptr<Tegra::DebugContext> System::GetGPUDebugContext() const {
433 return impl->debug_context; 444 return impl->debug_context;
434} 445}
435 446
436void System::SetFilesystem(FileSys::VirtualFilesystem vfs) { 447void System::SetFilesystem(std::shared_ptr<FileSys::VfsFilesystem> vfs) {
437 impl->virtual_filesystem = std::move(vfs); 448 impl->virtual_filesystem = std::move(vfs);
438} 449}
439 450
440FileSys::VirtualFilesystem System::GetFilesystem() const { 451std::shared_ptr<FileSys::VfsFilesystem> System::GetFilesystem() const {
441 return impl->virtual_filesystem; 452 return impl->virtual_filesystem;
442} 453}
443 454
diff --git a/src/core/core.h b/src/core/core.h
index 984e8f94c..eee1fecc1 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -4,41 +4,55 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <cstddef>
8#include <map>
9#include <memory> 8#include <memory>
10#include <string> 9#include <string>
11#include <thread> 10
12#include "common/common_types.h" 11#include "common/common_types.h"
13#include "core/arm/exclusive_monitor.h"
14#include "core/core_cpu.h"
15#include "core/hle/kernel/kernel.h"
16#include "core/hle/kernel/object.h" 12#include "core/hle/kernel/object.h"
17#include "core/hle/kernel/scheduler.h"
18#include "core/loader/loader.h"
19#include "core/memory.h"
20#include "core/perf_stats.h"
21#include "core/telemetry_session.h"
22#include "file_sys/vfs_real.h"
23#include "hle/service/filesystem/filesystem.h"
24#include "video_core/debug_utils/debug_utils.h"
25#include "video_core/gpu.h"
26 13
27namespace Core::Frontend { 14namespace Core::Frontend {
28class EmuWindow; 15class EmuWindow;
29} 16} // namespace Core::Frontend
17
18namespace FileSys {
19class VfsFilesystem;
20} // namespace FileSys
21
22namespace Kernel {
23class KernelCore;
24class Process;
25class Scheduler;
26} // namespace Kernel
27
28namespace Loader {
29class AppLoader;
30enum class ResultStatus : u16;
31} // namespace Loader
30 32
31namespace Service::SM { 33namespace Service::SM {
32class ServiceManager; 34class ServiceManager;
33} 35} // namespace Service::SM
36
37namespace Tegra {
38class DebugContext;
39class GPU;
40} // namespace Tegra
34 41
35namespace VideoCore { 42namespace VideoCore {
36class RendererBase; 43class RendererBase;
37} 44} // namespace VideoCore
38 45
39namespace Core { 46namespace Core {
40 47
41class ARM_Interface; 48class ARM_Interface;
49class Cpu;
50class ExclusiveMonitor;
51class FrameLimiter;
52class PerfStats;
53class TelemetrySession;
54
55struct PerfStatsResults;
42 56
43class System { 57class System {
44public: 58public:
@@ -125,7 +139,7 @@ public:
125 void PrepareReschedule(); 139 void PrepareReschedule();
126 140
127 /// Gets and resets core performance statistics 141 /// Gets and resets core performance statistics
128 PerfStats::Results GetAndResetPerfStats(); 142 PerfStatsResults GetAndResetPerfStats();
129 143
130 /// Gets an ARM interface to the CPU core that is currently running 144 /// Gets an ARM interface to the CPU core that is currently running
131 ARM_Interface& CurrentArmInterface(); 145 ARM_Interface& CurrentArmInterface();
@@ -197,9 +211,9 @@ public:
197 211
198 std::shared_ptr<Tegra::DebugContext> GetGPUDebugContext() const; 212 std::shared_ptr<Tegra::DebugContext> GetGPUDebugContext() const;
199 213
200 void SetFilesystem(FileSys::VirtualFilesystem vfs); 214 void SetFilesystem(std::shared_ptr<FileSys::VfsFilesystem> vfs);
201 215
202 FileSys::VirtualFilesystem GetFilesystem() const; 216 std::shared_ptr<FileSys::VfsFilesystem> GetFilesystem() const;
203 217
204private: 218private:
205 System(); 219 System();
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp
index 034d3a78f..952bd74b3 100644
--- a/src/core/file_sys/savedata_factory.cpp
+++ b/src/core/file_sys/savedata_factory.cpp
@@ -7,6 +7,7 @@
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "core/core.h" 8#include "core/core.h"
9#include "core/file_sys/savedata_factory.h" 9#include "core/file_sys/savedata_factory.h"
10#include "core/file_sys/vfs.h"
10#include "core/hle/kernel/process.h" 11#include "core/hle/kernel/process.h"
11 12
12namespace FileSys { 13namespace FileSys {
diff --git a/src/core/file_sys/savedata_factory.h b/src/core/file_sys/savedata_factory.h
index 368b36017..c6f9549f0 100644
--- a/src/core/file_sys/savedata_factory.h
+++ b/src/core/file_sys/savedata_factory.h
@@ -8,6 +8,7 @@
8#include <string> 8#include <string>
9#include "common/common_types.h" 9#include "common/common_types.h"
10#include "common/swap.h" 10#include "common/swap.h"
11#include "core/file_sys/vfs.h"
11#include "core/hle/result.h" 12#include "core/hle/result.h"
12 13
13namespace FileSys { 14namespace FileSys {
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp
index 03a954a9f..6657accd5 100644
--- a/src/core/hle/kernel/address_arbiter.cpp
+++ b/src/core/hle/kernel/address_arbiter.cpp
@@ -8,9 +8,11 @@
8#include "common/assert.h" 8#include "common/assert.h"
9#include "common/common_types.h" 9#include "common/common_types.h"
10#include "core/core.h" 10#include "core/core.h"
11#include "core/core_cpu.h"
11#include "core/hle/kernel/errors.h" 12#include "core/hle/kernel/errors.h"
12#include "core/hle/kernel/object.h" 13#include "core/hle/kernel/object.h"
13#include "core/hle/kernel/process.h" 14#include "core/hle/kernel/process.h"
15#include "core/hle/kernel/scheduler.h"
14#include "core/hle/kernel/thread.h" 16#include "core/hle/kernel/thread.h"
15#include "core/hle/result.h" 17#include "core/hle/result.h"
16#include "core/memory.h" 18#include "core/memory.h"
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index db7aef766..7264be906 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -18,6 +18,7 @@
18#include "core/hle/kernel/event.h" 18#include "core/hle/kernel/event.h"
19#include "core/hle/kernel/handle_table.h" 19#include "core/hle/kernel/handle_table.h"
20#include "core/hle/kernel/hle_ipc.h" 20#include "core/hle/kernel/hle_ipc.h"
21#include "core/hle/kernel/kernel.h"
21#include "core/hle/kernel/object.h" 22#include "core/hle/kernel/object.h"
22#include "core/hle/kernel/process.h" 23#include "core/hle/kernel/process.h"
23#include "core/hle/kernel/server_session.h" 24#include "core/hle/kernel/server_session.h"
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp
index 90c9a5aff..aba0cab96 100644
--- a/src/core/hle/kernel/server_session.cpp
+++ b/src/core/hle/kernel/server_session.cpp
@@ -13,6 +13,7 @@
13#include "core/hle/kernel/client_session.h" 13#include "core/hle/kernel/client_session.h"
14#include "core/hle/kernel/handle_table.h" 14#include "core/hle/kernel/handle_table.h"
15#include "core/hle/kernel/hle_ipc.h" 15#include "core/hle/kernel/hle_ipc.h"
16#include "core/hle/kernel/kernel.h"
16#include "core/hle/kernel/process.h" 17#include "core/hle/kernel/process.h"
17#include "core/hle/kernel/server_session.h" 18#include "core/hle/kernel/server_session.h"
18#include "core/hle/kernel/session.h" 19#include "core/hle/kernel/session.h"
@@ -104,11 +105,10 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) {
104 // The ServerSession received a sync request, this means that there's new data available 105 // The ServerSession received a sync request, this means that there's new data available
105 // from its ClientSession, so wake up any threads that may be waiting on a svcReplyAndReceive or 106 // from its ClientSession, so wake up any threads that may be waiting on a svcReplyAndReceive or
106 // similar. 107 // similar.
107
108 auto& handle_table = Core::System::GetInstance().Kernel().HandleTable();
109 Kernel::HLERequestContext context(this); 108 Kernel::HLERequestContext context(this);
110 u32* cmd_buf = (u32*)Memory::GetPointer(thread->GetTLSAddress()); 109 u32* cmd_buf = (u32*)Memory::GetPointer(thread->GetTLSAddress());
111 context.PopulateFromIncomingCommandBuffer(cmd_buf, *Core::CurrentProcess(), handle_table); 110 context.PopulateFromIncomingCommandBuffer(cmd_buf, *Core::CurrentProcess(),
111 kernel.HandleTable());
112 112
113 ResultCode result = RESULT_SUCCESS; 113 ResultCode result = RESULT_SUCCESS;
114 // If the session has been converted to a domain, handle the domain request 114 // If the session has been converted to a domain, handle the domain request
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 099d1053f..5da71cff0 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -12,16 +12,20 @@
12#include "common/logging/log.h" 12#include "common/logging/log.h"
13#include "common/microprofile.h" 13#include "common/microprofile.h"
14#include "common/string_util.h" 14#include "common/string_util.h"
15#include "core/arm/exclusive_monitor.h"
15#include "core/core.h" 16#include "core/core.h"
17#include "core/core_cpu.h"
16#include "core/core_timing.h" 18#include "core/core_timing.h"
17#include "core/hle/kernel/address_arbiter.h" 19#include "core/hle/kernel/address_arbiter.h"
18#include "core/hle/kernel/client_port.h" 20#include "core/hle/kernel/client_port.h"
19#include "core/hle/kernel/client_session.h" 21#include "core/hle/kernel/client_session.h"
20#include "core/hle/kernel/event.h" 22#include "core/hle/kernel/event.h"
21#include "core/hle/kernel/handle_table.h" 23#include "core/hle/kernel/handle_table.h"
24#include "core/hle/kernel/kernel.h"
22#include "core/hle/kernel/mutex.h" 25#include "core/hle/kernel/mutex.h"
23#include "core/hle/kernel/process.h" 26#include "core/hle/kernel/process.h"
24#include "core/hle/kernel/resource_limit.h" 27#include "core/hle/kernel/resource_limit.h"
28#include "core/hle/kernel/scheduler.h"
25#include "core/hle/kernel/shared_memory.h" 29#include "core/hle/kernel/shared_memory.h"
26#include "core/hle/kernel/svc.h" 30#include "core/hle/kernel/svc.h"
27#include "core/hle/kernel/svc_wrap.h" 31#include "core/hle/kernel/svc_wrap.h"
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 520ea0853..3d10d9af2 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -16,6 +16,7 @@
16#include "common/thread_queue_list.h" 16#include "common/thread_queue_list.h"
17#include "core/arm/arm_interface.h" 17#include "core/arm/arm_interface.h"
18#include "core/core.h" 18#include "core/core.h"
19#include "core/core_cpu.h"
19#include "core/core_timing.h" 20#include "core/core_timing.h"
20#include "core/core_timing_util.h" 21#include "core/core_timing_util.h"
21#include "core/hle/kernel/errors.h" 22#include "core/hle/kernel/errors.h"
@@ -23,8 +24,8 @@
23#include "core/hle/kernel/kernel.h" 24#include "core/hle/kernel/kernel.h"
24#include "core/hle/kernel/object.h" 25#include "core/hle/kernel/object.h"
25#include "core/hle/kernel/process.h" 26#include "core/hle/kernel/process.h"
27#include "core/hle/kernel/scheduler.h"
26#include "core/hle/kernel/thread.h" 28#include "core/hle/kernel/thread.h"
27#include "core/hle/lock.h"
28#include "core/hle/result.h" 29#include "core/hle/result.h"
29#include "core/memory.h" 30#include "core/memory.h"
30 31
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
index d88a66825..9ba0e2eab 100644
--- a/src/core/hle/service/filesystem/filesystem.h
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -7,6 +7,7 @@
7#include <memory> 7#include <memory>
8#include "common/common_types.h" 8#include "common/common_types.h"
9#include "core/file_sys/directory.h" 9#include "core/file_sys/directory.h"
10#include "core/file_sys/vfs.h"
10#include "core/hle/result.h" 11#include "core/hle/result.h"
11 12
12namespace FileSys { 13namespace FileSys {
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index a53fa6e00..921b899e2 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -11,6 +11,7 @@
11#include "core/file_sys/control_metadata.h" 11#include "core/file_sys/control_metadata.h"
12#include "core/file_sys/romfs_factory.h" 12#include "core/file_sys/romfs_factory.h"
13#include "core/gdbstub/gdbstub.h" 13#include "core/gdbstub/gdbstub.h"
14#include "core/hle/kernel/kernel.h"
14#include "core/hle/kernel/process.h" 15#include "core/hle/kernel/process.h"
15#include "core/hle/kernel/resource_limit.h" 16#include "core/hle/kernel/resource_limit.h"
16#include "core/hle/service/filesystem/filesystem.h" 17#include "core/hle/service/filesystem/filesystem.h"
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp
index 3702a8478..120e1e133 100644
--- a/src/core/loader/elf.cpp
+++ b/src/core/loader/elf.cpp
@@ -10,6 +10,7 @@
10#include "common/file_util.h" 10#include "common/file_util.h"
11#include "common/logging/log.h" 11#include "common/logging/log.h"
12#include "core/core.h" 12#include "core/core.h"
13#include "core/hle/kernel/kernel.h"
13#include "core/hle/kernel/process.h" 14#include "core/hle/kernel/process.h"
14#include "core/hle/kernel/resource_limit.h" 15#include "core/hle/kernel/resource_limit.h"
15#include "core/loader/elf.h" 16#include "core/loader/elf.h"
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp
index 00205d1d2..77026b850 100644
--- a/src/core/loader/nro.cpp
+++ b/src/core/loader/nro.cpp
@@ -14,6 +14,7 @@
14#include "core/file_sys/control_metadata.h" 14#include "core/file_sys/control_metadata.h"
15#include "core/file_sys/vfs_offset.h" 15#include "core/file_sys/vfs_offset.h"
16#include "core/gdbstub/gdbstub.h" 16#include "core/gdbstub/gdbstub.h"
17#include "core/hle/kernel/kernel.h"
17#include "core/hle/kernel/process.h" 18#include "core/hle/kernel/process.h"
18#include "core/hle/kernel/resource_limit.h" 19#include "core/hle/kernel/resource_limit.h"
19#include "core/loader/nro.h" 20#include "core/loader/nro.h"
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index 0c992d662..082a95d40 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -11,6 +11,7 @@
11#include "common/swap.h" 11#include "common/swap.h"
12#include "core/core.h" 12#include "core/core.h"
13#include "core/gdbstub/gdbstub.h" 13#include "core/gdbstub/gdbstub.h"
14#include "core/hle/kernel/kernel.h"
14#include "core/hle/kernel/process.h" 15#include "core/hle/kernel/process.h"
15#include "core/hle/kernel/resource_limit.h" 16#include "core/hle/kernel/resource_limit.h"
16#include "core/loader/nso.h" 17#include "core/loader/nso.h"
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp
index 93d23de21..7d95816fe 100644
--- a/src/core/perf_stats.cpp
+++ b/src/core/perf_stats.cpp
@@ -40,7 +40,7 @@ void PerfStats::EndGameFrame() {
40 game_frames += 1; 40 game_frames += 1;
41} 41}
42 42
43PerfStats::Results PerfStats::GetAndResetStats(microseconds current_system_time_us) { 43PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us) {
44 std::lock_guard<std::mutex> lock(object_mutex); 44 std::lock_guard<std::mutex> lock(object_mutex);
45 45
46 const auto now = Clock::now(); 46 const auto now = Clock::now();
@@ -49,7 +49,7 @@ PerfStats::Results PerfStats::GetAndResetStats(microseconds current_system_time_
49 49
50 const auto system_us_per_second = (current_system_time_us - reset_point_system_us) / interval; 50 const auto system_us_per_second = (current_system_time_us - reset_point_system_us) / interval;
51 51
52 Results results{}; 52 PerfStatsResults results{};
53 results.system_fps = static_cast<double>(system_frames) / interval; 53 results.system_fps = static_cast<double>(system_frames) / interval;
54 results.game_fps = static_cast<double>(game_frames) / interval; 54 results.game_fps = static_cast<double>(game_frames) / interval;
55 results.frametime = duration_cast<DoubleSecs>(accumulated_frametime).count() / 55 results.frametime = duration_cast<DoubleSecs>(accumulated_frametime).count() /
diff --git a/src/core/perf_stats.h b/src/core/perf_stats.h
index 6e4619701..222ac1a63 100644
--- a/src/core/perf_stats.h
+++ b/src/core/perf_stats.h
@@ -10,6 +10,17 @@
10 10
11namespace Core { 11namespace Core {
12 12
13struct PerfStatsResults {
14 /// System FPS (LCD VBlanks) in Hz
15 double system_fps;
16 /// Game FPS (GSP frame submissions) in Hz
17 double game_fps;
18 /// Walltime per system frame, in seconds, excluding any waits
19 double frametime;
20 /// Ratio of walltime / emulated time elapsed
21 double emulation_speed;
22};
23
13/** 24/**
14 * Class to manage and query performance/timing statistics. All public functions of this class are 25 * Class to manage and query performance/timing statistics. All public functions of this class are
15 * thread-safe unless stated otherwise. 26 * thread-safe unless stated otherwise.
@@ -18,22 +29,11 @@ class PerfStats {
18public: 29public:
19 using Clock = std::chrono::high_resolution_clock; 30 using Clock = std::chrono::high_resolution_clock;
20 31
21 struct Results {
22 /// System FPS (LCD VBlanks) in Hz
23 double system_fps;
24 /// Game FPS (GSP frame submissions) in Hz
25 double game_fps;
26 /// Walltime per system frame, in seconds, excluding any waits
27 double frametime;
28 /// Ratio of walltime / emulated time elapsed
29 double emulation_speed;
30 };
31
32 void BeginSystemFrame(); 32 void BeginSystemFrame();
33 void EndSystemFrame(); 33 void EndSystemFrame();
34 void EndGameFrame(); 34 void EndGameFrame();
35 35
36 Results GetAndResetStats(std::chrono::microseconds current_system_time_us); 36 PerfStatsResults GetAndResetStats(std::chrono::microseconds current_system_time_us);
37 37
38 /** 38 /**
39 * Gets the ratio between walltime and the emulated time of the previous system frame. This is 39 * Gets the ratio between walltime and the emulated time of the previous system frame. This is
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp
index 827a1bbd0..65571b948 100644
--- a/src/core/telemetry_session.cpp
+++ b/src/core/telemetry_session.cpp
@@ -7,6 +7,7 @@
7#include "common/file_util.h" 7#include "common/file_util.h"
8 8
9#include "core/core.h" 9#include "core/core.h"
10#include "core/loader/loader.h"
10#include "core/settings.h" 11#include "core/settings.h"
11#include "core/telemetry_session.h" 12#include "core/telemetry_session.h"
12 13