#include "base/sampling_heap_profiler/sampling_heap_profiler.h"
#include <stdlib.h>
#include <cinttypes>
#include "base/allocator/dispatcher/dispatcher.h"
#include "base/allocator/dispatcher/notification_data.h"
#include "base/allocator/dispatcher/subsystem.h"
#include "base/debug/alias.h"
#include "base/memory/raw_ptr.h"
#include "base/rand_util.h"
#include "base/sampling_heap_profiler/poisson_allocation_sampler.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/simple_thread.h"
#include "build/build_config.h"
#include "partition_alloc/shim/allocator_shim.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
ScopedSuppressRandomnessForTesting;
AllocationNotificationData;
AllocationSubsystem;
FreeNotificationData;
class SamplingHeapProfilerTest : public ::testing::Test { … };
class SamplesCollector : public PoissonAllocationSampler::SamplesObserver { … };
TEST_F(SamplingHeapProfilerTest, SampleObserver) { … }
TEST_F(SamplingHeapProfilerTest, SampleObserverMuted) { … }
TEST_F(SamplingHeapProfilerTest, IntervalRandomizationSanity) { … }
#if BUILDFLAG(IS_IOS)
const int kNumberOfAllocations = 1000;
#else
const int kNumberOfAllocations = …;
#endif
NOINLINE void Allocate1() { … }
NOINLINE void Allocate2() { … }
NOINLINE void Allocate3() { … }
class MyThread1 : public SimpleThread { … };
class MyThread2 : public SimpleThread { … };
void CheckAllocationPattern(void (*allocate_callback)()) { … }
TEST_F(SamplingHeapProfilerTest, DISABLED_ParallelLargeSmallStats) { … }
TEST_F(SamplingHeapProfilerTest, DISABLED_SequentialLargeSmallStats) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_MANUAL_SamplerMicroBenchmark …
#else
#define MAYBE_MANUAL_SamplerMicroBenchmark …
#endif
TEST_F(SamplingHeapProfilerTest, MAYBE_MANUAL_SamplerMicroBenchmark) { … }
class StartStopThread : public SimpleThread { … };
TEST_F(SamplingHeapProfilerTest, StartStop) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_ConcurrentStartStop …
#else
#define MAYBE_ConcurrentStartStop …
#endif
TEST_F(SamplingHeapProfilerTest, MAYBE_ConcurrentStartStop) { … }
TEST_F(SamplingHeapProfilerTest, HookedAllocatorMuted) { … }
}