Files
Schrodinger ZHU Yifan aca3f14c0d [libc][benchmark] allow benchmark to be built without llvm support (#200951)
Update benchmark to allow it to be built in runtimes driven mode. 

It is still useful to have an in-tree benchmark suite. On my side, I am
working on some allocators related benchmarks. Due to the broken state
of this in-tree benchmark suite, I have to frequently port changes
between two workspace. Also, having benchmark suite can make it easier
to track performance change in a consistent view.

Assisted-by: AI tools, checked manually
2026-06-25 19:16:08 +00:00

54 lines
2.0 KiB
C++

//===-- MemorySizeDistributions ---------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Memory functions operate on buffers of certain sizes. This file provides
// probability distributions observed at runtime for a set of applications.
// These distributions are used to benchmark and compare memory functions
// implementations.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_BENCHMARKS_MEMORYSIZEDISTRIBUTIONS_H
#define LLVM_LIBC_BENCHMARKS_MEMORYSIZEDISTRIBUTIONS_H
#include <llvm/ADT/ArrayRef.h>
#include <llvm/ADT/StringRef.h>
namespace llvm {
namespace libc_benchmarks {
/// A simple POD exposing caracteristics of a memory function size
/// distributions. The underlying data is immutable.
struct MemorySizeDistribution {
StringRef name; // The name of the distribution.
ArrayRef<double> probabilities; // Size indexed array of probabilities.
};
/// Returns a list of memmove size distributions.
ArrayRef<MemorySizeDistribution> getMemmoveSizeDistributions();
/// Returns a list of memcpy size distributions.
ArrayRef<MemorySizeDistribution> getMemcpySizeDistributions();
/// Returns a list of memset size distributions.
ArrayRef<MemorySizeDistribution> getMemsetSizeDistributions();
/// Returns a list of memcmp size distributions.
ArrayRef<MemorySizeDistribution> getMemcmpSizeDistributions();
/// Returns the first MemorySizeDistribution from Distributions with the
/// specified Name.
MemorySizeDistribution
getDistributionOrDie(ArrayRef<MemorySizeDistribution> Distributions,
StringRef Name);
} // namespace libc_benchmarks
} // namespace llvm
#endif // LLVM_LIBC_BENCHMARKS_MEMORYSIZEDISTRIBUTIONS_H