Add more example simulations in the benchmarks

This commit is contained in:
2024-06-07 14:33:56 +02:00
committed by Derek Christ
parent 42d17f95ec
commit c42866cecb
2 changed files with 24 additions and 9 deletions

View File

@@ -37,19 +37,26 @@
#include <benchmark/benchmark.h>
#include <filesystem>
#include <tuple>
static void ddr3Simulation(benchmark::State& state)
namespace Simulation
{
auto rdbuf = std::cout.rdbuf(nullptr);
template<class ...Args>
static void example_simulation(benchmark::State& state, Args&&... args)
{
auto args_tuple = std::make_tuple(std::move(args)...);
auto *rdbuf = std::cout.rdbuf(nullptr);
for (auto _ : state)
{
sc_core::sc_get_curr_simcontext()->reset();
std::filesystem::path configFile("configs/ddr3-example.json");
std::filesystem::path configFile(std::get<0>(args_tuple));
std::filesystem::path resourceDirectory("configs");
DRAMSys::Config::Configuration configuration = DRAMSys::Config::from_path(configFile.c_str());
DRAMSys::Config::Configuration configuration =
DRAMSys::Config::from_path(configFile.c_str());
Simulator simulator(std::move(configuration), std::move(resourceDirectory));
simulator.run();
@@ -58,4 +65,12 @@ static void ddr3Simulation(benchmark::State& state)
std::cout.rdbuf(rdbuf);
}
BENCHMARK(ddr3Simulation);
BENCHMARK_CAPTURE(example_simulation, ddr3, std::string("configs/ddr3-example.json"));
BENCHMARK_CAPTURE(example_simulation, ddr4, std::string("configs/ddr4-example.json"));
BENCHMARK_CAPTURE(example_simulation, ddr5, std::string("configs/ddr5-example.json"));
BENCHMARK_CAPTURE(example_simulation, lpddr4, std::string("configs/lpddr4-example.json"));
BENCHMARK_CAPTURE(example_simulation, lpddr5, std::string("configs/lpddr5-example.json"));
BENCHMARK_CAPTURE(example_simulation, hbm2, std::string("configs/hbm2-example.json"));
BENCHMARK_CAPTURE(example_simulation, hbm3, std::string("configs/hbm3-example.json"));
} // namespace Simulation