libbio
Loading...
Searching...
No Matches
AllocationStats.h
Go to the documentation of this file.
1/*
2 * This file is a part of the Biology project by eons LLC.
3 * Biology (aka Develop Biology) is a framework for approaching software
4 * development from a natural sciences perspective.
5 *
6 * Copyright (C) 2026 Séon O'Shannon & eons LLC
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as
10 * published by the Free Software Foundation, either version 3 of the
11 * License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
26#include <cstddef>
27
28//@formatter:off
29#if BIO_CPP_VERSION < 11
30 #include <stdint.h>
31#else
32 #include <cstdint>
33#endif
34//@formatter:on
35
36namespace bio {
37
61
62//@formatter:off
63#if BIO_ALLOCATION_STATS
64//@formatter:on
65
67
69
72 std::size_t stepSize
73);
74
76
78
81 std::size_t stepSize
82);
83
86 std::size_t stepSize,
87 bool reallocation = true
88);
89
91
93
95
97
99
100//@formatter:off
101#else
102//@formatter:on
103
104// Counters disabled (default, BIO_ALLOCATION_STATS=0): every Record* inlines to
105// nothing -- the optimizer elides each call site, removing the shared atomic
106// counters and the cross-thread false sharing they cause under concurrent
107// construction. GetAllocationCounters() returns a zeroed snapshot.
110inline void RecordContainerConstruction(uint64_t, std::size_t) {}
113inline void RecordContainerBackingAllocation(uint64_t, std::size_t) {}
114inline void RecordContainerExpansion(uint64_t, std::size_t, bool = true) {}
120
121//@formatter:off
122#endif
123//@formatter:on
124
125} //bio namespace
Definition Pointer.h:115
Definition FinalCell.h:29
void RecordClassArchetypeConstruction()
Definition AllocationStats.h:119
void RecordContainerBackingAllocation(uint64_t, std::size_t)
Definition AllocationStats.h:113
void RecordContainerDestruction()
Definition AllocationStats.h:112
void RecordContainerCopyConstruction()
Definition AllocationStats.h:111
void RecordContainerConstruction(uint64_t, std::size_t)
Definition AllocationStats.h:110
AllocationCounters GetAllocationCounters()
Definition AllocationStats.h:108
void RecordContainerExpansion(uint64_t, std::size_t, bool=true)
Definition AllocationStats.h:114
void RecordClassTypeRegistration()
Definition AllocationStats.h:118
void RecordChemicalSymmetryConstruction()
Definition AllocationStats.h:116
void ResetAllocationCounters()
Definition AllocationStats.h:109
void RecordPhysicalSymmetryConstruction()
Definition AllocationStats.h:115
void RecordClassPropertyRegistration()
Definition AllocationStats.h:117
Definition AllocationStats.h:39
uint64_t containerBackingReallocations
Definition AllocationStats.h:47
uint64_t classTypeRegistrations
Definition AllocationStats.h:58
uint64_t containerBytesRequested
Definition AllocationStats.h:50
uint64_t containerPeakBytes
Definition AllocationStats.h:53
uint64_t totalBytesRequested
Definition AllocationStats.h:40
uint64_t containerBytesExpanded
Definition AllocationStats.h:51
uint64_t containerCopyConstructions
Definition AllocationStats.h:43
uint64_t containerCapacityExpanded
Definition AllocationStats.h:49
uint64_t classArchetypeConstructions
Definition AllocationStats.h:59
uint64_t physicalSymmetryConstructions
Definition AllocationStats.h:55
uint64_t containerConstructions
Definition AllocationStats.h:42
uint64_t chemicalSymmetryConstructions
Definition AllocationStats.h:56
uint64_t containerBackingAllocations
Definition AllocationStats.h:46
uint64_t containerPeakCapacity
Definition AllocationStats.h:52
uint64_t containerExpansions
Definition AllocationStats.h:45
uint64_t containerCapacityRequested
Definition AllocationStats.h:48
uint64_t containerDestructions
Definition AllocationStats.h:44
uint64_t classPropertyRegistrations
Definition AllocationStats.h:57