Add more example simulations in the benchmarks
This commit is contained in:
@@ -49,7 +49,7 @@ static DRAMSys::AddressDecoder addressDecoder()
|
||||
return decoder;
|
||||
}
|
||||
|
||||
static void decode(benchmark::State& state)
|
||||
static void addressdecoder_decode(benchmark::State& state)
|
||||
{
|
||||
auto decoder = addressDecoder();
|
||||
|
||||
@@ -61,9 +61,9 @@ static void decode(benchmark::State& state)
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(decode);
|
||||
BENCHMARK(addressdecoder_decode);
|
||||
|
||||
static void encode(benchmark::State& state)
|
||||
static void addressdecoder_encode(benchmark::State& state)
|
||||
{
|
||||
auto decoder = addressDecoder();
|
||||
|
||||
@@ -77,4 +77,4 @@ static void encode(benchmark::State& state)
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(encode);
|
||||
BENCHMARK(addressdecoder_encode);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user