aboutsummaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-02-14 12:42:58 -0500
committerLioncash <mathew1800@gmail.com>2019-02-15 21:50:25 -0500
commitbd983414f643b734a1f8bebe3183723733344f72 (patch)
treebda0421458439e25cba9d772a6a79b56e473d72e /src/core/core.cpp
parentfcc3aa0bbf4a1343f90dfc7a93afc31e770c3a70 (diff)
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.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 4d9d21ee42..8aa0932c51 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -94,8 +94,8 @@ struct System::Impl {
ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
LOG_DEBUG(HW_Memory, "initialized OK");
- Timing::Init();
- kernel.Initialize();
+ core_timing.Initialize();
+ kernel.Initialize(core_timing);
const auto current_time = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch());
@@ -120,7 +120,7 @@ struct System::Impl {
telemetry_session = std::make_unique<Core::TelemetrySession>();
service_manager = std::make_shared<Service::SM::ServiceManager>();
- Service::Init(service_manager, *virtual_filesystem);
+ Service::Init(service_manager, system, *virtual_filesystem);
GDBStub::Init();
renderer = VideoCore::CreateRenderer(emu_window, system);
@@ -205,7 +205,7 @@ struct System::Impl {
// Shutdown kernel and core timing
kernel.Shutdown();
- Timing::Shutdown();
+ core_timing.Shutdown();
// Close app loader
app_loader.reset();
@@ -232,9 +232,10 @@ struct System::Impl {
}
PerfStatsResults GetAndResetPerfStats() {
- return perf_stats.GetAndResetStats(Timing::GetGlobalTimeUs());
+ return perf_stats.GetAndResetStats(core_timing.GetGlobalTimeUs());
}
+ Timing::CoreTiming core_timing;
Kernel::KernelCore kernel;
/// RealVfsFilesystem instance
FileSys::VirtualFilesystem virtual_filesystem;
@@ -396,6 +397,14 @@ const Kernel::KernelCore& System::Kernel() const {
return impl->kernel;
}
+Timing::CoreTiming& System::CoreTiming() {
+ return impl->core_timing;
+}
+
+const Timing::CoreTiming& System::CoreTiming() const {
+ return impl->core_timing;
+}
+
Core::PerfStats& System::GetPerfStats() {
return impl->perf_stats;
}