Blender
V4.3
source
blender
blenlib
BLI_memory_counter.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
11
#include "
BLI_function_ref.hh
"
12
#include "
BLI_implicit_sharing_ptr.hh
"
13
#include "
BLI_map.hh
"
14
#include "
BLI_memory_counter_fwd.hh
"
15
#include "
BLI_set.hh
"
16
#include "
BLI_vector_set.hh
"
17
18
namespace
blender::memory_counter
{
19
20
class
MemoryCount
{
21
public
:
29
int64_t
total_bytes
= 0;
30
31
Set<WeakImplicitSharingPtr>
handled_shared_data
;
32
33
void
reset
();
34
};
35
41
class
MemoryCounter
:
NonCopyable
,
NonMovable
{
42
private
:
43
MemoryCount
&count_;
44
45
public
:
46
MemoryCounter
(
MemoryCount
&
count
);
47
51
void
add
(
const
int64_t
bytes);
52
62
void
add_shared
(
const
ImplicitSharingInfo
*sharing_info,
63
const
FunctionRef
<
void
(
MemoryCounter
&shared_memory)> count_fn);
64
69
void
add_shared
(
const
ImplicitSharingInfo
*sharing_info,
const
int64_t
bytes);
70
};
71
72
}
// namespace blender::memory_counter
BLI_function_ref.hh
BLI_implicit_sharing_ptr.hh
BLI_map.hh
BLI_memory_counter_fwd.hh
BLI_set.hh
BLI_vector_set.hh
blender::FunctionRef
Definition
BLI_function_ref.hh:74
blender::ImplicitSharingInfo
Definition
BLI_implicit_sharing.hh:41
blender::NonCopyable
Definition
BLI_utility_mixins.hh:16
blender::NonMovable
Definition
BLI_utility_mixins.hh:31
blender::Set
Definition
BLI_set.hh:106
blender::memory_counter::MemoryCount
Definition
BLI_memory_counter.hh:20
blender::memory_counter::MemoryCount::handled_shared_data
Set< WeakImplicitSharingPtr > handled_shared_data
Definition
BLI_memory_counter.hh:31
blender::memory_counter::MemoryCount::total_bytes
int64_t total_bytes
Definition
BLI_memory_counter.hh:29
blender::memory_counter::MemoryCount::reset
void reset()
Definition
memory_counter.cc:39
blender::memory_counter::MemoryCounter
Definition
BLI_memory_counter.hh:41
blender::memory_counter::MemoryCounter::add
void add(const int64_t bytes)
Definition
memory_counter.cc:11
blender::memory_counter::MemoryCounter::add_shared
void add_shared(const ImplicitSharingInfo *sharing_info, const FunctionRef< void(MemoryCounter &shared_memory)> count_fn)
blender::memory_counter::MemoryCounter::MemoryCounter
MemoryCounter(MemoryCount &count)
Definition
memory_counter.cc:9
count
int count
Definition
interface_widgets.cc:1056
blender::memory_counter
Definition
BLI_memory_counter.hh:18
int64_t
__int64 int64_t
Definition
stdint.h:89
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0