chromium/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc

// Copyright 2018 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "absl/container/internal/hashtablez_sampler.h"

#include <algorithm>
#include <atomic>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <limits>

#include "absl/base/attributes.h"
#include "absl/base/config.h"
#include "absl/base/internal/per_thread_tls.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
#include "absl/base/no_destructor.h"
#include "absl/base/optimization.h"
#include "absl/debugging/stacktrace.h"
#include "absl/memory/memory.h"
#include "absl/profiling/internal/exponential_biased.h"
#include "absl/profiling/internal/sample_recorder.h"
#include "absl/synchronization/mutex.h"
#include "absl/time/clock.h"
#include "absl/utility/utility.h"

namespace absl {
ABSL_NAMESPACE_BEGIN
namespace container_internal {

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr int HashtablezInfo::kMaxStackDepth;
#endif

namespace {
ABSL_CONST_INIT std::atomic<bool> g_hashtablez_enabled{};
ABSL_CONST_INIT std::atomic<int32_t> g_hashtablez_sample_parameter{};
std::atomic<HashtablezConfigListener> g_hashtablez_config_listener{};

#if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE)
ABSL_PER_THREAD_TLS_KEYWORD absl::profiling_internal::ExponentialBiased
    g_exponential_biased_generator;
#endif

void TriggerHashtablezConfigListener() {}

}  // namespace

#if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE)
ABSL_PER_THREAD_TLS_KEYWORD SamplingState global_next_sample = {0, 0};
#endif  // defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE)

HashtablezSampler& GlobalHashtablezSampler() {}

HashtablezInfo::HashtablezInfo() = default;
HashtablezInfo::~HashtablezInfo() = default;

void HashtablezInfo::PrepareForSampling(int64_t stride,
                                        size_t inline_element_size_value,
                                        size_t key_size_value,
                                        size_t value_size_value,
                                        uint16_t soo_capacity_value) {}

static bool ShouldForceSampling() {}

HashtablezInfo* SampleSlow(SamplingState& next_sample,
                           size_t inline_element_size, size_t key_size,
                           size_t value_size, uint16_t soo_capacity) {}

void UnsampleSlow(HashtablezInfo* info) {}

void RecordRehashSlow(HashtablezInfo* info, size_t total_probe_length) {}

void RecordReservationSlow(HashtablezInfo* info, size_t target_capacity) {}

void RecordClearedReservationSlow(HashtablezInfo* info) {}

void RecordStorageChangedSlow(HashtablezInfo* info, size_t size,
                              size_t capacity) {}

void RecordInsertSlow(HashtablezInfo* info, size_t hash,
                      size_t distance_from_desired) {}

void RecordEraseSlow(HashtablezInfo* info) {}

void SetHashtablezConfigListener(HashtablezConfigListener l) {}

bool IsHashtablezEnabled() {}

void SetHashtablezEnabled(bool enabled) {}

void SetHashtablezEnabledInternal(bool enabled) {}

int32_t GetHashtablezSampleParameter() {}

void SetHashtablezSampleParameter(int32_t rate) {}

void SetHashtablezSampleParameterInternal(int32_t rate) {}

size_t GetHashtablezMaxSamples() {}

void SetHashtablezMaxSamples(size_t max) {}

void SetHashtablezMaxSamplesInternal(size_t max) {}

}  // namespace container_internal
ABSL_NAMESPACE_END
}  // namespace absl