From 371946f1f1e8e79def3e79924ccd8e5ab61d6591 Mon Sep 17 00:00:00 2001 From: Benjamin BOUVIER Date: Fri, 5 Oct 2012 18:07:25 -0400 Subject: [PATCH] MPI Distrib exp: the parameters of an experiment are recalled in the results file. --- eo/test/mpi/t-mpi-distrib-exp.cpp | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/eo/test/mpi/t-mpi-distrib-exp.cpp b/eo/test/mpi/t-mpi-distrib-exp.cpp index 6787b636..7d081b56 100644 --- a/eo/test/mpi/t-mpi-distrib-exp.cpp +++ b/eo/test/mpi/t-mpi-distrib-exp.cpp @@ -34,6 +34,7 @@ # include # include # include +# include # include # include @@ -115,6 +116,11 @@ class Distribution : public std::vector< type >, public eoserial::Persistent */ bool isActive() { return _active; } + /** + * @brief Prints the name and the parameters of the distribution + */ + virtual std::string toString() const = 0; + protected: bool _active; @@ -169,6 +175,15 @@ class UniformDistribution : public Distribution eoserial::unpack( *obj, "max", _max ); } + std::string toString() const + { + std::stringstream ss; + ss << "uniform" << '\n' + << "min: " << _min << '\n' + << "max: " << _max << '\n'; + return ss.str(); + } + protected: double _min; @@ -221,6 +236,15 @@ class NormalDistribution : public Distribution eoserial::unpack( *obj, "stddev", _stddev ); } + std::string toString() const + { + std::stringstream ss; + ss << "normal" << '\n' + << "mean: " << _mean << '\n' + << "stddev: " << _stddev << '\n'; + return ss.str(); + } + protected: double _mean; @@ -271,6 +295,14 @@ class ExponentialDistribution : public Distribution eoserial::unpack( *obj, "mean", _mean ); } + std::string toString() const + { + std::stringstream ss; + ss << "exponential" << '\n' + << "mean: " << _mean << '\n'; + return ss.str(); + } + protected: double _mean; @@ -384,6 +416,13 @@ class Experiment : public eoserial::Persistent } std::ostream& out = *pout; + // Reminder of the parameters + out << "size: " << _size << '\n' + << "packet_size: " << _packet_size << '\n' + << "distribution: " << _distribution->toString() + << "seed: " << _seed << '\n' << std::endl; + + // Results out << std::fixed << std::setprecision( 5 ); for( int i = 1, s = comm.size(); i < s; ++i ) {