diff options
| author | 2016-04-29 00:07:10 -0700 | |
|---|---|---|
| committer | 2016-04-29 00:07:10 -0700 | |
| commit | e3a8292495cf0fb4297be27c696649dc44e011f0 (patch) | |
| tree | f188b106e2d1b39ed7a87972db9f942e15987375 | |
| parent | Make Citra build with MICROPROFILE_ENABLED set to 0 (#1709) (diff) | |
| download | yuzu-e3a8292495cf0fb4297be27c696649dc44e011f0.tar.gz yuzu-e3a8292495cf0fb4297be27c696649dc44e011f0.tar.xz yuzu-e3a8292495cf0fb4297be27c696649dc44e011f0.zip | |
Common: Remove section measurement from profiler (#1731)
This has been entirely superseded by MicroProfile. The rest of the code
can go when a simpler frametime/FPS meter is added to the GUI.
| -rw-r--r-- | src/citra_qt/debugger/profiler.cpp | 26 | ||||
| -rw-r--r-- | src/common/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/common/microprofileui.h | 3 | ||||
| -rw-r--r-- | src/common/profiler.cpp | 82 | ||||
| -rw-r--r-- | src/common/profiler.h | 152 | ||||
| -rw-r--r-- | src/common/profiler_reporting.h | 27 | ||||
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 7 | ||||
| -rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/svc.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/command_processor.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/rasterizer.cpp | 3 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/shader/shader.cpp | 3 |
13 files changed, 8 insertions, 306 deletions
diff --git a/src/citra_qt/debugger/profiler.cpp b/src/citra_qt/debugger/profiler.cpp index e90973b8e..7bb010f77 100644 --- a/src/citra_qt/debugger/profiler.cpp +++ b/src/citra_qt/debugger/profiler.cpp | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include "citra_qt/debugger/profiler.h" | 9 | #include "citra_qt/debugger/profiler.h" |
| 10 | #include "citra_qt/util/util.h" | 10 | #include "citra_qt/util/util.h" |
| 11 | 11 | ||
| 12 | #include "common/common_types.h" | ||
| 12 | #include "common/microprofile.h" | 13 | #include "common/microprofile.h" |
| 13 | #include "common/profiler_reporting.h" | 14 | #include "common/profiler_reporting.h" |
| 14 | 15 | ||
| @@ -36,21 +37,9 @@ static QVariant GetDataForColumn(int col, const AggregatedDuration& duration) | |||
| 36 | } | 37 | } |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | static const TimingCategoryInfo* GetCategoryInfo(int id) | ||
| 40 | { | ||
| 41 | const auto& categories = GetProfilingManager().GetTimingCategoriesInfo(); | ||
| 42 | if ((size_t)id >= categories.size()) { | ||
| 43 | return nullptr; | ||
| 44 | } else { | ||
| 45 | return &categories[id]; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | ProfilerModel::ProfilerModel(QObject* parent) : QAbstractItemModel(parent) | 40 | ProfilerModel::ProfilerModel(QObject* parent) : QAbstractItemModel(parent) |
| 50 | { | 41 | { |
| 51 | updateProfilingInfo(); | 42 | updateProfilingInfo(); |
| 52 | const auto& categories = GetProfilingManager().GetTimingCategoriesInfo(); | ||
| 53 | results.time_per_category.resize(categories.size()); | ||
| 54 | } | 43 | } |
| 55 | 44 | ||
| 56 | QVariant ProfilerModel::headerData(int section, Qt::Orientation orientation, int role) const | 45 | QVariant ProfilerModel::headerData(int section, Qt::Orientation orientation, int role) const |
| @@ -87,7 +76,7 @@ int ProfilerModel::rowCount(const QModelIndex& parent) const | |||
| 87 | if (parent.isValid()) { | 76 | if (parent.isValid()) { |
| 88 | return 0; | 77 | return 0; |
| 89 | } else { | 78 | } else { |
| 90 | return static_cast<int>(results.time_per_category.size() + 2); | 79 | return 2; |
| 91 | } | 80 | } |
| 92 | } | 81 | } |
| 93 | 82 | ||
| @@ -106,17 +95,6 @@ QVariant ProfilerModel::data(const QModelIndex& index, int role) const | |||
| 106 | } else { | 95 | } else { |
| 107 | return GetDataForColumn(index.column(), results.interframe_time); | 96 | return GetDataForColumn(index.column(), results.interframe_time); |
| 108 | } | 97 | } |
| 109 | } else { | ||
| 110 | if (index.column() == 0) { | ||
| 111 | const TimingCategoryInfo* info = GetCategoryInfo(index.row() - 2); | ||
| 112 | return info != nullptr ? QString(info->name) : QVariant(); | ||
| 113 | } else { | ||
| 114 | if (index.row() - 2 < (int)results.time_per_category.size()) { | ||
| 115 | return GetDataForColumn(index.column(), results.time_per_category[index.row() - 2]); | ||
| 116 | } else { | ||
| 117 | return QVariant(); | ||
| 118 | } | ||
| 119 | } | ||
| 120 | } | 98 | } |
| 121 | } | 99 | } |
| 122 | 100 | ||
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index c839ce173..aa6eee2a3 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -47,7 +47,6 @@ set(HEADERS | |||
| 47 | microprofile.h | 47 | microprofile.h |
| 48 | microprofileui.h | 48 | microprofileui.h |
| 49 | platform.h | 49 | platform.h |
| 50 | profiler.h | ||
| 51 | profiler_reporting.h | 50 | profiler_reporting.h |
| 52 | scm_rev.h | 51 | scm_rev.h |
| 53 | scope_exit.h | 52 | scope_exit.h |
diff --git a/src/common/microprofileui.h b/src/common/microprofileui.h index 97c369bd9..41abe6b75 100644 --- a/src/common/microprofileui.h +++ b/src/common/microprofileui.h | |||
| @@ -13,4 +13,7 @@ | |||
| 13 | #define MICROPROFILE_HELP_ALT "Right-Click" | 13 | #define MICROPROFILE_HELP_ALT "Right-Click" |
| 14 | #define MICROPROFILE_HELP_MOD "Ctrl" | 14 | #define MICROPROFILE_HELP_MOD "Ctrl" |
| 15 | 15 | ||
| 16 | // This isn't included by microprofileui.h :( | ||
| 17 | #include <cstdlib> // For std::abs | ||
| 18 | |||
| 16 | #include <microprofileui.h> | 19 | #include <microprofileui.h> |
diff --git a/src/common/profiler.cpp b/src/common/profiler.cpp index 7792edd2f..49eb3f40c 100644 --- a/src/common/profiler.cpp +++ b/src/common/profiler.cpp | |||
| @@ -7,71 +7,16 @@ | |||
| 7 | #include <vector> | 7 | #include <vector> |
| 8 | 8 | ||
| 9 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| 10 | #include "common/profiler.h" | ||
| 11 | #include "common/profiler_reporting.h" | 10 | #include "common/profiler_reporting.h" |
| 12 | #include "common/synchronized_wrapper.h" | 11 | #include "common/synchronized_wrapper.h" |
| 13 | 12 | ||
| 14 | #if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013. | ||
| 15 | #define WIN32_LEAN_AND_MEAN | ||
| 16 | #include <Windows.h> // For QueryPerformanceCounter/Frequency | ||
| 17 | #endif | ||
| 18 | |||
| 19 | namespace Common { | 13 | namespace Common { |
| 20 | namespace Profiling { | 14 | namespace Profiling { |
| 21 | 15 | ||
| 22 | #if ENABLE_PROFILING | ||
| 23 | thread_local Timer* Timer::current_timer = nullptr; | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013 | ||
| 27 | QPCClock::time_point QPCClock::now() { | ||
| 28 | static LARGE_INTEGER freq; | ||
| 29 | // Use this dummy local static to ensure this gets initialized once. | ||
| 30 | static BOOL dummy = QueryPerformanceFrequency(&freq); | ||
| 31 | |||
| 32 | LARGE_INTEGER ticks; | ||
| 33 | QueryPerformanceCounter(&ticks); | ||
| 34 | |||
| 35 | // This is prone to overflow when multiplying, which is why I'm using micro instead of nano. The | ||
| 36 | // correct way to approach this would be to just return ticks as a time_point and then subtract | ||
| 37 | // and do this conversion when creating a duration from two time_points, however, as far as I | ||
| 38 | // could tell the C++ requirements for these types are incompatible with this approach. | ||
| 39 | return time_point(duration(ticks.QuadPart * std::micro::den / freq.QuadPart)); | ||
| 40 | } | ||
| 41 | #endif | ||
| 42 | |||
| 43 | TimingCategory::TimingCategory(const char* name, TimingCategory* parent) | ||
| 44 | : accumulated_duration(0) { | ||
| 45 | |||
| 46 | ProfilingManager& manager = GetProfilingManager(); | ||
| 47 | category_id = manager.RegisterTimingCategory(this, name); | ||
| 48 | if (parent != nullptr) | ||
| 49 | manager.SetTimingCategoryParent(category_id, parent->category_id); | ||
| 50 | } | ||
| 51 | |||
| 52 | ProfilingManager::ProfilingManager() | 16 | ProfilingManager::ProfilingManager() |
| 53 | : last_frame_end(Clock::now()), this_frame_start(Clock::now()) { | 17 | : last_frame_end(Clock::now()), this_frame_start(Clock::now()) { |
| 54 | } | 18 | } |
| 55 | 19 | ||
| 56 | unsigned int ProfilingManager::RegisterTimingCategory(TimingCategory* category, const char* name) { | ||
| 57 | TimingCategoryInfo info; | ||
| 58 | info.category = category; | ||
| 59 | info.name = name; | ||
| 60 | info.parent = TimingCategoryInfo::NO_PARENT; | ||
| 61 | |||
| 62 | unsigned int id = (unsigned int)timing_categories.size(); | ||
| 63 | timing_categories.push_back(std::move(info)); | ||
| 64 | |||
| 65 | return id; | ||
| 66 | } | ||
| 67 | |||
| 68 | void ProfilingManager::SetTimingCategoryParent(unsigned int category, unsigned int parent) { | ||
| 69 | ASSERT(category < timing_categories.size()); | ||
| 70 | ASSERT(parent < timing_categories.size()); | ||
| 71 | |||
| 72 | timing_categories[category].parent = parent; | ||
| 73 | } | ||
| 74 | |||
| 75 | void ProfilingManager::BeginFrame() { | 20 | void ProfilingManager::BeginFrame() { |
| 76 | this_frame_start = Clock::now(); | 21 | this_frame_start = Clock::now(); |
| 77 | } | 22 | } |
| @@ -82,11 +27,6 @@ void ProfilingManager::FinishFrame() { | |||
| 82 | results.interframe_time = now - last_frame_end; | 27 | results.interframe_time = now - last_frame_end; |
| 83 | results.frame_time = now - this_frame_start; | 28 | results.frame_time = now - this_frame_start; |
| 84 | 29 | ||
| 85 | results.time_per_category.resize(timing_categories.size()); | ||
| 86 | for (size_t i = 0; i < timing_categories.size(); ++i) { | ||
| 87 | results.time_per_category[i] = timing_categories[i].category->GetAccumulatedTime(); | ||
| 88 | } | ||
| 89 | |||
| 90 | last_frame_end = now; | 30 | last_frame_end = now; |
| 91 | } | 31 | } |
| 92 | 32 | ||
| @@ -100,26 +40,9 @@ void TimingResultsAggregator::Clear() { | |||
| 100 | window_size = cursor = 0; | 40 | window_size = cursor = 0; |
| 101 | } | 41 | } |
| 102 | 42 | ||
| 103 | void TimingResultsAggregator::SetNumberOfCategories(size_t n) { | ||
| 104 | size_t old_size = times_per_category.size(); | ||
| 105 | if (n == old_size) | ||
| 106 | return; | ||
| 107 | |||
| 108 | times_per_category.resize(n); | ||
| 109 | |||
| 110 | for (size_t i = old_size; i < n; ++i) { | ||
| 111 | times_per_category[i].resize(max_window_size, Duration::zero()); | ||
| 112 | } | ||
| 113 | } | ||
| 114 | |||
| 115 | void TimingResultsAggregator::AddFrame(const ProfilingFrameResult& frame_result) { | 43 | void TimingResultsAggregator::AddFrame(const ProfilingFrameResult& frame_result) { |
| 116 | SetNumberOfCategories(frame_result.time_per_category.size()); | ||
| 117 | |||
| 118 | interframe_times[cursor] = frame_result.interframe_time; | 44 | interframe_times[cursor] = frame_result.interframe_time; |
| 119 | frame_times[cursor] = frame_result.frame_time; | 45 | frame_times[cursor] = frame_result.frame_time; |
| 120 | for (size_t i = 0; i < frame_result.time_per_category.size(); ++i) { | ||
| 121 | times_per_category[i][cursor] = frame_result.time_per_category[i]; | ||
| 122 | } | ||
| 123 | 46 | ||
| 124 | ++cursor; | 47 | ++cursor; |
| 125 | if (cursor == max_window_size) | 48 | if (cursor == max_window_size) |
| @@ -162,11 +85,6 @@ AggregatedFrameResult TimingResultsAggregator::GetAggregatedResults() const { | |||
| 162 | result.fps = 0.0f; | 85 | result.fps = 0.0f; |
| 163 | } | 86 | } |
| 164 | 87 | ||
| 165 | result.time_per_category.resize(times_per_category.size()); | ||
| 166 | for (size_t i = 0; i < times_per_category.size(); ++i) { | ||
| 167 | result.time_per_category[i] = AggregateField(times_per_category[i], window_size); | ||
| 168 | } | ||
| 169 | |||
| 170 | return result; | 88 | return result; |
| 171 | } | 89 | } |
| 172 | 90 | ||
diff --git a/src/common/profiler.h b/src/common/profiler.h deleted file mode 100644 index 3e967b4bc..000000000 --- a/src/common/profiler.h +++ /dev/null | |||
| @@ -1,152 +0,0 @@ | |||
| 1 | // Copyright 2015 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <atomic> | ||
| 8 | #include <chrono> | ||
| 9 | |||
| 10 | #include "common/assert.h" | ||
| 11 | #include "common/thread.h" | ||
| 12 | |||
| 13 | namespace Common { | ||
| 14 | namespace Profiling { | ||
| 15 | |||
| 16 | // If this is defined to 0, it turns all Timers into no-ops. | ||
| 17 | #ifndef ENABLE_PROFILING | ||
| 18 | #define ENABLE_PROFILING 1 | ||
| 19 | #endif | ||
| 20 | |||
| 21 | #if defined(_MSC_VER) && _MSC_VER <= 1800 // MSVC 2013 | ||
| 22 | // MSVC up to 2013 doesn't use QueryPerformanceCounter for high_resolution_clock, so it has bad | ||
| 23 | // precision. We manually implement a clock based on QPC to get good results. | ||
| 24 | |||
| 25 | struct QPCClock { | ||
| 26 | using duration = std::chrono::microseconds; | ||
| 27 | using time_point = std::chrono::time_point<QPCClock>; | ||
| 28 | using rep = duration::rep; | ||
| 29 | using period = duration::period; | ||
| 30 | static const bool is_steady = false; | ||
| 31 | |||
| 32 | static time_point now(); | ||
| 33 | }; | ||
| 34 | |||
| 35 | using Clock = QPCClock; | ||
| 36 | #else | ||
| 37 | using Clock = std::chrono::high_resolution_clock; | ||
| 38 | #endif | ||
| 39 | |||
| 40 | using Duration = Clock::duration; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * Represents a timing category that measured time can be accounted towards. Should be declared as a | ||
| 44 | * global variable and passed to Timers. | ||
| 45 | */ | ||
| 46 | class TimingCategory final { | ||
| 47 | public: | ||
| 48 | TimingCategory(const char* name, TimingCategory* parent = nullptr); | ||
| 49 | |||
| 50 | unsigned int GetCategoryId() const { | ||
| 51 | return category_id; | ||
| 52 | } | ||
| 53 | |||
| 54 | /// Adds some time to this category. Can safely be called from multiple threads at the same time. | ||
| 55 | void AddTime(Duration amount) { | ||
| 56 | std::atomic_fetch_add_explicit( | ||
| 57 | &accumulated_duration, amount.count(), | ||
| 58 | std::memory_order_relaxed); | ||
| 59 | } | ||
| 60 | |||
| 61 | /** | ||
| 62 | * Atomically retrieves the accumulated measured time for this category and resets the counter | ||
| 63 | * to zero. Can be safely called concurrently with AddTime. | ||
| 64 | */ | ||
| 65 | Duration GetAccumulatedTime() { | ||
| 66 | return Duration(std::atomic_exchange_explicit( | ||
| 67 | &accumulated_duration, (Duration::rep)0, | ||
| 68 | std::memory_order_relaxed)); | ||
| 69 | } | ||
| 70 | |||
| 71 | private: | ||
| 72 | unsigned int category_id; | ||
| 73 | std::atomic<Duration::rep> accumulated_duration; | ||
| 74 | }; | ||
| 75 | |||
| 76 | /** | ||
| 77 | * Measures time elapsed between a call to Start and a call to Stop and attributes it to the given | ||
| 78 | * TimingCategory. Start/Stop can be called multiple times on the same timer, but each call must be | ||
| 79 | * appropriately paired. | ||
| 80 | * | ||
| 81 | * When a Timer is started, it automatically pauses a previously running timer on the same thread, | ||
| 82 | * which is resumed when it is stopped. As such, no special action needs to be taken to avoid | ||
| 83 | * double-accounting of time on two categories. | ||
| 84 | */ | ||
| 85 | class Timer { | ||
| 86 | public: | ||
| 87 | Timer(TimingCategory& category) : category(category) { | ||
| 88 | } | ||
| 89 | |||
| 90 | void Start() { | ||
| 91 | #if ENABLE_PROFILING | ||
| 92 | ASSERT(!running); | ||
| 93 | previous_timer = current_timer; | ||
| 94 | current_timer = this; | ||
| 95 | if (previous_timer != nullptr) | ||
| 96 | previous_timer->StopTiming(); | ||
| 97 | |||
| 98 | StartTiming(); | ||
| 99 | #endif | ||
| 100 | } | ||
| 101 | |||
| 102 | void Stop() { | ||
| 103 | #if ENABLE_PROFILING | ||
| 104 | ASSERT(running); | ||
| 105 | StopTiming(); | ||
| 106 | |||
| 107 | if (previous_timer != nullptr) | ||
| 108 | previous_timer->StartTiming(); | ||
| 109 | current_timer = previous_timer; | ||
| 110 | #endif | ||
| 111 | } | ||
| 112 | |||
| 113 | private: | ||
| 114 | #if ENABLE_PROFILING | ||
| 115 | void StartTiming() { | ||
| 116 | start = Clock::now(); | ||
| 117 | running = true; | ||
| 118 | } | ||
| 119 | |||
| 120 | void StopTiming() { | ||
| 121 | auto duration = Clock::now() - start; | ||
| 122 | running = false; | ||
| 123 | category.AddTime(std::chrono::duration_cast<Duration>(duration)); | ||
| 124 | } | ||
| 125 | |||
| 126 | Clock::time_point start; | ||
| 127 | bool running = false; | ||
| 128 | |||
| 129 | Timer* previous_timer; | ||
| 130 | static thread_local Timer* current_timer; | ||
| 131 | #endif | ||
| 132 | |||
| 133 | TimingCategory& category; | ||
| 134 | }; | ||
| 135 | |||
| 136 | /** | ||
| 137 | * A Timer that automatically starts timing when created and stops at the end of the scope. Should | ||
| 138 | * be used in the majority of cases. | ||
| 139 | */ | ||
| 140 | class ScopeTimer : public Timer { | ||
| 141 | public: | ||
| 142 | ScopeTimer(TimingCategory& category) : Timer(category) { | ||
| 143 | Start(); | ||
| 144 | } | ||
| 145 | |||
| 146 | ~ScopeTimer() { | ||
| 147 | Stop(); | ||
| 148 | } | ||
| 149 | }; | ||
| 150 | |||
| 151 | } // namespace Profiling | ||
| 152 | } // namespace Common | ||
diff --git a/src/common/profiler_reporting.h b/src/common/profiler_reporting.h index df98e05b7..fa1ac883f 100644 --- a/src/common/profiler_reporting.h +++ b/src/common/profiler_reporting.h | |||
| @@ -4,22 +4,17 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <chrono> | ||
| 7 | #include <cstddef> | 8 | #include <cstddef> |
| 8 | #include <vector> | 9 | #include <vector> |
| 9 | 10 | ||
| 10 | #include "common/profiler.h" | ||
| 11 | #include "common/synchronized_wrapper.h" | 11 | #include "common/synchronized_wrapper.h" |
| 12 | 12 | ||
| 13 | namespace Common { | 13 | namespace Common { |
| 14 | namespace Profiling { | 14 | namespace Profiling { |
| 15 | 15 | ||
| 16 | struct TimingCategoryInfo { | 16 | using Clock = std::chrono::high_resolution_clock; |
| 17 | static const unsigned int NO_PARENT = -1; | 17 | using Duration = Clock::duration; |
| 18 | |||
| 19 | TimingCategory* category; | ||
| 20 | const char* name; | ||
| 21 | unsigned int parent; | ||
| 22 | }; | ||
| 23 | 18 | ||
| 24 | struct ProfilingFrameResult { | 19 | struct ProfilingFrameResult { |
| 25 | /// Time since the last delivered frame | 20 | /// Time since the last delivered frame |
| @@ -27,22 +22,12 @@ struct ProfilingFrameResult { | |||
| 27 | 22 | ||
| 28 | /// Time spent processing a frame, excluding VSync | 23 | /// Time spent processing a frame, excluding VSync |
| 29 | Duration frame_time; | 24 | Duration frame_time; |
| 30 | |||
| 31 | /// Total amount of time spent inside each category in this frame. Indexed by the category id | ||
| 32 | std::vector<Duration> time_per_category; | ||
| 33 | }; | 25 | }; |
| 34 | 26 | ||
| 35 | class ProfilingManager final { | 27 | class ProfilingManager final { |
| 36 | public: | 28 | public: |
| 37 | ProfilingManager(); | 29 | ProfilingManager(); |
| 38 | 30 | ||
| 39 | unsigned int RegisterTimingCategory(TimingCategory* category, const char* name); | ||
| 40 | void SetTimingCategoryParent(unsigned int category, unsigned int parent); | ||
| 41 | |||
| 42 | const std::vector<TimingCategoryInfo>& GetTimingCategoriesInfo() const { | ||
| 43 | return timing_categories; | ||
| 44 | } | ||
| 45 | |||
| 46 | /// This should be called after swapping screen buffers. | 31 | /// This should be called after swapping screen buffers. |
| 47 | void BeginFrame(); | 32 | void BeginFrame(); |
| 48 | /// This should be called before swapping screen buffers. | 33 | /// This should be called before swapping screen buffers. |
| @@ -54,7 +39,6 @@ public: | |||
| 54 | } | 39 | } |
| 55 | 40 | ||
| 56 | private: | 41 | private: |
| 57 | std::vector<TimingCategoryInfo> timing_categories; | ||
| 58 | Clock::time_point last_frame_end; | 42 | Clock::time_point last_frame_end; |
| 59 | Clock::time_point this_frame_start; | 43 | Clock::time_point this_frame_start; |
| 60 | 44 | ||
| @@ -73,9 +57,6 @@ struct AggregatedFrameResult { | |||
| 73 | AggregatedDuration frame_time; | 57 | AggregatedDuration frame_time; |
| 74 | 58 | ||
| 75 | float fps; | 59 | float fps; |
| 76 | |||
| 77 | /// Total amount of time spent inside each category in this frame. Indexed by the category id | ||
| 78 | std::vector<AggregatedDuration> time_per_category; | ||
| 79 | }; | 60 | }; |
| 80 | 61 | ||
| 81 | class TimingResultsAggregator final { | 62 | class TimingResultsAggregator final { |
| @@ -83,7 +64,6 @@ public: | |||
| 83 | TimingResultsAggregator(size_t window_size); | 64 | TimingResultsAggregator(size_t window_size); |
| 84 | 65 | ||
| 85 | void Clear(); | 66 | void Clear(); |
| 86 | void SetNumberOfCategories(size_t n); | ||
| 87 | 67 | ||
| 88 | void AddFrame(const ProfilingFrameResult& frame_result); | 68 | void AddFrame(const ProfilingFrameResult& frame_result); |
| 89 | 69 | ||
| @@ -95,7 +75,6 @@ public: | |||
| 95 | 75 | ||
| 96 | std::vector<Duration> interframe_times; | 76 | std::vector<Duration> interframe_times; |
| 97 | std::vector<Duration> frame_times; | 77 | std::vector<Duration> frame_times; |
| 98 | std::vector<std::vector<Duration>> times_per_category; | ||
| 99 | }; | 78 | }; |
| 100 | 79 | ||
| 101 | ProfilingManager& GetProfilingManager(); | 80 | ProfilingManager& GetProfilingManager(); |
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 647784208..8d4b26815 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -10,7 +10,6 @@ | |||
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 12 | #include "common/microprofile.h" | 12 | #include "common/microprofile.h" |
| 13 | #include "common/profiler.h" | ||
| 14 | 13 | ||
| 15 | #include "core/memory.h" | 14 | #include "core/memory.h" |
| 16 | #include "core/hle/svc.h" | 15 | #include "core/hle/svc.h" |
| @@ -25,9 +24,6 @@ | |||
| 25 | 24 | ||
| 26 | #include "core/gdbstub/gdbstub.h" | 25 | #include "core/gdbstub/gdbstub.h" |
| 27 | 26 | ||
| 28 | Common::Profiling::TimingCategory profile_execute("DynCom::Execute"); | ||
| 29 | Common::Profiling::TimingCategory profile_decode("DynCom::Decode"); | ||
| 30 | |||
| 31 | enum { | 27 | enum { |
| 32 | COND = (1 << 0), | 28 | COND = (1 << 0), |
| 33 | NON_BRANCH = (1 << 1), | 29 | NON_BRANCH = (1 << 1), |
| @@ -3496,7 +3492,6 @@ static unsigned int InterpreterTranslateInstruction(const ARMul_State* cpu, cons | |||
| 3496 | } | 3492 | } |
| 3497 | 3493 | ||
| 3498 | static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr) { | 3494 | static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr) { |
| 3499 | Common::Profiling::ScopeTimer timer_decode(profile_decode); | ||
| 3500 | MICROPROFILE_SCOPE(DynCom_Decode); | 3495 | MICROPROFILE_SCOPE(DynCom_Decode); |
| 3501 | 3496 | ||
| 3502 | // Decode instruction, get index | 3497 | // Decode instruction, get index |
| @@ -3530,7 +3525,6 @@ static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr) | |||
| 3530 | } | 3525 | } |
| 3531 | 3526 | ||
| 3532 | static int InterpreterTranslateSingle(ARMul_State* cpu, int& bb_start, u32 addr) { | 3527 | static int InterpreterTranslateSingle(ARMul_State* cpu, int& bb_start, u32 addr) { |
| 3533 | Common::Profiling::ScopeTimer timer_decode(profile_decode); | ||
| 3534 | MICROPROFILE_SCOPE(DynCom_Decode); | 3528 | MICROPROFILE_SCOPE(DynCom_Decode); |
| 3535 | 3529 | ||
| 3536 | ARM_INST_PTR inst_base = nullptr; | 3530 | ARM_INST_PTR inst_base = nullptr; |
| @@ -3565,7 +3559,6 @@ static int clz(unsigned int x) { | |||
| 3565 | MICROPROFILE_DEFINE(DynCom_Execute, "DynCom", "Execute", MP_RGB(255, 0, 0)); | 3559 | MICROPROFILE_DEFINE(DynCom_Execute, "DynCom", "Execute", MP_RGB(255, 0, 0)); |
| 3566 | 3560 | ||
| 3567 | unsigned InterpreterMainLoop(ARMul_State* cpu) { | 3561 | unsigned InterpreterMainLoop(ARMul_State* cpu) { |
| 3568 | Common::Profiling::ScopeTimer timer_execute(profile_execute); | ||
| 3569 | MICROPROFILE_SCOPE(DynCom_Execute); | 3562 | MICROPROFILE_SCOPE(DynCom_Execute); |
| 3570 | 3563 | ||
| 3571 | GDBStub::BreakpointAddress breakpoint_data; | 3564 | GDBStub::BreakpointAddress breakpoint_data; |
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index 211fcf599..233592d7f 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include "common/bit_field.h" | 5 | #include "common/bit_field.h" |
| 6 | #include "common/microprofile.h" | 6 | #include "common/microprofile.h" |
| 7 | #include "common/profiler.h" | ||
| 8 | 7 | ||
| 9 | #include "core/memory.h" | 8 | #include "core/memory.h" |
| 10 | #include "core/hle/kernel/event.h" | 9 | #include "core/hle/kernel/event.h" |
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index ae54afb1c..a9a1a3244 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | #include "common/microprofile.h" | 8 | #include "common/microprofile.h" |
| 9 | #include "common/profiler.h" | ||
| 10 | #include "common/string_util.h" | 9 | #include "common/string_util.h" |
| 11 | #include "common/symbols.h" | 10 | #include "common/symbols.h" |
| 12 | 11 | ||
| @@ -1031,8 +1030,6 @@ static const FunctionDef SVC_Table[] = { | |||
| 1031 | {0x7D, HLE::Wrap<QueryProcessMemory>, "QueryProcessMemory"}, | 1030 | {0x7D, HLE::Wrap<QueryProcessMemory>, "QueryProcessMemory"}, |
| 1032 | }; | 1031 | }; |
| 1033 | 1032 | ||
| 1034 | Common::Profiling::TimingCategory profiler_svc("SVC Calls"); | ||
| 1035 | |||
| 1036 | static const FunctionDef* GetSVCInfo(u32 func_num) { | 1033 | static const FunctionDef* GetSVCInfo(u32 func_num) { |
| 1037 | if (func_num >= ARRAY_SIZE(SVC_Table)) { | 1034 | if (func_num >= ARRAY_SIZE(SVC_Table)) { |
| 1038 | LOG_ERROR(Kernel_SVC, "unknown svc=0x%02X", func_num); | 1035 | LOG_ERROR(Kernel_SVC, "unknown svc=0x%02X", func_num); |
| @@ -1044,7 +1041,6 @@ static const FunctionDef* GetSVCInfo(u32 func_num) { | |||
| 1044 | MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70)); | 1041 | MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70)); |
| 1045 | 1042 | ||
| 1046 | void CallSVC(u32 immediate) { | 1043 | void CallSVC(u32 immediate) { |
| 1047 | Common::Profiling::ScopeTimer timer_svc(profiler_svc); | ||
| 1048 | MICROPROFILE_SCOPE(Kernel_SVC); | 1044 | MICROPROFILE_SCOPE(Kernel_SVC); |
| 1049 | 1045 | ||
| 1050 | const FunctionDef* info = GetSVCInfo(immediate); | 1046 | const FunctionDef* info = GetSVCInfo(immediate); |
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 3abe79c09..97ba8214e 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | #include "common/alignment.h" | 8 | #include "common/alignment.h" |
| 9 | #include "common/microprofile.h" | 9 | #include "common/microprofile.h" |
| 10 | #include "common/profiler.h" | ||
| 11 | 10 | ||
| 12 | #include "core/settings.h" | 11 | #include "core/settings.h" |
| 13 | #include "core/hle/service/gsp_gpu.h" | 12 | #include "core/hle/service/gsp_gpu.h" |
| @@ -35,8 +34,6 @@ static int default_attr_counter = 0; | |||
| 35 | 34 | ||
| 36 | static u32 default_attr_write_buffer[3]; | 35 | static u32 default_attr_write_buffer[3]; |
| 37 | 36 | ||
| 38 | Common::Profiling::TimingCategory category_drawing("Drawing"); | ||
| 39 | |||
| 40 | // Expand a 4-bit mask to 4-byte mask, e.g. 0b0101 -> 0x00FF00FF | 37 | // Expand a 4-bit mask to 4-byte mask, e.g. 0b0101 -> 0x00FF00FF |
| 41 | static const u32 expand_bits_to_bytes[] = { | 38 | static const u32 expand_bits_to_bytes[] = { |
| 42 | 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, | 39 | 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, |
| @@ -186,7 +183,6 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 186 | case PICA_REG_INDEX(trigger_draw): | 183 | case PICA_REG_INDEX(trigger_draw): |
| 187 | case PICA_REG_INDEX(trigger_draw_indexed): | 184 | case PICA_REG_INDEX(trigger_draw_indexed): |
| 188 | { | 185 | { |
| 189 | Common::Profiling::ScopeTimer scope_timer(category_drawing); | ||
| 190 | MICROPROFILE_SCOPE(GPU_Drawing); | 186 | MICROPROFILE_SCOPE(GPU_Drawing); |
| 191 | 187 | ||
| 192 | #if PICA_LOG_TEV | 188 | #if PICA_LOG_TEV |
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 0434ad05a..9cf77b1f2 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "common/math_util.h" | 10 | #include "common/math_util.h" |
| 11 | #include "common/microprofile.h" | 11 | #include "common/microprofile.h" |
| 12 | #include "common/profiler.h" | ||
| 13 | 12 | ||
| 14 | #include "core/memory.h" | 13 | #include "core/memory.h" |
| 15 | #include "core/hw/gpu.h" | 14 | #include "core/hw/gpu.h" |
| @@ -287,7 +286,6 @@ static int SignedArea (const Math::Vec2<Fix12P4>& vtx1, | |||
| 287 | return Math::Cross(vec1, vec2).z; | 286 | return Math::Cross(vec1, vec2).z; |
| 288 | }; | 287 | }; |
| 289 | 288 | ||
| 290 | static Common::Profiling::TimingCategory rasterization_category("Rasterization"); | ||
| 291 | MICROPROFILE_DEFINE(GPU_Rasterization, "GPU", "Rasterization", MP_RGB(50, 50, 240)); | 289 | MICROPROFILE_DEFINE(GPU_Rasterization, "GPU", "Rasterization", MP_RGB(50, 50, 240)); |
| 292 | 290 | ||
| 293 | /** | 291 | /** |
| @@ -300,7 +298,6 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, | |||
| 300 | bool reversed = false) | 298 | bool reversed = false) |
| 301 | { | 299 | { |
| 302 | const auto& regs = g_state.regs; | 300 | const auto& regs = g_state.regs; |
| 303 | Common::Profiling::ScopeTimer timer(rasterization_category); | ||
| 304 | MICROPROFILE_SCOPE(GPU_Rasterization); | 301 | MICROPROFILE_SCOPE(GPU_Rasterization); |
| 305 | 302 | ||
| 306 | // vertex positions in rasterizer coordinates | 303 | // vertex positions in rasterizer coordinates |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 30187d4cf..a8c775c80 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | #include "common/file_util.h" | 11 | #include "common/file_util.h" |
| 12 | #include "common/math_util.h" | 12 | #include "common/math_util.h" |
| 13 | #include "common/microprofile.h" | 13 | #include "common/microprofile.h" |
| 14 | #include "common/profiler.h" | ||
| 15 | 14 | ||
| 16 | #include "core/memory.h" | 15 | #include "core/memory.h" |
| 17 | #include "core/settings.h" | 16 | #include "core/settings.h" |
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index 75301accd..043e99190 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | 9 | ||
| 10 | #include "common/hash.h" | 10 | #include "common/hash.h" |
| 11 | #include "common/microprofile.h" | 11 | #include "common/microprofile.h" |
| 12 | #include "common/profiler.h" | ||
| 13 | 12 | ||
| 14 | #include "video_core/debug_utils/debug_utils.h" | 13 | #include "video_core/debug_utils/debug_utils.h" |
| 15 | #include "video_core/pica.h" | 14 | #include "video_core/pica.h" |
| @@ -57,13 +56,11 @@ void Shutdown() { | |||
| 57 | #endif // ARCHITECTURE_x86_64 | 56 | #endif // ARCHITECTURE_x86_64 |
| 58 | } | 57 | } |
| 59 | 58 | ||
| 60 | static Common::Profiling::TimingCategory shader_category("Vertex Shader"); | ||
| 61 | MICROPROFILE_DEFINE(GPU_VertexShader, "GPU", "Vertex Shader", MP_RGB(50, 50, 240)); | 59 | MICROPROFILE_DEFINE(GPU_VertexShader, "GPU", "Vertex Shader", MP_RGB(50, 50, 240)); |
| 62 | 60 | ||
| 63 | OutputVertex Run(UnitState<false>& state, const InputVertex& input, int num_attributes) { | 61 | OutputVertex Run(UnitState<false>& state, const InputVertex& input, int num_attributes) { |
| 64 | auto& config = g_state.regs.vs; | 62 | auto& config = g_state.regs.vs; |
| 65 | 63 | ||
| 66 | Common::Profiling::ScopeTimer timer(shader_category); | ||
| 67 | MICROPROFILE_SCOPE(GPU_VertexShader); | 64 | MICROPROFILE_SCOPE(GPU_VertexShader); |
| 68 | 65 | ||
| 69 | state.program_counter = config.main_offset; | 66 | state.program_counter = config.main_offset; |