Blender  V3.3
deg_debug.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2013 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
11 #include "intern/depsgraph_type.h"
12 
13 #include "BKE_global.h"
14 
15 #include "DEG_depsgraph_debug.h"
16 
17 namespace blender::deg {
18 
20  public:
22 
23  bool do_time_debug() const;
24 
26  void end_graph_evaluation();
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  string name;
34 
35  /* Is true when dependency graph was evaluated at least once.
36  * This is NOT an indication that depsgraph is at its evaluated state. */
38 
39  protected:
40  /* Maximum number of counters used to calculate frame rate of depsgraph update. */
41  static const constexpr int MAX_FPS_COUNTERS = 64;
42 
43  /* Point in time when last graph evaluation began.
44  * Is initialized from begin_graph_evaluation() when time debug is enabled.
45  */
47 
49 };
50 
51 #define DEG_DEBUG_PRINTF(depsgraph, type, ...) \
52  do { \
53  if (DEG_debug_flags_get(depsgraph) & G_DEBUG_DEPSGRAPH_##type) { \
54  DEG_debug_print_begin(depsgraph); \
55  fprintf(stdout, __VA_ARGS__); \
56  } \
57  } while (0)
58 
59 #define DEG_GLOBAL_DEBUG_PRINTF(type, ...) \
60  do { \
61  if (G.debug & G_DEBUG_DEPSGRAPH_##type) { \
62  fprintf(stdout, __VA_ARGS__); \
63  } \
64  } while (0)
65 
66 #define DEG_ERROR_PRINTF(...) \
67  do { \
68  fprintf(stderr, __VA_ARGS__); \
69  fflush(stderr); \
70  } while (0)
71 
72 bool terminal_do_color(void);
73 string color_for_pointer(const void *pointer);
74 string color_end(void);
75 
76 } // namespace blender::deg
AveragedTimeSampler< MAX_FPS_COUNTERS > fps_samples_
Definition: deg_debug.h:48
static constexpr const int MAX_FPS_COUNTERS
Definition: deg_debug.h:41
bool terminal_do_color()
Definition: deg_debug.cc:59
string color_for_pointer(const void *pointer)
Definition: deg_debug.cc:64
string color_end()
Definition: deg_debug.cc:76