Pigweed
 
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
20// inclusive-language: disable
21
46 struct {
47 size_t hi = 0;
48 size_t lo = 0;
50
52 size_t sum = 0;
53
54 void AddFragment(size_t inner_size);
55};
56
57// inclusive-language: enable
58
63float CalculateFragmentation(const Fragmentation& fragmentation);
64
65} // namespace pw::allocator
Definition: fragmentation.h:44
size_t sum
Sum of the inner sizes of free blocks.
Definition: fragmentation.h:52
struct pw::allocator::Fragmentation::@0 sum_of_squares
Sum-of-squares of the inner sizes of free blocks.