Skip to content

Commit

Permalink
mini-cleanup and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
reinago committed Dec 20, 2023
1 parent 6e6b8e4 commit 0c7d90e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
1 change: 0 additions & 1 deletion frontend/main/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ int main(const int argc, const char** argv) {

const auto render_next_frame = [&]() -> bool {
#ifdef MEGAMOL_USE_TRACY
// I guess this is redundant now
ZoneScopedNC("RenderNextFrame", 0x0000FF);
#endif
#ifdef MEGAMOL_USE_PROFILING
Expand Down
2 changes: 1 addition & 1 deletion frontend/resources/include/FrameStatsCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ static std::string FrameStatsCallbacks_Req_Name = "FrameStatsCallbacks";
struct FrameStatsCallbacks {
std::function<void()> mark_frame;
};
}
} // namespace megamol::frontend_resources
2 changes: 1 addition & 1 deletion frontend/resources/include/WindowManipulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

#pragma once

#include "GL_STUB.h"
#include "FrameStatsCallbacks.h"
#include "GL_STUB.h"

namespace megamol::frontend_resources {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ void FrameStatistics_Service::mark_frame_cb() {
// drop the oldest, add the newest: moving sum
m_frame_times_sum = m_frame_times_sum + m_statistics.last_rendered_frame_time_microseconds.count() - oldest_sample;
// which do we want, the one where an expensive first frame creates a visible perf dip that is not mitigated by "zero cost" previous frames...
m_statistics.last_averaged_mspf = static_cast<double>(m_frame_times_sum) /
static_cast<double>(std::min(m_frame_times_micro.size(), m_statistics.rendered_frames_count)) / 1000.0;
m_statistics.last_averaged_mspf =
static_cast<double>(m_frame_times_sum) /
static_cast<double>(std::min(m_frame_times_micro.size(), m_statistics.rendered_frames_count)) / 1000.0;
// ... or the old implementation, that starts averaging over the whole buffer from the beginning
//m_statistics.last_averaged_mspf = static_cast<double>(m_frame_times_sum) /
// static_cast<double>(m_frame_times_micro.size()) / 1000.0;
Expand Down
7 changes: 4 additions & 3 deletions frontend/services/opengl_glfw/gl/OpenGL_GLFW_Service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
// clang-format on

#include "FrameStatistics.h"
#include "ModuleGraphSubscription.h"
#include "FrameStatsCallbacks.h"
#include "ModuleGraphSubscription.h"
#include "mmcore/utility/log/Log.h"

#ifdef _WIN32
Expand Down Expand Up @@ -585,8 +585,9 @@ bool OpenGL_GLFW_Service::init(const Config& config) {
{frontend_resources::WindowManipulation_Req_Name, m_windowManipulation},
{frontend_resources::OpenGL_Helper_Req_Name, m_opengl_helper}};

m_requestedResourcesNames = {
"FrameStatistics", "FramebufferEvents", frontend_resources::MegaMolGraph_SubscriptionRegistry_Req_Name, frontend_resources::FrameStatsCallbacks_Req_Name};
m_requestedResourcesNames = {"FrameStatistics", "FramebufferEvents",
frontend_resources::MegaMolGraph_SubscriptionRegistry_Req_Name,
frontend_resources::FrameStatsCallbacks_Req_Name};

m_pimpl->last_time = std::chrono::system_clock::now();

Expand Down
2 changes: 1 addition & 1 deletion frontend/services/profiling_service/Profiling_Service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bool Profiling_Service::init(void* configPtr) {

_providedResourceReferences = {{frontend_resources::performance::PerformanceManager_Req_Name, _perf_man},
{frontend_resources::performance::Performance_Logging_Status_Req_Name, profiling_logging},
{frontend_resources::performance::Profiling_Callbacks_Req_Name, profiling_callbacks}};
{frontend_resources::performance::Profiling_Callbacks_Req_Name, profiling_callbacks}};

const auto conf = static_cast<Config*>(configPtr);
profiling_logging.active = conf->autostart_profiling;
Expand Down

0 comments on commit 0c7d90e

Please sign in to comment.