Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add interface to create Profile
authorBruno Donassolo <bruno.donassolo@inria.fr>
Thu, 5 Aug 2021 13:40:16 +0000 (15:40 +0200)
committerBruno Donassolo <bruno.donassolo@inria.fr>
Mon, 9 Aug 2021 08:46:53 +0000 (10:46 +0200)
Allows the use of speed/state profiles by C++ interface.

MANIFEST.in
include/simgrid/kernel/ProfileBuilder.hpp [new file with mode: 0644]
src/kernel/resource/profile/ProfileBuilder.cpp [new file with mode: 0644]
tools/cmake/DefinePackages.cmake

index 5e1178f..da8b7be 100644 (file)
@@ -2014,6 +2014,7 @@ include include/simgrid/jedule/jedule.hpp
 include include/simgrid/jedule/jedule_events.hpp
 include include/simgrid/jedule/jedule_platform.hpp
 include include/simgrid/jedule/jedule_sd_binding.h
+include include/simgrid/kernel/ProfileBuilder.hpp
 include include/simgrid/kernel/Timer.hpp
 include include/simgrid/kernel/future.hpp
 include include/simgrid/kernel/resource/Action.hpp
@@ -2253,6 +2254,7 @@ include src/kernel/resource/profile/FutureEvtSet.cpp
 include src/kernel/resource/profile/FutureEvtSet.hpp
 include src/kernel/resource/profile/Profile.cpp
 include src/kernel/resource/profile/Profile.hpp
+include src/kernel/resource/profile/ProfileBuilder.cpp
 include src/kernel/resource/profile/Profile_test.cpp
 include src/kernel/resource/profile/StochasticDatedValue.cpp
 include src/kernel/resource/profile/StochasticDatedValue.hpp
diff --git a/include/simgrid/kernel/ProfileBuilder.hpp b/include/simgrid/kernel/ProfileBuilder.hpp
new file mode 100644 (file)
index 0000000..becdd37
--- /dev/null
@@ -0,0 +1,30 @@
+/* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SIMGRID_KERNEL_PROFILEBUILDER_HPP
+#define SIMGRID_KERNEL_PROFILEBUILDER_HPP
+
+#include <simgrid/forward.h>
+
+namespace simgrid {
+namespace kernel {
+namespace profile {
+
+/**
+ * @brief Simple builder for Profile classes.
+ *
+ * It can be used to create profiles for links, hosts or disks.
+ */
+class XBT_PUBLIC ProfileBuilder {
+public:
+  static Profile* from_file(const std::string& path);
+  static Profile* from_string(const std::string& name, const std::string& input, double periodicity);
+};
+
+} // namespace profile
+} // namespace kernel
+} // namespace simgrid
+
+#endif /* SIMGRID_KERNEL_PROFILEBUILDER_HPP */
\ No newline at end of file
diff --git a/src/kernel/resource/profile/ProfileBuilder.cpp b/src/kernel/resource/profile/ProfileBuilder.cpp
new file mode 100644 (file)
index 0000000..02fbf9e
--- /dev/null
@@ -0,0 +1,25 @@
+/* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "simgrid/kernel/ProfileBuilder.hpp"
+#include "src/kernel/resource/profile/Profile.hpp"
+
+namespace simgrid {
+namespace kernel {
+namespace profile {
+
+Profile* ProfileBuilder::from_string(const std::string& name, const std::string& input, double periodicity)
+{
+  return Profile::from_string(name, input, periodicity);
+}
+
+Profile* ProfileBuilder::from_file(const std::string& path)
+{
+  return Profile::from_file(path);
+}
+
+} // namespace profile
+} // namespace kernel
+} // namespace simgrid
\ No newline at end of file
index 786b9c2..3533acd 100644 (file)
@@ -319,6 +319,7 @@ set(SURF_SRC
   src/kernel/resource/profile/Event.hpp
   src/kernel/resource/profile/FutureEvtSet.cpp
   src/kernel/resource/profile/FutureEvtSet.hpp
+  src/kernel/resource/profile/ProfileBuilder.cpp
   src/kernel/resource/profile/Profile.cpp
   src/kernel/resource/profile/Profile.hpp
   src/kernel/resource/profile/StochasticDatedValue.cpp
@@ -693,6 +694,7 @@ set(headers_to_install
   include/simgrid/forward.h
   include/simgrid/simix.h
   include/simgrid/simix.hpp
+  include/simgrid/kernel/ProfileBuilder.hpp
   include/simgrid/kernel/Timer.hpp
   include/simgrid/kernel/future.hpp
   include/simgrid/disk.h