diff options
| author | 2019-02-14 12:42:58 -0500 | |
|---|---|---|
| committer | 2019-02-15 21:50:25 -0500 | |
| commit | bd983414f643b734a1f8bebe3183723733344f72 (patch) | |
| tree | bda0421458439e25cba9d772a6a79b56e473d72e /src/core/core.cpp | |
| parent | Merge pull request #2113 from ReinUsesLisp/vulkan-base (diff) | |
| download | yuzu-bd983414f643b734a1f8bebe3183723733344f72.tar.gz yuzu-bd983414f643b734a1f8bebe3183723733344f72.tar.xz yuzu-bd983414f643b734a1f8bebe3183723733344f72.zip | |
core_timing: Convert core timing into a class
Gets rid of the largest set of mutable global state within the core.
This also paves a way for eliminating usages of GetInstance() on the
System class as a follow-up.
Note that no behavioral changes have been made, and this simply extracts
the functionality into a class. This also has the benefit of making
dependencies on the core timing functionality explicit within the
relevant interfaces.
Diffstat (limited to 'src/core/core.cpp')
| -rw-r--r-- | src/core/core.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 4d9d21ee4..8aa0932c5 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -94,8 +94,8 @@ struct System::Impl { | |||
| 94 | ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) { | 94 | ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) { |
| 95 | LOG_DEBUG(HW_Memory, "initialized OK"); | 95 | LOG_DEBUG(HW_Memory, "initialized OK"); |
| 96 | 96 | ||
| 97 | Timing::Init(); | 97 | core_timing.Initialize(); |
| 98 | kernel.Initialize(); | 98 | kernel.Initialize(core_timing); |
| 99 | 99 | ||
| 100 | const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( | 100 | const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( |
| 101 | std::chrono::system_clock::now().time_since_epoch()); | 101 | std::chrono::system_clock::now().time_since_epoch()); |
| @@ -120,7 +120,7 @@ struct System::Impl { | |||
| 120 | telemetry_session = std::make_unique<Core::TelemetrySession>(); | 120 | telemetry_session = std::make_unique<Core::TelemetrySession>(); |
| 121 | service_manager = std::make_shared<Service::SM::ServiceManager>(); | 121 | service_manager = std::make_shared<Service::SM::ServiceManager>(); |
| 122 | 122 | ||
| 123 | Service::Init(service_manager, *virtual_filesystem); | 123 | Service::Init(service_manager, system, *virtual_filesystem); |
| 124 | GDBStub::Init(); | 124 | GDBStub::Init(); |
| 125 | 125 | ||
| 126 | renderer = VideoCore::CreateRenderer(emu_window, system); | 126 | renderer = VideoCore::CreateRenderer(emu_window, system); |
| @@ -205,7 +205,7 @@ struct System::Impl { | |||
| 205 | 205 | ||
| 206 | // Shutdown kernel and core timing | 206 | // Shutdown kernel and core timing |
| 207 | kernel.Shutdown(); | 207 | kernel.Shutdown(); |
| 208 | Timing::Shutdown(); | 208 | core_timing.Shutdown(); |
| 209 | 209 | ||
| 210 | // Close app loader | 210 | // Close app loader |
| 211 | app_loader.reset(); | 211 | app_loader.reset(); |
| @@ -232,9 +232,10 @@ struct System::Impl { | |||
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | PerfStatsResults GetAndResetPerfStats() { | 234 | PerfStatsResults GetAndResetPerfStats() { |
| 235 | return perf_stats.GetAndResetStats(Timing::GetGlobalTimeUs()); | 235 | return perf_stats.GetAndResetStats(core_timing.GetGlobalTimeUs()); |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | Timing::CoreTiming core_timing; | ||
| 238 | Kernel::KernelCore kernel; | 239 | Kernel::KernelCore kernel; |
| 239 | /// RealVfsFilesystem instance | 240 | /// RealVfsFilesystem instance |
| 240 | FileSys::VirtualFilesystem virtual_filesystem; | 241 | FileSys::VirtualFilesystem virtual_filesystem; |
| @@ -396,6 +397,14 @@ const Kernel::KernelCore& System::Kernel() const { | |||
| 396 | return impl->kernel; | 397 | return impl->kernel; |
| 397 | } | 398 | } |
| 398 | 399 | ||
| 400 | Timing::CoreTiming& System::CoreTiming() { | ||
| 401 | return impl->core_timing; | ||
| 402 | } | ||
| 403 | |||
| 404 | const Timing::CoreTiming& System::CoreTiming() const { | ||
| 405 | return impl->core_timing; | ||
| 406 | } | ||
| 407 | |||
| 399 | Core::PerfStats& System::GetPerfStats() { | 408 | Core::PerfStats& System::GetPerfStats() { |
| 400 | return impl->perf_stats; | 409 | return impl->perf_stats; |
| 401 | } | 410 | } |