Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add trace2selist and re-enable unit tests for the stochastic profiles
authorFabien Chaix <chaix@ics.forth.gr>
Tue, 17 May 2022 20:59:54 +0000 (23:59 +0300)
committerFabien Chaix <chaix@ics.forth.gr>
Tue, 17 May 2022 20:59:54 +0000 (23:59 +0300)
src/kernel/resource/profile/ProfileBuilder.cpp
src/kernel/resource/profile/Profile_test.cpp
src/kernel/resource/profile/StochasticDatedValue.hpp

index 1924d2d..bbfb98d 100644 (file)
@@ -212,6 +212,8 @@ public:
         event_list.at(initial_size).date_ += loop_delay;
     }
   }
+
+  std::vector<StochasticDatedValue> get_pattern() { return pattern; } 
 };
 
 Profile* ProfileBuilder::from_string(const std::string& name, const std::string& input, double periodicity)
@@ -244,3 +246,11 @@ Profile* ProfileBuilder::from_callback(const std::string& name, const std::funct
 }
 
 } // namespace simgrid::kernel::profile
+
+std::vector<simgrid::kernel::profile::StochasticDatedValue> trace2selist( const char*  c_str) {
+  std::string str(c_str);
+  simgrid::kernel::profile::LegacyUpdateCb cb(str,0);
+  return cb.get_pattern();
+}
+
+
index 09205f3..6996ec7 100644 (file)
@@ -145,7 +145,7 @@ TEST_CASE("kernel::profile: Resource profiles, defining the external load", "ker
 
     REQUIRE(want == got);
   }
-/*
+
   SECTION("One stochastic event (parsing)")
   {
     using simgrid::kernel::profile::Distribution;
@@ -153,7 +153,7 @@ TEST_CASE("kernel::profile: Resource profiles, defining the external load", "ker
                                                                                    "DET 0 UNIF 10 20");
 
     std::vector<simgrid::kernel::profile::StochasticDatedValue> want;
   want.emplace_back(0, -1); // The initial fake event
//want.emplace_back(0, -1); // The initial fake event
     want.emplace_back(Distribution::DET, std::vector<double>{0}, Distribution::UNIF, std::vector<double>{10, 20});
 
     REQUIRE(want == got);
@@ -169,7 +169,7 @@ TEST_CASE("kernel::profile: Resource profiles, defining the external load", "ker
                                                                                    "DET 5 UNIF 5 25");
 
     std::vector<simgrid::kernel::profile::StochasticDatedValue> want;
-    want.emplace_back(0, -1);
+   // want.emplace_back(0, -1);
     want.emplace_back(Distribution::DET, std::vector<double>{0}, Distribution::DET, std::vector<double>{4});
     want.emplace_back(Distribution::NORM, std::vector<double>{25, 10}, Distribution::DET, std::vector<double>{3});
     want.emplace_back(Distribution::UNIF, std::vector<double>{10, 20}, Distribution::NORM, std::vector<double>{25, 10});
@@ -177,7 +177,7 @@ TEST_CASE("kernel::profile: Resource profiles, defining the external load", "ker
 
     REQUIRE(want == got);
   }
-*/
+
   SECTION("Two stochastic events (drawing each distribution)")
   {
     simgrid::xbt::random::set_implem_xbt();
index 2e0586f..f6d55b4 100644 (file)
@@ -36,6 +36,10 @@ private:
   static double draw(Distribution law, std::vector<double> params);
 };
 
+
+
 } // namespace simgrid::kernel::profile
 
+std::vector<simgrid::kernel::profile::StochasticDatedValue> trace2selist( const char* c_str );
+
 #endif