chromium/base/sampling_heap_profiler/poisson_allocation_sampler.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/sampling_heap_profiler/poisson_allocation_sampler.h"

#include <atomic>
#include <cmath>
#include <memory>
#include <utility>

#include "base/allocator/dispatcher/reentry_guard.h"
#include "base/allocator/dispatcher/tls.h"
#include "base/check.h"
#include "base/compiler_specific.h"
#include "base/no_destructor.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"

namespace base {

namespace {

ReentryGuard;

const size_t kDefaultSamplingIntervalBytes =;

const intptr_t kAccumulatedBytesOffset =;

// Controls if sample intervals should not be randomized. Used for testing.
bool g_deterministic =;

// Pointer to the current |LockFreeAddressHashSet|.
ABSL_CONST_INIT std::atomic<LockFreeAddressHashSet*> g_sampled_addresses_set{};

// Sampling interval parameter, the mean value for intervals between samples.
ABSL_CONST_INIT std::atomic_size_t g_sampling_interval{};

struct ThreadLocalData {};

ThreadLocalData* GetThreadLocalData() {}

}  // namespace

PoissonAllocationSampler::ScopedMuteThreadSamples::ScopedMuteThreadSamples() {}

PoissonAllocationSampler::ScopedMuteThreadSamples::~ScopedMuteThreadSamples() {}

// static
bool PoissonAllocationSampler::ScopedMuteThreadSamples::IsMuted() {}

PoissonAllocationSampler::ScopedSuppressRandomnessForTesting::
    ScopedSuppressRandomnessForTesting() {}

PoissonAllocationSampler::ScopedSuppressRandomnessForTesting::
    ~ScopedSuppressRandomnessForTesting() {}

// static
bool PoissonAllocationSampler::ScopedSuppressRandomnessForTesting::
    IsSuppressed() {}

PoissonAllocationSampler::ScopedMuteHookedSamplesForTesting::
    ScopedMuteHookedSamplesForTesting() {}

PoissonAllocationSampler::ScopedMuteHookedSamplesForTesting::
    ~ScopedMuteHookedSamplesForTesting() {}

PoissonAllocationSampler::ScopedMuteHookedSamplesForTesting::
    ScopedMuteHookedSamplesForTesting(ScopedMuteHookedSamplesForTesting&&) =
        default;

PoissonAllocationSampler::ScopedMuteHookedSamplesForTesting&
PoissonAllocationSampler::ScopedMuteHookedSamplesForTesting::operator=(
    ScopedMuteHookedSamplesForTesting&&) = default;

// static
ABSL_CONST_INIT std::atomic<PoissonAllocationSampler::ProfilingStateFlagMask>
    PoissonAllocationSampler::profiling_state_{};

PoissonAllocationSampler::PoissonAllocationSampler() {}

// static
void PoissonAllocationSampler::Init() {}

void PoissonAllocationSampler::SetSamplingInterval(
    size_t sampling_interval_bytes) {}

size_t PoissonAllocationSampler::SamplingInterval() const {}

// static
size_t PoissonAllocationSampler::GetNextSampleInterval(size_t interval) {}

void PoissonAllocationSampler::DoRecordAllocation(
    const ProfilingStateFlagMask state,
    void* address,
    size_t size,
    base::allocator::dispatcher::AllocationSubsystem type,
    const char* context) {}

void PoissonAllocationSampler::DoRecordFree(void* address) {}

void PoissonAllocationSampler::BalanceAddressesHashSet() {}

// static
LockFreeAddressHashSet& PoissonAllocationSampler::sampled_addresses_set() {}

// static
PoissonAllocationSampler* PoissonAllocationSampler::Get() {}

// static
void PoissonAllocationSampler::SetProfilingStateFlag(ProfilingStateFlag flag) {}

// static
void PoissonAllocationSampler::ResetProfilingStateFlag(
    ProfilingStateFlag flag) {}

void PoissonAllocationSampler::AddSamplesObserver(SamplesObserver* observer) {}

void PoissonAllocationSampler::RemoveSamplesObserver(
    SamplesObserver* observer) {}

}  // namespace base