Blender V5.0
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 /* NOTE: Corresponds to G_DEBUG_DEPSGRAPH_* flags. */
27 int flags;
28
29 /* Name of this dependency graph (is used for debug prints, helping to distinguish graphs
30 * created for different view layer). */
31 std::string name;
32
33 protected:
34 /* Maximum number of counters used to calculate frame rate of depsgraph update. */
35 static const constexpr int MAX_FPS_COUNTERS = 64;
36
37 /* Point in time when last graph evaluation began.
38 * Is initialized from begin_graph_evaluation() when time debug is enabled.
39 */
41};
42
43#define DEG_DEBUG_PRINTF(depsgraph, type, ...) \
44 do { \
45 if (DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_##type) { \
46 DEG_debug_print_begin(depsgraph); \
47 fprintf(stdout, __VA_ARGS__); \
48 } \
49 } while (0)
50
51#define DEG_GLOBAL_DEBUG_PRINTF(type, ...) \
52 do { \
53 if (G.debug & G_DEBUG_DEPSGRAPH_##type) { \
54 fprintf(stdout, __VA_ARGS__); \
55 } \
56 } while (0)
57
58#define DEG_ERROR_PRINTF(...) \
59 do { \
60 fprintf(stderr, __VA_ARGS__); \
61 fflush(stderr); \
62 } while (0)
63
65std::string color_for_pointer(const void *pointer);
66std::string color_end();
67
68} // namespace blender::deg
static const constexpr int MAX_FPS_COUNTERS
Definition deg_debug.h:35
std::string color_end()
Definition deg_debug.cc:72
bool terminal_do_color()
Definition deg_debug.cc:55
std::string color_for_pointer(const void *pointer)
Definition deg_debug.cc:60