Commit graph

70 commits

Author SHA1 Message Date
Liam
f60d4cbe93 core_timing: handle concurrent unscheduling of looping events 2023-12-23 15:36:46 -05:00
Liam
468ef514f1 core_timing: use static typing for no-wait unschedule 2023-12-23 15:36:46 -05:00
Liam
b9545c5a0e core_timing: remove user data value 2023-12-23 15:36:44 -05:00
Liam
e65d90b331 core_timing: lock event queue access 2023-11-14 11:51:04 -05:00
Merry
4e5157a6f1 core_timing: Use a fibonacci heap 2023-09-16 07:42:45 +01:00
Kelebek1
42638691b5 Use spans over guest memory where possible instead of copying data. 2023-07-02 23:09:48 +01:00
Morph
81ba61a0bd core_timing: Remove GetCurrentTimerResolution in CoreTiming loop
Other programs may change this value, but if thousands of syscalls in this loop is undesirable, then we can just set this once.
2023-07-02 15:08:04 -04:00
Morph
52a219cfe9 core_timing: Fix SingleCore cycle timer 2023-06-07 21:44:42 -04:00
Morph
1b83c7eab4 (wall, native)_clock: Add GetGPUTick
Allows us to directly calculate the GPU tick without double conversion to and from the host clock tick.
2023-06-07 21:44:42 -04:00
Morph
2856fadaa0 core_timing: Use CNTPCT as the guest CPU tick
Previously, we were mixing the raw CPU frequency and CNTFRQ.
The raw CPU frequency (1020 MHz) should've never been used as CNTPCT (whose frequency is CNTFRQ) is the only counter available.
2023-06-07 21:44:42 -04:00
Liam
5be8a74b0c general: fix spelling mistakes 2023-03-12 11:33:01 -04:00
Morph
e25334b8b3 core_timing: Use higher precision sleeps on Windows
The precision of sleep_for and wait_for is limited to 1-1.5ms on Windows.
Using SleepForOneTick() allows us to sleep for exactly one interval of the current timer resolution.
This allows us to take advantage of systems that have a timer resolution of 0.5ms to reduce CPU overhead in the event loop.
2023-03-05 02:36:31 -05:00
Liam
e1b0b3d0db timing: wait for completion on unregister 2023-01-14 15:48:01 -05:00
bunnei
438c1b5c18 core: core_timing: Re-initialize if single/multicore state changes. 2022-10-18 19:13:35 -07:00
bunnei
f357ddf644 core: core_timing: Remove unused IsHostTiming. 2022-10-18 19:13:35 -07:00
bunnei
a35c884097 core: Partially persist emulation state across game boots. 2022-10-18 19:13:35 -07:00
Kelebek1
c6d4071162 Remove pause callbacks from coretiming 2022-09-13 13:20:35 +01:00
Maide
68dcd946b7 Revert Coretiming PRs 8531 and 7454 (#8591) 2022-07-27 19:47:06 -04:00
Kelebek1
03de5e053d Rework CoreTiming 2022-07-10 06:59:40 +01:00
Fernando Sahmkow
95cb99b186 Core timing: use only one thread. 2022-07-02 23:02:16 +02:00
Fernando Sahmkow
3adeb694b0 Adress Feedback. 2022-06-30 10:18:56 +02:00
Fernando Sahmkow
0043292951 Core: Protect each event from race conditions within it. 2022-06-28 01:10:55 +02:00
Fernando Sahmkow
396cb575c9 Core: add missing include. 2022-06-28 01:10:55 +02:00
Fernando Sahmkow
ca686b6d07 Core: Reimplement Core Timing. 2022-06-28 01:10:50 +02:00
Morph
2b87305d31 general: Convert source file copyright comments over to SPDX
This formats all copyright comments according to SPDX formatting guidelines.
Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
2022-04-23 05:55:32 -04:00
bunnei
e1b3368c18 hle: kernel: Use std::mutex instead of spin locks for most kernel locking. 2022-04-11 21:13:40 -07:00
ameerj
d27abf5546 core: Remove unused includes 2021-11-03 21:42:57 -04:00
Lioncash
84b656fbbd core: Resolve misc cases of variable shadowing
Resolves shadowing warnings that aren't in a particularly large
subsection of core. Brings us closer to turning -Wshadow into an error.

All that remains now is for cases in the kernel (left untouched for now
since a big change by bunnei is pending), and a few left over in the
service code (will be tackled next).
2021-05-03 01:19:13 -04:00
Lioncash
29db886722 audio_core: Make shadowing and unused parameters errors
Moves the audio code closer to enabling warnings as errors in general.
2020-12-03 00:54:31 -05:00
Lioncash
7decda6bc2 core_timing: Make use of uintptr_t to represent user_data
Makes the interface future-proofed for supporting other platforms in the event we ever support platforms with differing pointer sizes. This way, we have a type in place that is always guaranteed to be able to represent a pointer exactly.
2020-07-27 21:21:01 -04:00
Lioncash
66e6dccc66 core_timing: Remove unused data member
Shrinks the size of the CoreTiming class by 8 bytes.
2020-07-15 19:41:37 -04:00
Lioncash
56054fe86d core_timing: Make TimedCallback take std::chrono::nanoseconds
Enforces our desired time units directly with a concrete type.
2020-07-15 19:41:22 -04:00
Lioncash
9e113a2b67 core_timing: Make use of std::chrono with ScheduleEvent 2020-07-15 18:54:15 -04:00
Fernando Sahmkow
78a23536d4 Audio: Correct buffer release for host timing. 2020-06-27 11:36:23 -04:00
Fernando Sahmkow
f0f2fc4243 SingleCore: Use Cycle Timing instead of Host Timing. 2020-06-27 11:36:01 -04:00
Fernando Sahmkow
287ea2d3b4 SingleCore: Move Host Timing from a sepparate thread to main cpu thread. 2020-06-27 11:35:52 -04:00
Fernando Sahmkow
47c01e68da Kernel: Corrections to Scheduling. 2020-06-27 11:35:23 -04:00
Fernando Sahmkow
fb1d75a788 HostTiming: Pause the hardware clock on pause. 2020-06-27 11:35:10 -04:00
Fernando Sahmkow
7ee76003ad General: Recover Prometheus project from harddrive failure
This commit: Implements CPU Interrupts, Replaces Cycle Timing for Host 
Timing, Reworks the Kernel's Scheduler, Introduce Idle State and 
Suspended State, Recreates the bootmanager, Initializes Multicore 
system.
2020-06-27 11:35:06 -04:00
bunnei
8b35acbd29 core_timing: Use better reference tracking for EventType. (#3159)
* core_timing: Use better reference tracking for EventType.

- Moves ownership of the event to the caller, ensuring we don't fire events for destroyed objects.
- Removes need for unique names - we won't be using this for save states anyways.
2019-11-26 21:48:56 -05:00
Fernando Sahmkow
97669469d0 Core_Timing: Address Feedback and suppress warnings. 2019-10-11 14:44:14 -04:00
Fernando Sahmkow
e96ac0e2a3 Core Timing: General corrections and added tests. 2019-10-09 12:30:33 -04:00
Fernando Sahmkow
93a18da674 Core Timing: Rework Core Timing to run all cores evenly. 2019-10-09 12:30:31 -04:00
Fernando Sahmkow
16ee1b7006 Core_Timing: Make core_timing threadsafe by default.
The old implementation had faulty Threadsafe methods where events could
be missing. This implementation unifies unsafe/safe methods and makes
core timing thread safe overall.
2019-06-16 14:14:35 -04:00
Lioncash
7739479e15 core/core_timing: Make callback parameters consistent
In some cases, our callbacks were using s64 as a parameter, and in other
cases, they were using an int, which is inconsistent.

To make all callbacks consistent, we can just use an s64 as the type for
late cycles, given it gets rid of the need to cast internally.

While we're at it, also resolve some signed/unsigned conversions that
were occurring related to the callback registration.
2019-03-24 18:12:17 -04:00
Lioncash
1c3371c921 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.
2019-02-15 21:50:25 -05:00
Lioncash
1d2de5c4b5 core_timing: Rename CoreTiming namespace to Core::Timing
Places all of the timing-related functionality under the existing Core
namespace to keep things consistent, rather than having the timing
utilities sitting in its own completely separate namespace.
2019-02-12 12:42:17 -05:00
B3n30
8d6b45cd43 Core::CoreTiming: add UnscheduleEventThreadsafe 2018-08-13 13:56:41 +02:00
bunnei
51c6d09680 Merge pull request #934 from lioncash/chrono
core_timing: Make GetGlobalTimeUs() return std::chrono::microseconds
2018-08-06 18:03:05 -04:00
Lioncash
c34ee8cf08 core_timing: Make GetGlobalTimeUs() return std::chrono::microseconds
Enforces the time unit being returned and also allows using the standard
time utilities to manipulate it.
2018-08-05 22:07:30 -04:00