v8 14.1.146 (node 25.0.0)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
heap-statistics.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_CPPGC_HEAP_STATISTICS_H_
6#define INCLUDE_CPPGC_HEAP_STATISTICS_H_
7
8#include <cstddef>
9#include <cstdint>
10#include <string>
11#include <vector>
12
13namespace cppgc {
14
15/**
16 * `HeapStatistics` contains memory consumption and utilization statistics for a
17 * cppgc heap.
18 */
19struct HeapStatistics final {
20 /**
21 * Specifies the detail level of the heap statistics. Brief statistics contain
22 * only the top-level allocated and used memory statistics for the entire
23 * heap. Detailed statistics also contain a break down per space and page, as
24 * well as freelist statistics and object type histograms. Note that used
25 * memory reported by brief statistics and detailed statistics might differ
26 * slightly.
27 */
31 };
32
33 /**
34 * Object statistics for a single type.
35 */
37 /**
38 * Number of allocated bytes.
39 */
41 /**
42 * Number of allocated objects.
43 */
45 };
46
47 /**
48 * Page granularity statistics. For each page the statistics record the
49 * allocated memory size and overall used memory size for the page.
50 */
52 /** Overall committed amount of memory for the page. */
54 /** Resident amount of memory held by the page. */
56 /** Amount of memory actually used on the page. */
58 /** Statistics for object allocated on the page. Filled only when
59 * NameProvider::SupportsCppClassNamesAsObjectNames() is true. */
61 };
62
63 /**
64 * Statistics of the freelist (used only in non-large object spaces). For
65 * each bucket in the freelist the statistics record the bucket size, the
66 * number of freelist entries in the bucket, and the overall allocated memory
67 * consumed by these freelist entries.
68 */
70 /** bucket sizes in the freelist. */
72 /** number of freelist entries per bucket. */
74 /** memory size consumed by freelist entries per size. */
76 };
77
78 /**
79 * Space granularity statistics. For each space the statistics record the
80 * space name, the amount of allocated memory and overall used memory for the
81 * space. The statistics also contain statistics for each of the space's
82 * pages, its freelist and the objects allocated on the space.
83 */
85 /** The space name */
86 std::string name;
87 /** Overall committed amount of memory for the heap. */
89 /** Resident amount of memory held by the heap. */
91 /** Amount of memory actually used on the space. */
93 /** Statistics for each of the pages in the space. */
95 /** Statistics for the freelist of the space. */
97 };
98
99 /** Overall committed amount of memory for the heap. */
101 /** Resident amount of memory held by the heap. */
103 /** Amount of memory actually used on the heap. */
105 /** Memory retained in the page pool, not used directly by the heap. */
107 /** Detail level of this HeapStatistics. */
109
110 /** Statistics for each of the spaces in the heap. Filled only when
111 * `detail_level` is `DetailLevel::kDetailed`. */
113
114 /**
115 * Vector of `cppgc::GarbageCollected` type names.
116 */
118};
119
120} // namespace cppgc
121
122#endif // INCLUDE_CPPGC_HEAP_STATISTICS_H_
size_t object_count
size_t allocated_bytes
std::vector< ObjectStatsEntry > object_statistics
std::vector< PageStatistics > page_stats
std::vector< std::string > type_names
std::vector< SpaceStatistics > space_stats