misc: Remove Serialize-related code in Random (#1567)
The Random ser/des support has been non-existent since 2014. Removing it will enable the Random class to be unit tested without having a dependency on the src/sim code.
This commit is contained in:
@@ -42,9 +42,6 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "base/logging.hh"
|
||||
#include "sim/serialize.hh"
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
|
||||
@@ -69,33 +66,6 @@ Random::init(uint32_t s)
|
||||
gen.seed(s);
|
||||
}
|
||||
|
||||
void
|
||||
Random::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
panic("Currently not used anywhere.\n");
|
||||
|
||||
// get the state from the generator
|
||||
std::ostringstream oss;
|
||||
oss << gen;
|
||||
std::string state = oss.str();
|
||||
paramOut(cp, "mt_state", state);
|
||||
}
|
||||
|
||||
void
|
||||
Random::unserialize(CheckpointIn &cp)
|
||||
{
|
||||
panic("Currently not used anywhere.\n");
|
||||
|
||||
// the random generator state did not use to be part of the
|
||||
// checkpoint state, so be forgiving in the unserialization and
|
||||
// keep on going if the parameter is not there
|
||||
std::string state;
|
||||
if (optParamIn(cp, "mt_state", state)) {
|
||||
std::istringstream iss(state);
|
||||
iss >> gen;
|
||||
}
|
||||
}
|
||||
|
||||
Random random_mt;
|
||||
|
||||
} // namespace gem5
|
||||
|
||||
@@ -51,14 +51,11 @@
|
||||
|
||||
#include "base/compiler.hh"
|
||||
#include "base/types.hh"
|
||||
#include "sim/serialize.hh"
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
|
||||
class Checkpoint;
|
||||
|
||||
class Random : public Serializable
|
||||
class Random
|
||||
{
|
||||
|
||||
public:
|
||||
@@ -115,9 +112,6 @@ class Random : public Serializable
|
||||
std::uniform_int_distribution<T> dist(min, max);
|
||||
return dist(gen);
|
||||
}
|
||||
|
||||
void serialize(CheckpointOut &cp) const override;
|
||||
void unserialize(CheckpointIn &cp) override;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user