Blender V5.3
deg_debug.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2013 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include <string>
12
13#include "BKE_global.hh" // IWYU pragma: keep
14
15namespace blender::deg {
16
18 public:
20
21 bool do_time_debug() const;
22
25
26 double total_evaluation_time() const;
27
28 /* NOTE: Corresponds to G_DEBUG_DEPSGRAPH_* flags. */
29 int flags;
30
31 /* Name of this dependency graph (is used for debug prints, helping to distinguish graphs
32 * created for different view layer). */
33 std::string name;
34
35 protected:
36 /* Maximum number of counters used to calculate frame rate of depsgraph update. */
37 static const constexpr int MAX_FPS_COUNTERS = 64;
38
39 /* Point in time when last graph evaluation began.
40 * Is initialized from begin_graph_evaluation().
41 */
43 /* Total time of the last evaluation. */
45};
46
47#define DEG_DEBUG_PRINTF(depsgraph, type, ...) \
48 do { \
49 if (DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_##type) { \
50 DEG_debug_print_begin(depsgraph); \
51 fprintf(stdout, __VA_ARGS__); \
52 } \
53 } while (0)
54
55#define DEG_GLOBAL_DEBUG_PRINTF(type, ...) \
56 do { \
57 if (G.debug & G_DEBUG_DEPSGRAPH_##type) { \
58 fprintf(stdout, __VA_ARGS__); \
59 } \
60 } while (0)
61
62#define DEG_ERROR_PRINTF(...) \
63 do { \
64 fprintf(stderr, __VA_ARGS__); \
65 fflush(stderr); \
66 } while (0)
67
69std::string color_for_pointer(const void *pointer);
70std::string color_end();
71
72} // namespace blender::deg
static const constexpr int MAX_FPS_COUNTERS
Definition deg_debug.h:37
double total_evaluation_time() const
Definition deg_debug.cc:51
std::string color_end()
Definition deg_debug.cc:73
bool terminal_do_color()
Definition deg_debug.cc:56
std::string color_for_pointer(const void *pointer)
Definition deg_debug.cc:61