#include "simgrid/kernel/resource/Resource.hpp"
#include "src/kernel/lmm/maxmin.hpp" // Constraint
-#include "src/kernel/resource/profile/trace_mgr.hpp"
+#include "src/kernel/resource/profile/FutureEvtSet.hpp"
+#include "src/kernel/resource/profile/Profile.hpp"
#include "src/surf/surf_interface.hpp"
namespace simgrid {
void Resource::set_state_profile(profile::Profile* profile)
{
xbt_assert(state_event_ == nullptr, "Cannot set a second state profile to %s", get_cname());
- state_event_ = profile->schedule(&future_evt_set, this);
+ state_event_ = profile->schedule(&profile::future_evt_set, this);
}
} // namespace resource
/* 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/kernel/resource/profile/DatedValue.hpp"
+#include "src/kernel/resource/profile/DatedValue.hpp"
#include <math.h>
namespace simgrid {
} // namespace profile
} // namespace kernel
-} // namespace simgrid
\ No newline at end of file
+} // namespace simgrid
/* 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_PROFILE_DATEDVALUE
+#define SIMGRID_KERNEL_PROFILE_DATEDVALUE
+
+#include "simgrid/forward.h"
#include <iostream>
namespace simgrid {
} // namespace profile
} // namespace kernel
-} // namespace simgrid
\ No newline at end of file
+} // namespace simgrid
+
+#endif
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/kernel/resource/profile/FutureEvtSet.hpp"
+#include "src/kernel/resource/profile/Event.hpp"
+#include "src/kernel/resource/profile/Profile.hpp"
namespace simgrid {
namespace kernel {
namespace profile {
+simgrid::kernel::profile::FutureEvtSet future_evt_set; // FIXME: singleton antipattern
+
FutureEvtSet::FutureEvtSet() = default;
FutureEvtSet::~FutureEvtSet()
{
}
} // namespace profile
} // namespace kernel
-} // namespace simgrid
\ No newline at end of file
+} // namespace simgrid
/* 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 <queue>
#ifndef FUTUREEVTSET_HPP
#define FUTUREEVTSET_HPP
+#include "simgrid/forward.h"
+#include <queue>
+
namespace simgrid {
namespace kernel {
namespace profile {
std::priority_queue<Qelt, std::vector<Qelt>, std::greater<Qelt>> heap_;
};
+// FIXME: kill that singleton
+extern XBT_PRIVATE simgrid::kernel::profile::FutureEvtSet future_evt_set;
+
} // namespace profile
} // namespace kernel
} // namespace simgrid
-#endif
\ No newline at end of file
+#endif
#include "src/kernel/resource/profile/Profile.hpp"
#include "simgrid/forward.h"
-#include "src/kernel/resource/profile/DatedValue.cpp"
-#include "src/kernel/resource/profile/FutureEvtSet.cpp"
-#include "xbt/log.h"
-#include "xbt/sysdep.h"
+#include "src/kernel/resource/profile/DatedValue.hpp"
+#include "src/kernel/resource/profile/Event.hpp"
+#include "src/kernel/resource/profile/FutureEvtSet.hpp"
+#include "src/surf/surf_interface.hpp"
+
#include <boost/algorithm/string.hpp>
+#include <fstream>
#include <ostream>
+#include <unordered_map>
#include <vector>
static std::unordered_map<std::string, simgrid::kernel::profile::Profile*> trace_list;
} // namespace profile
} // namespace kernel
} // namespace simgrid
+
+void tmgr_finalize()
+{
+ for (auto const& kv : trace_list)
+ delete kv.second;
+ trace_list.clear();
+}
+
+void tmgr_trace_event_unref(simgrid::kernel::profile::Event** event)
+{
+ if ((*event)->free_me) {
+ delete *event;
+ *event = nullptr;
+ }
+}
/* 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 PROFILE_HPP
-#define PROFILE_HPP
+#ifndef SIMGRID_KERNEL_PROFILE_HPP
+#define SIMGRID_KERNEL_PROFILE_HPP
+#include "simgrid/forward.h"
#include "src/kernel/resource/profile/DatedValue.hpp"
#include "src/kernel/resource/profile/FutureEvtSet.hpp"
+
#include <queue>
#include <vector>
namespace kernel {
namespace profile {
-class Event {
-public:
- Profile* profile;
- unsigned int idx;
- resource::Resource* resource;
- bool free_me;
-};
-
/** @brief A profile is a set of timed values, encoding the value that a variable takes at what time
*
* It is useful to model dynamic platforms, where an external load that makes the resource availability change over
} // namespace kernel
} // namespace simgrid
-#endif
\ No newline at end of file
+/** Module finalizer: frees all profiles */
+XBT_PUBLIC void tmgr_finalize();
+
+#endif
+++ /dev/null
-/* Copyright (c) 2004-2019. 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 "xbt/log.h"
-#include "xbt/sysdep.h"
-
-#include "src/kernel/resource/profile/trace_mgr.hpp"
-#include "src/surf/surf_interface.hpp"
-#include <boost/algorithm/string.hpp>
-#include <boost/algorithm/string/join.hpp>
-#include <boost/algorithm/string/split.hpp>
-#include <cmath>
-#include <fstream>
-#include <sstream>
-#include <unordered_map>
-
-#include "src/kernel/resource/profile/Profile.cpp"
-
-/** This file has been splitted into three different files:
- - Profile, defining the class Profile and functions that allow to use provided profiles;
- - DatedValue, the class of a DatedValue (a value and a timestamp);
- - FutureEvtSet, a set of events happening in the future. **/
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(profile, resource, "Surf profile management");
-void tmgr_finalize()
-{
- for (auto const& kv : trace_list)
- delete kv.second;
- trace_list.clear();
-}
-
-void tmgr_trace_event_unref(simgrid::kernel::profile::Event** event)
-{
- if ((*event)->free_me) {
- delete *event;
- *event = nullptr;
- }
-}
\ No newline at end of file
+++ /dev/null
-/* Copyright (c) 2004-2019. 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 SURF_PMGR_H
-#define SURF_PMGR_H
-
-#include "simgrid/forward.h"
-#include "src/kernel/resource/profile/Profile.hpp"
-#include "xbt/sysdep.h"
-
-#include <queue>
-#include <vector>
-
-extern XBT_PRIVATE simgrid::kernel::profile::FutureEvtSet future_evt_set;
-
-/**
- * @brief Free a trace event structure
- *
- * This function frees a trace_event if it can be freed, ie, if it has the free_me flag set to 1.
- * This flag indicates whether the structure is still used somewhere or not.
- * When the structure is freed, the argument is set to nullptr
- */
-XBT_PUBLIC void tmgr_trace_event_unref(simgrid::kernel::profile::Event** trace_event);
-XBT_PUBLIC void tmgr_finalize();
-
-#endif /* SURF_PMGR_H */
#include "catch.hpp"
#include "simgrid/kernel/resource/Resource.hpp"
-#include "src/kernel/resource/profile/trace_mgr.hpp"
+#include "src/kernel/resource/profile/DatedValue.hpp"
+#include "src/kernel/resource/profile/Event.hpp"
+#include "src/kernel/resource/profile/Profile.hpp"
#include "src/surf/surf_interface.hpp"
#include "xbt/log.h"
#include "simgrid/kernel/resource/Resource.hpp"
#include "simgrid/s4u/Io.hpp"
#include "simgrid/s4u/Storage.hpp"
-#include "src/kernel/resource/profile/trace_mgr.hpp"
#include "src/surf/PropertyHolder.hpp"
#include "surf_interface.hpp"
#include "cpu_cas01.hpp"
#include "simgrid/sg_config.hpp"
+#include "src/kernel/resource/profile/Event.hpp"
#include "src/surf/cpu_ti.hpp"
#include "src/surf/surf_interface.hpp"
#include "surf/surf.hpp"
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "cpu_interface.hpp"
+#include "src/kernel/resource/profile/Profile.hpp"
#include "src/surf/surf_interface.hpp"
#include "surf/surf.hpp"
{
xbt_assert(speed_.event == nullptr, "Cannot set a second speed trace to Host %s", host_->get_cname());
- speed_.event = profile->schedule(&future_evt_set, this);
+ speed_.event = profile->schedule(&profile::future_evt_set, this);
}
#include "simgrid/kernel/resource/Resource.hpp"
#include "simgrid/s4u/Host.hpp"
#include "src/kernel/lmm/maxmin.hpp"
-#include "src/kernel/resource/profile/trace_mgr.hpp"
#include <list>
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "cpu_ti.hpp"
-#include "src/kernel/resource/profile/trace_mgr.hpp"
+#include "src/kernel/resource/profile/Event.hpp"
+#include "src/kernel/resource/profile/Profile.hpp"
#include "src/surf/surf_interface.hpp"
#include "surf/surf.hpp"
kernel::profile::DatedValue val = profile->event_list.back();
if (val.date_ < 1e-12) {
simgrid::kernel::profile::Profile* prof = new simgrid::kernel::profile::Profile();
- speed_.event = prof->schedule(&future_evt_set, this);
+ speed_.event = prof->schedule(&profile::future_evt_set, this);
}
}
}
#ifndef SURF_MODEL_CPUTI_H_
#define SURF_MODEL_CPUTI_H_
-#include "src/kernel/resource/profile/trace_mgr.hpp"
+#include "src/kernel/resource/profile/Profile.hpp"
#include "src/surf/cpu_interface.hpp"
#include <boost/intrusive/list.hpp>
#include "network_cm02.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/sg_config.hpp"
+#include "src/kernel/resource/profile/Event.hpp"
#include "src/surf/surf_interface.hpp"
#include "surf/surf.hpp"
#include "network_interface.hpp"
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/sg_config.hpp"
+#include "src/kernel/resource/profile/Profile.hpp"
#include "src/surf/surf_interface.hpp"
#include "surf/surf.hpp"
void LinkImpl::set_bandwidth_profile(profile::Profile* profile)
{
xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth profile to Link %s", get_cname());
- bandwidth_.event = profile->schedule(&future_evt_set, this);
+ bandwidth_.event = profile->schedule(&profile::future_evt_set, this);
}
void LinkImpl::set_latency_profile(profile::Profile* profile)
{
xbt_assert(latency_.event == nullptr, "Cannot set a second latency profile to Link %s", get_cname());
- latency_.event = profile->schedule(&future_evt_set, this);
+ latency_.event = profile->schedule(&profile::future_evt_set, this);
}
/**********
#include "simgrid/kernel/resource/Resource.hpp"
#include "simgrid/s4u/Link.hpp"
#include "src/kernel/lmm/maxmin.hpp"
-#include "src/kernel/resource/profile/trace_mgr.hpp"
#include "src/surf/PropertyHolder.hpp"
#include <list>
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "ptask_L07.hpp"
+#include "src/kernel/resource/profile/Event.hpp"
#include "surf/surf.hpp"
#include "xbt/config.hpp"
#include "src/include/simgrid/sg_config.hpp"
#include "src/include/surf/surf.hpp"
#include "src/kernel/EngineImpl.hpp"
+#include "src/kernel/resource/profile/Profile.hpp"
#include "src/simix/smx_private.hpp"
#include "src/surf/HostImpl.hpp"
#include "src/surf/xml/platf_private.hpp"
#include "simgrid/s4u/Engine.hpp"
#include "src/include/surf/surf.hpp"
#include "src/instr/instr_private.hpp"
+#include "src/kernel/resource/profile/FutureEvtSet.hpp"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
#include <algorithm>
simgrid::kernel::resource::Resource* resource = nullptr;
XBT_DEBUG ("Consume all trace events occurring before the starting time.");
- while ((next_event_date = future_evt_set.next_date()) != -1.0) {
+ while ((next_event_date = simgrid::kernel::profile::future_evt_set.next_date()) != -1.0) {
if (next_event_date > NOW)
break;
- while ((event = future_evt_set.pop_leq(next_event_date, &value, &resource))) {
+ while ((event = simgrid::kernel::profile::future_evt_set.pop_leq(next_event_date, &value, &resource))) {
if (value >= 0)
resource->apply_event(event, value);
}
XBT_DEBUG("Looking for next trace event");
while (1) { // Handle next occurring events until none remains
- double next_event_date = future_evt_set.next_date();
+ double next_event_date = simgrid::kernel::profile::future_evt_set.next_date();
XBT_DEBUG("Next TRACE event: %f", next_event_date);
if (not surf_network_model->next_occuring_event_is_idempotent()) { // NS3, I see you
XBT_DEBUG("Updating models (min = %g, NOW = %g, next_event_date = %g)", time_delta, NOW, next_event_date);
- while ((event = future_evt_set.pop_leq(next_event_date, &value, &resource))) {
+ while ((event = simgrid::kernel::profile::future_evt_set.pop_leq(next_event_date, &value, &resource))) {
if (resource->is_used() || (watched_hosts.find(resource->get_cname()) != watched_hosts.end())) {
time_delta = next_event_date - NOW;
XBT_DEBUG("This event invalidates the next_occuring_event() computation of models. Next event set to %f", time_delta);
#include "mc/mc.h"
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/sg_config.hpp"
+#include "src/kernel/resource/profile/FutureEvtSet.hpp"
+#include "src/kernel/resource/profile/Profile.hpp"
#include "src/simgrid/version.h"
#include "src/surf/HostImpl.hpp"
#include "src/surf/xml/platf.hpp"
#include "simgrid/kernel/routing/NetPoint.hpp"
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/sg_config.hpp"
+#include "src/kernel/resource/profile/FutureEvtSet.hpp"
+#include "src/kernel/resource/profile/Profile.hpp"
#include "src/surf/network_interface.hpp"
#include "src/surf/surf_interface.hpp"
#include "src/surf/xml/platf_private.hpp"
src/kernel/resource/Action.cpp
src/kernel/resource/Model.cpp
src/kernel/resource/Resource.cpp
- src/kernel/resource/profile/trace_mgr.hpp
- src/kernel/resource/profile/trace_mgr.cpp
+
+ src/kernel/resource/profile/DatedValue.cpp
+ src/kernel/resource/profile/DatedValue.hpp
+ src/kernel/resource/profile/Event.hpp
+ src/kernel/resource/profile/FutureEvtSet.cpp
+ src/kernel/resource/profile/FutureEvtSet.hpp
+ src/kernel/resource/profile/Profile.cpp
+ src/kernel/resource/profile/Profile.hpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/DijkstraZone.cpp