chromium/components/gwp_asan/client/sampling_helpers.cc

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

#include "components/gwp_asan/client/sampling_helpers.h"

#include <optional>
#include <string_view>

#include "base/containers/fixed_flat_map.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_functions.h"
#include "base/numerics/safe_math.h"
#include "base/strings/strcat.h"

namespace gwp_asan::internal {

namespace {

// The exclusive maximum-valued sample that the histogram supports.
// Arbitrarily chosen.
inline constexpr base::Histogram::Sample kMaxSample =;

constexpr auto kProcessMap =;

void ReportOomHistogram(base::HistogramBase* histogram,
                        size_t sampling_frequency,
                        size_t allocations) {}

}  // namespace

GuardedPageAllocator::OutOfMemoryCallback CreateOomCallback(
    std::string_view allocator_name,
    std::string_view process_type,
    size_t sampling_frequency) {}

// Turns the value passed to --type= into
// *  a representation of the process type
// *  or `nullopt` if we don't emit for said process.
//
// Used in the patterned histogram `Security.GwpAsan.AllocatorOom...`.
std::optional<std::string_view> ProcessString(std::string_view process_type) {}

void ReportGwpAsanActivated(std::string_view allocator_name,
                            std::string_view process_type,
                            bool activated) {}

}  // namespace gwp_asan::internal