// Copyright 2021 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef INCLUDE_V8_STATISTICS_H_ #define INCLUDE_V8_STATISTICS_H_ #include <stddef.h> #include <stdint.h> #include <memory> #include <utility> #include <vector> #include "v8-local-handle.h" // NOLINT(build/include_directory) #include "v8-memory-span.h" // NOLINT(build/include_directory) #include "v8-promise.h" // NOLINT(build/include_directory) #include "v8config.h" // NOLINT(build/include_directory) namespace v8 { class Context; class Isolate; namespace internal { class ReadOnlyHeap; } // namespace internal /** * Controls how the default MeasureMemoryDelegate reports the result of * the memory measurement to JS. With kSummary only the total size is reported. * With kDetailed the result includes the size of each native context. */ enum class MeasureMemoryMode { … }; /** * Controls how promptly a memory measurement request is executed. * By default the measurement is folded with the next scheduled GC which may * happen after a while and is forced after some timeout. * The kEager mode starts incremental GC right away and is useful for testing. * The kLazy mode does not force GC. */ enum class MeasureMemoryExecution { … }; /** * The delegate is used in Isolate::MeasureMemory API. * * It specifies the contexts that need to be measured and gets called when * the measurement is completed to report the results. * * Both MeasurementComplete() callbacks will be invoked on completion. * Each implementation of this class should hence implement only one of them, * and leave the other empty. */ class V8_EXPORT MeasureMemoryDelegate { … }; /** * Collection of shared per-process V8 memory information. * * Instances of this class can be passed to * v8::V8::GetSharedMemoryStatistics to get shared memory statistics from V8. */ class V8_EXPORT SharedMemoryStatistics { … }; /** * Collection of V8 heap information. * * Instances of this class can be passed to v8::Isolate::GetHeapStatistics to * get heap statistics from V8. */ class V8_EXPORT HeapStatistics { … }; class V8_EXPORT HeapSpaceStatistics { … }; class V8_EXPORT HeapObjectStatistics { … }; class V8_EXPORT HeapCodeStatistics { … }; } // namespace v8 #endif // INCLUDE_V8_STATISTICS_H_