Depsgraph: Remove misleading FPS counter

It was weird concept which was calculating scene FPS, but from
the depgraph side. It was misleading, especially for the initial
evaluation of FPS of nan.

If we want FPS counters this needs to be done on a higher level
in the code.

Pull Request: https://projects.blender.org/blender/blender/pulls/114782
This commit is contained in:
Sergey Sharybin
2023-11-13 11:50:20 +01:00
committed by Gitea
parent db16038f4f
commit 0746435cdd
4 changed files with 1 additions and 79 deletions

View File

@@ -116,7 +116,6 @@ set(SRC
intern/builder/pipeline_render.h
intern/builder/pipeline_view_layer.h
intern/debug/deg_debug.h
intern/debug/deg_time_average.h
intern/eval/deg_eval.h
intern/eval/deg_eval_copy_on_write.h
intern/eval/deg_eval_flush.h

View File

@@ -21,10 +21,7 @@
namespace blender::deg {
DepsgraphDebug::DepsgraphDebug()
: flags(G.debug), is_ever_evaluated(false), graph_evaluation_start_time_(0)
{
}
DepsgraphDebug::DepsgraphDebug() : flags(G.debug), graph_evaluation_start_time_(0) {}
bool DepsgraphDebug::do_time_debug() const
{
@@ -39,10 +36,6 @@ void DepsgraphDebug::begin_graph_evaluation()
const double current_time = PIL_check_seconds_timer();
if (is_ever_evaluated) {
fps_samples_.add_sample(current_time - graph_evaluation_start_time_);
}
graph_evaluation_start_time_ = current_time;
}
@@ -55,19 +48,12 @@ void DepsgraphDebug::end_graph_evaluation()
const double graph_eval_end_time = PIL_check_seconds_timer();
const double graph_eval_time = graph_eval_end_time - graph_evaluation_start_time_;
const double fps_samples = fps_samples_.get_averaged();
const double fps = fps_samples ? 1.0 / fps_samples_.get_averaged() : 0.0;
if (name.empty()) {
printf("Depsgraph updated in %f seconds.\n", graph_eval_time);
printf("Depsgraph evaluation FPS: %f\n", fps);
}
else {
printf("Depsgraph [%s] updated in %f seconds.\n", name.c_str(), graph_eval_time);
printf("Depsgraph [%s] evaluation FPS: %f\n", name.c_str(), fps);
}
is_ever_evaluated = true;
}
bool terminal_do_color()

View File

@@ -8,7 +8,6 @@
#pragma once
#include "intern/debug/deg_time_average.h"
#include "intern/depsgraph_type.hh"
#include "BKE_global.h"
@@ -33,10 +32,6 @@ class DepsgraphDebug {
* created for different view layer). */
string name;
/* Is true when dependency graph was evaluated at least once.
* This is NOT an indication that depsgraph is at its evaluated state. */
bool is_ever_evaluated;
protected:
/* Maximum number of counters used to calculate frame rate of depsgraph update. */
static const constexpr int MAX_FPS_COUNTERS = 64;
@@ -45,8 +40,6 @@ class DepsgraphDebug {
* Is initialized from begin_graph_evaluation() when time debug is enabled.
*/
double graph_evaluation_start_time_;
AveragedTimeSampler<MAX_FPS_COUNTERS> fps_samples_;
};
#define DEG_DEBUG_PRINTF(depsgraph, type, ...) \

View File

@@ -1,56 +0,0 @@
/* SPDX-FileCopyrightText: 2013 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup depsgraph
*/
#pragma once
namespace blender::deg {
/* Utility class which takes care of calculating average of time series, such as FPS counters. */
template<int MaxSamples> class AveragedTimeSampler {
public:
AveragedTimeSampler() : num_samples_(0), next_sample_index_(0) {}
void add_sample(double value)
{
samples_[next_sample_index_] = value;
/* Move to the next index, keeping wrapping at the end of array into account. */
++next_sample_index_;
if (next_sample_index_ == MaxSamples) {
next_sample_index_ = 0;
}
/* Update number of stored samples. */
if (num_samples_ != MaxSamples) {
++num_samples_;
}
}
double get_averaged() const
{
if (!num_samples_) {
return 0.0;
}
double sum = 0.0;
for (int i = 0; i < num_samples_; ++i) {
sum += samples_[i];
}
return sum / num_samples_;
}
protected:
double samples_[MaxSamples];
/* Number of samples which are actually stored in the array. */
int num_samples_;
/* Index in the samples_ array under which next sample will be stored. */
int next_sample_index_;
};
} // namespace blender::deg