Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Missing file
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 1 Mar 2021 00:30:18 +0000 (01:30 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 1 Mar 2021 00:30:18 +0000 (01:30 +0100)
src/mc/checker/SimcallInspector.cpp [new file with mode: 0644]

diff --git a/src/mc/checker/SimcallInspector.cpp b/src/mc/checker/SimcallInspector.cpp
new file mode 100644 (file)
index 0000000..d496858
--- /dev/null
@@ -0,0 +1,55 @@
+/* Copyright (c) 2019-2020. 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 "src/mc/checker/SimcallInspector.hpp"
+#include "simgrid/s4u/Host.hpp"
+#include "src/kernel/actor/ActorImpl.hpp"
+
+#include "src/mc/api.hpp"
+#include "src/mc/mc_smx.hpp"
+#include "xbt/string.hpp"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_inspector, mc, "Logging specific to MC simcall inspection");
+
+namespace simgrid {
+namespace mc {
+
+std::string SimcallInspector::to_string(int time_considered)
+{
+  return simgrid::xbt::string_printf("[(%ld)%s (%s)] ", get_issuer()->get_pid(), issuer_->get_host()->get_cname(),
+                                     issuer_->get_cname());
+}
+
+std::string RandomSimcall::to_string(int time_considered)
+{
+  return SimcallInspector::to_string(time_considered) + "MC_RANDOM(" + std::to_string(time_considered) + ")";
+}
+std::string SimcallInspector::dot_label()
+{
+  if (issuer_->get_host())
+    return xbt::string_printf("[(%ld)%s]", issuer_->get_pid(), issuer_->get_cname());
+  return xbt::string_printf("[(%ld)]", issuer_->get_pid());
+}
+std::string RandomSimcall::dot_label()
+{
+  return SimcallInspector::dot_label() + " MC_RANDOM (" + std::to_string(next_value_) + ")";
+}
+
+void RandomSimcall::prepare(int times_considered)
+{
+  next_value_ = min_ + times_considered;
+  XBT_DEBUG("MC_RANDOM(%d, %d) will return %d after %d times", min_, max_, next_value_, times_considered);
+}
+int RandomSimcall::get_max_consider()
+{
+  return max_ - min_ + 1;
+}
+int RandomSimcall::get_value()
+{
+  return next_value_;
+}
+
+} // namespace mc
+} // namespace simgrid