summaryrefslogtreecommitdiffstats
path: root/src/core/core_timing.cpp
diff options
context:
space:
mode:
authorMerryMage <MerryMage@users.noreply.github.com>2018-07-24 12:03:24 +0200
committerMerryMage <MerryMage@users.noreply.github.com>2018-07-24 12:03:24 +0200
commit44646e2ea0b87dffd9a1d175c53e3cea67bce344 (patch)
treefd2dcd57424487cf054d98a018ae9d5c62cfd60a /src/core/core_timing.cpp
parentCMakeLists: Sort filenames (diff)
downloadyuzu-44646e2ea0b87dffd9a1d175c53e3cea67bce344.tar
yuzu-44646e2ea0b87dffd9a1d175c53e3cea67bce344.tar.gz
yuzu-44646e2ea0b87dffd9a1d175c53e3cea67bce344.tar.bz2
yuzu-44646e2ea0b87dffd9a1d175c53e3cea67bce344.tar.lz
yuzu-44646e2ea0b87dffd9a1d175c53e3cea67bce344.tar.xz
yuzu-44646e2ea0b87dffd9a1d175c53e3cea67bce344.tar.zst
yuzu-44646e2ea0b87dffd9a1d175c53e3cea67bce344.zip
Diffstat (limited to '')
-rw-r--r--src/core/core_timing.cpp53
1 files changed, 1 insertions, 52 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 50d1e3fc9..a1b6f96f1 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -5,17 +5,15 @@
#include "core/core_timing.h"
#include <algorithm>
-#include <cinttypes>
-#include <limits>
#include <mutex>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#include "common/assert.h"
-#include "common/logging/log.h"
#include "common/thread.h"
#include "common/threadsafe_queue.h"
+#include "core/core_timing_util.h"
namespace CoreTiming {
@@ -59,7 +57,6 @@ static u64 event_fifo_id;
static Common::MPSCQueue<Event, false> ts_queue;
constexpr int MAX_SLICE_LENGTH = 20000;
-constexpr u64 MAX_VALUE_TO_MULTIPLY = std::numeric_limits<s64>::max() / BASE_CLOCK_RATE;
static s64 idled_cycles;
@@ -72,54 +69,6 @@ static EventType* ev_lost = nullptr;
static void EmptyTimedCallback(u64 userdata, s64 cyclesLate) {}
-s64 usToCycles(s64 us) {
- if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
- LOG_ERROR(Core_Timing, "Integer overflow, use max value");
- return std::numeric_limits<s64>::max();
- }
- if (us > MAX_VALUE_TO_MULTIPLY) {
- LOG_DEBUG(Core_Timing, "Time very big, do rounding");
- return BASE_CLOCK_RATE * (us / 1000000);
- }
- return (BASE_CLOCK_RATE * us) / 1000000;
-}
-
-s64 usToCycles(u64 us) {
- if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
- LOG_ERROR(Core_Timing, "Integer overflow, use max value");
- return std::numeric_limits<s64>::max();
- }
- if (us > MAX_VALUE_TO_MULTIPLY) {
- LOG_DEBUG(Core_Timing, "Time very big, do rounding");
- return BASE_CLOCK_RATE * static_cast<s64>(us / 1000000);
- }
- return (BASE_CLOCK_RATE * static_cast<s64>(us)) / 1000000;
-}
-
-s64 nsToCycles(s64 ns) {
- if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
- LOG_ERROR(Core_Timing, "Integer overflow, use max value");
- return std::numeric_limits<s64>::max();
- }
- if (ns > MAX_VALUE_TO_MULTIPLY) {
- LOG_DEBUG(Core_Timing, "Time very big, do rounding");
- return BASE_CLOCK_RATE * (ns / 1000000000);
- }
- return (BASE_CLOCK_RATE * ns) / 1000000000;
-}
-
-s64 nsToCycles(u64 ns) {
- if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
- LOG_ERROR(Core_Timing, "Integer overflow, use max value");
- return std::numeric_limits<s64>::max();
- }
- if (ns > MAX_VALUE_TO_MULTIPLY) {
- LOG_DEBUG(Core_Timing, "Time very big, do rounding");
- return BASE_CLOCK_RATE * (static_cast<s64>(ns) / 1000000000);
- }
- return (BASE_CLOCK_RATE * static_cast<s64>(ns)) / 1000000000;
-}
-
EventType* RegisterEvent(const std::string& name, TimedCallback callback) {
// check for existing type with same name.
// we want event type names to remain unique so that we can use them for serialization.