Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
end objectification of MSG tasks
[simgrid.git] / src / msg / msg_private.hpp
index 01ec91a..14384c6 100644 (file)
@@ -7,9 +7,11 @@
 #define MSG_PRIVATE_HPP
 
 #include "simgrid/msg.h"
-
 #include "src/kernel/activity/CommImpl.hpp"
 #include "src/kernel/activity/ExecImpl.hpp"
+#include <simgrid/modelchecker.h>
+
+static long long int msg_task_max_counter = 0;
 
 /**************** datatypes **********************************/
 namespace simgrid {
@@ -17,12 +19,17 @@ namespace msg {
 class Task {
   std::string name_             = "";
   std::string tracing_category_ = "";
+  void* userdata_               = nullptr;
+  long long int counter_;
 
 public:
   ~Task();
-  explicit Task(std::string name, double flops_amount, double bytes_amount)
-      : name_(std::move(name)), flops_amount(flops_amount), bytes_amount(bytes_amount)
+  explicit Task(std::string name, double flops_amount, double bytes_amount, void* data)
+      : name_(std::move(name)), userdata_(data), flops_amount(flops_amount), bytes_amount(bytes_amount)
   {
+    counter_ = msg_task_max_counter++;
+    if (MC_is_active())
+      MC_ignore_heap(&(counter_), sizeof(long long int));
   }
   void set_used();
   void set_not_used() { this->is_used = false; }
@@ -33,6 +40,9 @@ public:
   void set_tracing_category(const char* category) { tracing_category_ = category ? std::string(category) : ""; }
   const std::string& get_tracing_category() { return tracing_category_; }
   bool has_tracing_category() { return not tracing_category_.empty(); }
+  void* get_user_data() { return userdata_; }
+  void set_user_data(void* data) { userdata_ = data; }
+  long long int get_counter() { return counter_; }
 
   kernel::activity::ExecImplPtr compute          = nullptr; /* SIMIX modeling of computation */
   s4u::CommPtr comm                              = nullptr; /* S4U modeling of communication */