C/C++ API Reference
Loading...
Searching...
No Matches
fragmentation.h
1// Copyright 2024 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14#pragma once
15
16#include <cstddef>
17
18namespace pw::allocator {
19
21
22// inclusive-language: disable
23
48 struct {
49 size_t hi = 0;
50 size_t lo = 0;
52
54 size_t sum = 0;
55
56 void AddFragment(size_t inner_size);
57};
58
59// inclusive-language: enable
60
65float CalculateFragmentation(const Fragmentation& fragmentation);
66
68
69} // namespace pw::allocator
float CalculateFragmentation(const Fragmentation &fragmentation)
Definition: fragmentation.h:46
size_t sum
Sum of the inner sizes of free blocks.
Definition: fragmentation.h:54
struct pw::allocator::Fragmentation::@0 sum_of_squares
Sum-of-squares of the inner sizes of free blocks.