Listing the "Blender Foundation" as copyright holder implied the Blender Foundation holds copyright to files which may include work from many developers. While keeping copyright on headers makes sense for isolated libraries, Blender's own code may be refactored or moved between files in a way that makes the per file copyright holders less meaningful. Copyright references to the "Blender Foundation" have been replaced with "Blender Authors", with the exception of `./extern/` since these this contains libraries which are more isolated, any changed to license headers there can be handled on a case-by-case basis. Some directories in `./intern/` have also been excluded: - `./intern/cycles/` it's own `AUTHORS` file is planned. - `./intern/opensubdiv/`. An "AUTHORS" file has been added, using the chromium projects authors file as a template. Design task: #110784 Ref !110783.
86 lines
1.7 KiB
C++
86 lines
1.7 KiB
C++
/* SPDX-FileCopyrightText: 2013 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup depsgraph
|
|
*/
|
|
|
|
#include "intern/debug/deg_debug.h"
|
|
|
|
#include "BLI_console.h"
|
|
#include "BLI_hash.h"
|
|
#include "BLI_string.h"
|
|
#include "BLI_utildefines.h"
|
|
|
|
#include "PIL_time_utildefines.h"
|
|
|
|
#include "BKE_global.h"
|
|
|
|
namespace blender::deg {
|
|
|
|
DepsgraphDebug::DepsgraphDebug()
|
|
: flags(G.debug), is_ever_evaluated(false), graph_evaluation_start_time_(0)
|
|
{
|
|
}
|
|
|
|
bool DepsgraphDebug::do_time_debug() const
|
|
{
|
|
return ((G.debug & G_DEBUG_DEPSGRAPH_TIME) != 0);
|
|
}
|
|
|
|
void DepsgraphDebug::begin_graph_evaluation()
|
|
{
|
|
if (!do_time_debug()) {
|
|
return;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
void DepsgraphDebug::end_graph_evaluation()
|
|
{
|
|
if (!do_time_debug()) {
|
|
return;
|
|
}
|
|
|
|
const double graph_eval_end_time = PIL_check_seconds_timer();
|
|
printf("Depsgraph updated in %f seconds.\n", graph_eval_end_time - graph_evaluation_start_time_);
|
|
printf("Depsgraph evaluation FPS: %f\n", 1.0f / fps_samples_.get_averaged());
|
|
|
|
is_ever_evaluated = true;
|
|
}
|
|
|
|
bool terminal_do_color()
|
|
{
|
|
return (G.debug & G_DEBUG_DEPSGRAPH_PRETTY) != 0;
|
|
}
|
|
|
|
string color_for_pointer(const void *pointer)
|
|
{
|
|
if (!terminal_do_color()) {
|
|
return "";
|
|
}
|
|
int r, g, b;
|
|
BLI_hash_pointer_to_color(pointer, &r, &g, &b);
|
|
char buffer[64];
|
|
SNPRINTF(buffer, TRUECOLOR_ANSI_COLOR_FORMAT, r, g, b);
|
|
return string(buffer);
|
|
}
|
|
|
|
string color_end()
|
|
{
|
|
if (!terminal_do_color()) {
|
|
return "";
|
|
}
|
|
return string(TRUECOLOR_ANSI_COLOR_FINISH);
|
|
}
|
|
|
|
} // namespace blender::deg
|