Blender
V5.0
source
blender
compositor
COM_profiler.hh
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2024 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
5
#pragma once
6
7
#include "
BLI_map.hh
"
8
#include "
BLI_timeit.hh
"
9
10
#include "
DNA_node_types.h
"
11
12
namespace
blender::compositor
{
13
14
class
Context
;
15
16
/* -------------------------------------------------------------------------------------------------
17
* Profiler
18
*
19
* A class that profiles the evaluation of the compositor and tracks information like the
20
* evaluation time of every node. */
21
class
Profiler
{
22
private
:
23
/* Stores the evaluation time of each node instance keyed by its instance key. Note that
24
* pixel-wise nodes like Math nodes will not be measured, that's because they are compiled
25
* together with other pixel-wise operations in a single operation, so we can't measure the
26
* evaluation time of each individual node. */
27
Map<bNodeInstanceKey, timeit::Nanoseconds>
nodes_evaluation_times_;
28
29
public
:
30
/* Returns a reference to the nodes evaluation times. */
31
Map<bNodeInstanceKey, timeit::Nanoseconds>
&
get_nodes_evaluation_times
();
32
33
/* Set the evaluation time of the node identified by the given node instance key. */
34
void
set_node_evaluation_time
(
bNodeInstanceKey
node_instance_key,
timeit::Nanoseconds
time);
35
36
/* Finalize profiling by computing node group times. This should be called after evaluation. */
37
void
finalize
(
const
bNodeTree
&node_tree);
38
39
private
:
40
/* Computes the evaluation time of every group node inside the given tree recursively by
41
* accumulating the evaluation time of its nodes, setting the computed time to the group nodes.
42
* The time is returned since the method is called recursively. */
43
timeit::Nanoseconds
accumulate_node_group_times(
const
bNodeTree
&node_tree,
44
bNodeInstanceKey
instance_key);
45
};
46
47
}
// namespace blender::compositor
BLI_map.hh
BLI_timeit.hh
DNA_node_types.h
blender::Map
Definition
BLI_map.hh:129
blender::compositor::Context
Definition
COM_context.hh:44
blender::compositor::Profiler
Definition
COM_profiler.hh:21
blender::compositor::Profiler::finalize
void finalize(const bNodeTree &node_tree)
Definition
profiler.cc:65
blender::compositor::Profiler::set_node_evaluation_time
void set_node_evaluation_time(bNodeInstanceKey node_instance_key, timeit::Nanoseconds time)
Definition
profiler.cc:22
blender::compositor::Profiler::get_nodes_evaluation_times
Map< bNodeInstanceKey, timeit::Nanoseconds > & get_nodes_evaluation_times()
Definition
profiler.cc:17
blender::compositor
Definition
BKE_node.hh:77
blender::timeit::Nanoseconds
std::chrono::nanoseconds Nanoseconds
Definition
BLI_timeit.hh:21
bNodeInstanceKey
Definition
DNA_node_types.h:654
bNodeTree
Definition
DNA_node_types.h:759
Generated on
for Blender by
doxygen
1.16.1