diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/host_memory.cpp | 4 | ||||
| -rw-r--r-- | src/common/logging/filter.cpp | 1 | ||||
| -rw-r--r-- | src/common/logging/types.h | 1 | ||||
| -rw-r--r-- | src/common/x64/native_clock.cpp | 36 |
4 files changed, 24 insertions, 18 deletions
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp index b44a44949..28949fe5e 100644 --- a/src/common/host_memory.cpp +++ b/src/common/host_memory.cpp | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #ifdef _WIN32 | 5 | #ifdef _WIN32 |
| 2 | 6 | ||
| 3 | #include <iterator> | 7 | #include <iterator> |
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp index 42744c994..b898a652c 100644 --- a/src/common/logging/filter.cpp +++ b/src/common/logging/filter.cpp | |||
| @@ -114,6 +114,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) { | |||
| 114 | SUB(Service, NGCT) \ | 114 | SUB(Service, NGCT) \ |
| 115 | SUB(Service, NIFM) \ | 115 | SUB(Service, NIFM) \ |
| 116 | SUB(Service, NIM) \ | 116 | SUB(Service, NIM) \ |
| 117 | SUB(Service, NOTIF) \ | ||
| 117 | SUB(Service, NPNS) \ | 118 | SUB(Service, NPNS) \ |
| 118 | SUB(Service, NS) \ | 119 | SUB(Service, NS) \ |
| 119 | SUB(Service, NVDRV) \ | 120 | SUB(Service, NVDRV) \ |
diff --git a/src/common/logging/types.h b/src/common/logging/types.h index 2d21fc483..9ed0c7ad6 100644 --- a/src/common/logging/types.h +++ b/src/common/logging/types.h | |||
| @@ -82,6 +82,7 @@ enum class Class : u8 { | |||
| 82 | Service_NGCT, ///< The NGCT (No Good Content for Terra) service | 82 | Service_NGCT, ///< The NGCT (No Good Content for Terra) service |
| 83 | Service_NIFM, ///< The NIFM (Network interface) service | 83 | Service_NIFM, ///< The NIFM (Network interface) service |
| 84 | Service_NIM, ///< The NIM service | 84 | Service_NIM, ///< The NIM service |
| 85 | Service_NOTIF, ///< The NOTIF (Notification) service | ||
| 85 | Service_NPNS, ///< The NPNS service | 86 | Service_NPNS, ///< The NPNS service |
| 86 | Service_NS, ///< The NS services | 87 | Service_NS, ///< The NS services |
| 87 | Service_NVDRV, ///< The NVDRV (Nvidia driver) service | 88 | Service_NVDRV, ///< The NVDRV (Nvidia driver) service |
diff --git a/src/common/x64/native_clock.cpp b/src/common/x64/native_clock.cpp index 28f834443..82ee2c8a1 100644 --- a/src/common/x64/native_clock.cpp +++ b/src/common/x64/native_clock.cpp | |||
| @@ -15,26 +15,26 @@ | |||
| 15 | namespace Common { | 15 | namespace Common { |
| 16 | 16 | ||
| 17 | u64 EstimateRDTSCFrequency() { | 17 | u64 EstimateRDTSCFrequency() { |
| 18 | const auto milli_10 = std::chrono::milliseconds{10}; | 18 | // Discard the first result measuring the rdtsc. |
| 19 | // get current time | ||
| 20 | _mm_mfence(); | 19 | _mm_mfence(); |
| 21 | const u64 tscStart = __rdtsc(); | 20 | __rdtsc(); |
| 22 | const auto startTime = std::chrono::steady_clock::now(); | 21 | std::this_thread::sleep_for(std::chrono::milliseconds{1}); |
| 23 | // wait roughly 3 seconds | 22 | _mm_mfence(); |
| 24 | while (true) { | 23 | __rdtsc(); |
| 25 | auto milli = std::chrono::duration_cast<std::chrono::milliseconds>( | 24 | |
| 26 | std::chrono::steady_clock::now() - startTime); | 25 | // Get the current time. |
| 27 | if (milli.count() >= 3000) | 26 | const auto start_time = std::chrono::steady_clock::now(); |
| 28 | break; | 27 | _mm_mfence(); |
| 29 | std::this_thread::sleep_for(milli_10); | 28 | const u64 tsc_start = __rdtsc(); |
| 30 | } | 29 | // Wait for 200 milliseconds. |
| 31 | const auto endTime = std::chrono::steady_clock::now(); | 30 | std::this_thread::sleep_for(std::chrono::milliseconds{200}); |
| 31 | const auto end_time = std::chrono::steady_clock::now(); | ||
| 32 | _mm_mfence(); | 32 | _mm_mfence(); |
| 33 | const u64 tscEnd = __rdtsc(); | 33 | const u64 tsc_end = __rdtsc(); |
| 34 | // calculate difference | 34 | // Calculate differences. |
| 35 | const u64 timer_diff = | 35 | const u64 timer_diff = static_cast<u64>( |
| 36 | std::chrono::duration_cast<std::chrono::nanoseconds>(endTime - startTime).count(); | 36 | std::chrono::duration_cast<std::chrono::nanoseconds>(end_time - start_time).count()); |
| 37 | const u64 tsc_diff = tscEnd - tscStart; | 37 | const u64 tsc_diff = tsc_end - tsc_start; |
| 38 | const u64 tsc_freq = MultiplyAndDivide64(tsc_diff, 1000000000ULL, timer_diff); | 38 | const u64 tsc_freq = MultiplyAndDivide64(tsc_diff, 1000000000ULL, timer_diff); |
| 39 | return tsc_freq; | 39 | return tsc_freq; |
| 40 | } | 40 | } |