aboutsummaryrefslogtreecommitdiff
path: root/src/common/thread.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [core, gpu, threads] Multithreading refactor (#4254)CamilleLaVey2026-08-081-33/+505
| | | | | | This insufferable work tries to cover some holes on previous threading implementation from yuzu's team, starting with Windows and Linux reordering of priorities (NICE), reworks previous Android's threading and cpu affinity with adpf, adjust emulated clocks/gpu for better "accuracy" with their work, bumps android minSDK for all flavors, legacy will now work with AP 29 to cover A10 - A12, standard will reach A13 as base and finally the optimized build will come with API 35, mostly targeted on devices with A15 support and newer, NDK and AGP wasn't upgraded yet. The performance cost efficiency have been improved based on device power configuration; preventing overheating if certain devices tended to fall into NICE0 (not allocated threads priority, all task ran with higher priority, 11 tasks running within the limited 2 - 7 threads available on the most common configuration 1x3x4 or 1x4x3). Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4254
* [common/thread] fix MSVC build error with _rdstc (#4029)lizzie2026-05-311-0/+9
| | | | | | | | | | fixes issue reported by @bruno Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4029 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev>
* [core/core_timing] better MWAITX and WAITPKG delays (#3984)lizzie2026-05-301-2/+104
| | | | | | | | | | | | | This implements MWAITX and WAITPKG extensions (umonitor, mwait) for CPUs that support them. Reduces wait times and bypasses the timing stuff from the OS that is slow (windows notably). generally it should answer within 0.2 to 0.5 microsecs (since most requests wait for that long). Also does a general rework of static ctors and stuff Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3984 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev>
* [common/logging] Simplify logging logic and fix issues when logging before ↵lizzie2026-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | system is created (#3688) - our logging code was bigger than spdlog itself, why???? just keep it simple - fix issues when logging before logging system is even started - removes the "initialized logging twice" issue - removes uneeded indirection in file logging - uses direct formatting instead of jumping hoopla-around the fmt::format() ressult - code duplication and dead code removal as usual I did explore dup2() but I think it's not worth the hassle I did try `fwopen()` but it's better if things are just kept as-is. there is a lot of noise because I removed a bunch of redundant files on logging and just put everything in one file now normally this wouldn't be a good idea, however consider: the complexity of logging; it's less than 500 lines... does it really need a whole subsystem?!?!?! ITS JUST LOGGING Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3688 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: DraVee <chimera@dravee.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [ports] build fixes for *BSD make (#3496)lizzie2026-03-081-1/+3
| | | | | | | | | Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3496 Reviewed-by: DraVee <chimera@dravee.dev> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [android, core] pin core threads to logical CPUs 0-3 (#3121)lizzie2026-02-011-17/+38
| | | | | | | | | | | | | | | | this basically allows the threads to exist in these logical CPUs, undisturbed, and without trashing each other's cache this could improve performance, very tricky thing to pull off correctly, but again, this is mostly an experiment will mainly benefit: Linux, Android, FreeBSD, Windows (not ARM) Additionally, this means no context trashing :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3121 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [port] windows 7 support (#3105)lizzie2025-11-301-3/+2
| | | | | | | | | Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3105 Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [compat] Windows 8.1 support (#2772)lizzie2025-11-031-1/+4
| | | | | | | | | | Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2772 Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [cmake, docs] msys: allow bundled FFmpeg, update dep/caveat docs, faster ↵crueter2025-11-021-1/+1
| | | | | | | | | linking on Release mode (#2921) Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2921 Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: Lizzie <lizzie@eden-emu.dev>
* [compat] HaikuOS port (#2805)lizzie2025-10-221-33/+29
| | | | | | | | | | | Still had the issues with libusb, but that should get solved with the other PRs anyways Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2805 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [compat] improve thread naming logic (#271)lizzie2025-10-071-18/+18
| | | | | | | | | Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/271 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [meta] fix license headers (#2547)lizzie2025-09-211-0/+3
| | | | | | | Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2547 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [cmake] enable clang-cl and WoA builds (#348)lizzie2025-09-091-2/+2
| | | | | | | | | | | | | | Compilation and CMake fixes for both Windows on ARM and clang-cl, meaning Windows can now be built on both MSVC and clang on both amd64 and aarch64. Compiling on clang is *dramatically* faster so this should be useful for CI. Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: crueter <crueter@crueter.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/348 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* common: use SetThreadDescription API for thread namesLiam2023-10-201-22/+2
|
* Core: Fix tests.Fernando Sahmkow2022-06-281-2/+1
|
* Core/Common: Corrections to core timing and add critical priority.Fernando Sahmkow2022-06-281-4/+9
|
* chore: add missing SPDX tagsAndrea Pappacoda2022-04-281-3/+3
| | | | Follow-up to 2b87305d319f0bd04da36fb96314934f37b12637
* common: Move error handling to error.cpp/hMorph2021-09-111-3/+3
| | | | This allows us to avoid implicitly including <string> every time common_funcs.h is included.
* Fix thread naming on Linux, which limits names to 15 bytes.comex2020-08-051-0/+12
| | | | | | | | | | | | | | | - In `SetCurrentThreadName`, when on Linux, truncate to 15 bytes, as (at least on glibc) `pthread_set_name_np` will otherwise return `ERANGE` and do nothing. - Also, add logging in case `pthread_set_name_np` returns an error anyway. This is Linux-specific, as the Apple and BSD versions of `pthread_set_name_np return `void`. - Change the name for CPU threads in multi-core mode from "yuzu:CoreCPUThread_N" (19 bytes) to "yuzu:CPUCore_N" (14 bytes) so it fits into the Linux limit. Some other thread names are also cut off, but I didn't bother addressing them as you can guess them from the truncated versions. For a CPU thread, truncation means you can't see which core it is!
* Clang Format.Fernando Sahmkow2020-06-271-15/+15
|
* General: Tune the priority of main emulation threads so they have higher ↵Fernando Sahmkow2020-06-271-0/+46
| | | | priority than less important helper threads.
* General: Recover Prometheus project from harddrive failure Fernando Sahmkow2020-06-271-0/+6
| | | | | | | 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.
* common: Port some changes from dolphin (#5127)Vitor K2020-04-011-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * IOFile: Make the move constructor and move assignment operator noexcept Certain parts of the standard library try to determine whether or not a transfer operation should either be a copy or a move. The prevalent notion of move constructors/assignment operators is that they should not throw, they simply move an already existing resource somewhere else. This is typically done with 'std::move_if_noexcept'. Like the name says, if a type's move constructor is noexcept, then the functions retrieves an r-value reference (for move semantics), or an l-value (for copy semantics) if it is not noexcept. As IOFile deletes the copy constructor and copy assignment operators, using IOFile with certain parts of the standard library can fail in unexcepted ways (especially when used with various container implementations). This prevents that. * fix various instances of -1 being assigned to unsigned types * do not assign in conditional statements * File/IOFile: Check _tfopen_s properly * common/file_util.cpp: address review comments Co-authored-by: Lioncash <mathew1800@gmail.com> Co-authored-by: Shawn Hoffman <godisgovernment@gmail.com> Co-authored-by: Sepalani <sepalani@hotmail.fr>
* common/thread: Remove unused functionsLioncash2019-03-291-37/+0
| | | | | | | | | | Many of these functions are carried over from Dolphin (where they aren't used anymore). Given these have no use (and we really shouldn't be screwing around with OS-specific thread scheduler handling from the emulator, these can be removed. The function for setting the thread name is left, however, since it can have debugging utility usages.
* common/thread: Drop Hungarian notation on SetCurrentThreadName's parameterLioncash2018-11-221-7/+7
| | | | This is inconsistent with our coding style.
* common/thread: Remove SleepCurrentThread()Lioncash2018-11-211-11/+0
| | | | | | | This is also unused and superceded by standard functionality. The standard library provides std::this_thread::sleep_for(), which provides a much more flexible interface, as different time units can be used with it.
* common/thread: Remove unused CurrentThreadId()Lioncash2018-11-211-10/+0
| | | | | | This is an old function that's no longer necessary. C++11 introduced proper threading support to the language and a thread ID can be retrieved via std::this_thread::get_id() if it's ever needed.
* Support mingw cross-compileJannik Vogel2016-12-051-1/+1
|
* common: only FreeBSD has thread affinity compatible with LinuxJan Beich2016-10-271-1/+5
| | | | | | | | | | | src/common/thread.cpp:90:5: error: unknown type name 'cpu_set_t'; did you mean 'cpuset_t'? cpu_set_t cpu_set; ^~~~~~~~~ cpuset_t /usr/include/sys/_cpuset.h:48:24: note: 'cpuset_t' declared here typedef struct _cpuset cpuset_t; ^ 1 error generated.
* common: define routines to set thread name on more BSDsJan Beich2016-10-271-2/+4
| | | | | | | src/common/thread.cpp:123:5: error: use of undeclared identifier 'pthread_setname_np' pthread_setname_np(pthread_self(), szThreadName); ^ 1 error generated.
* Remove empty newlines in #include blocks.Emmanuel Gil Peyrot2016-09-211-2/+0
| | | | | | | This makes clang-format useful on those. Also add a bunch of forgotten transitive includes, which otherwise prevented compilation.
* Sources: Run clang-format on everything.Emmanuel Gil Peyrot2016-09-181-48/+32
|
* Common: Cleanup thread includes.Emmanuel Gil Peyrot2015-06-281-4/+13
|
* Fix MSVC-related #defines and add CMakeLists commentdarkf2014-12-291-3/+3
|
* Fix merge conflictsdarkf2014-12-291-2/+2
|\
| * License changepurpasmart962014-12-201-2/+2
| |
* | Fix MinGW builddarkf2014-11-281-8/+15
|/
* Remove trailing spaces in every file but the ones imported from SkyEye, AOSP ↵Emmanuel Gil Peyrot2014-11-191-3/+3
| | | | or generated
* common: Prune all redundant includesarchshift2014-09-081-1/+0
|
* Removed common/std_xyz, instead using the std headerarchshift2014-09-071-4/+2
|
* Use pthread_set_name_np() on OpenBSD.Anthony J. Bentley2014-08-071-1/+3
|
* fixed project includes to use new directory structurebunnei2014-04-081-2/+2
|
* got rid of 'src' folders in each sub-projectbunnei2014-04-081-0/+133