blob: b0135ef71aced264c73a5282f36d8c56f5af5ed9 [file] [log] [blame]
# Copyright 2020 The Pigweed 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.
load(
"//pw_build:pigweed.bzl",
"pw_cc_test",
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
# Libraries
cc_library(
name = "measurements",
testonly = True,
srcs = [
"measurements.cc",
],
hdrs = [
"public/pw_allocator/benchmarks/measurements.h",
],
strip_include_prefix = "public",
deps = [
"//pw_chrono:system_clock",
"//pw_containers:intrusive_map",
"//pw_metric:metric",
],
)
cc_library(
name = "benchmark",
testonly = True,
srcs = [
"benchmark.cc",
],
hdrs = [
"public/pw_allocator/benchmarks/benchmark.h",
"public/pw_allocator/benchmarks/config.h",
],
strip_include_prefix = "public",
target_compatible_with = select({
"@platforms//os:linux": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
":measurements",
"//pw_allocator:block_allocator",
"//pw_allocator:fragmentation",
"//pw_allocator:test_harness",
"//pw_chrono:system_clock",
"//pw_metric:metric",
"//pw_tokenizer",
],
)
# Binaries
cc_binary(
name = "best_fit_benchmark",
testonly = True,
srcs = [
"best_fit_benchmark.cc",
],
deps = [
":benchmark",
"//pw_allocator:best_fit",
"//pw_random",
],
)
cc_binary(
name = "dual_first_fit_benchmark",
testonly = True,
srcs = [
"dual_first_fit_benchmark.cc",
],
deps = [
":benchmark",
"//pw_allocator:first_fit",
"//pw_random",
],
)
cc_binary(
name = "first_fit_benchmark",
testonly = True,
srcs = [
"first_fit_benchmark.cc",
],
deps = [
":benchmark",
"//pw_allocator:first_fit",
"//pw_random",
],
)
cc_binary(
name = "last_fit_benchmark",
testonly = True,
srcs = [
"last_fit_benchmark.cc",
],
deps = [
":benchmark",
"//pw_allocator:first_fit",
"//pw_random",
],
)
cc_binary(
name = "worst_fit_benchmark",
testonly = True,
srcs = [
"worst_fit_benchmark.cc",
],
deps = [
":benchmark",
"//pw_allocator:worst_fit",
"//pw_random",
],
)
# Unit tests
pw_cc_test(
name = "measurements_test",
srcs = ["measurements_test.cc"],
deps = [":measurements"],
)
pw_cc_test(
name = "benchmark_test",
srcs = ["benchmark_test.cc"],
deps = [
":benchmark",
"//pw_allocator:testing",
],
)