summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
135f798)
The HostLoad plugin keeps track of all the computations that are going on
and does no longer have to rely on calculations of the sort time_passed*speed.
Instead, we can now access the total cost of the computation and keep track
of how much is still remaining. Like this, we always account for exactly
the cost of that calculation.
#include "simgrid/plugins/load.h"
#include "src/include/surf/surf.hpp"
#include "simgrid/plugins/load.h"
#include "src/include/surf/surf.hpp"
+#include "src/kernel/activity/ExecImpl.hpp"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
#include <simgrid/s4u.hpp>
#include "src/plugins/vm/VirtualMachineImpl.hpp"
#include <simgrid/s4u.hpp>
namespace simgrid {
namespace plugin {
namespace simgrid {
namespace plugin {
+static const double activity_uninitialized_remaining_cost = -1;
+
class HostLoad {
public:
static simgrid::xbt::Extension<simgrid::s4u::Host, HostLoad> EXTENSION_ID;
class HostLoad {
public:
static simgrid::xbt::Extension<simgrid::s4u::Host, HostLoad> EXTENSION_ID;
double get_idle_time() { update(); return idle_time_; } /** Return idle time since last reset */
double get_total_idle_time() { update(); return total_idle_time_; } /** Return idle time over the whole simulation */
void update();
double get_idle_time() { update(); return idle_time_; } /** Return idle time since last reset */
double get_total_idle_time() { update(); return total_idle_time_; } /** Return idle time over the whole simulation */
void update();
+ void add_activity(simgrid::kernel::activity::ExecImplPtr activity);
void reset();
private:
simgrid::s4u::Host* host_ = nullptr;
void reset();
private:
simgrid::s4u::Host* host_ = nullptr;
+ /* Stores all currently ongoing activities (computations) on this machine */
+ std::map<simgrid::kernel::activity::ExecImplPtr, /* cost still remaining*/double> current_activities;
double last_updated_ = 0;
double last_reset_ = 0;
/**
double last_updated_ = 0;
double last_reset_ = 0;
/**
simgrid::xbt::Extension<simgrid::s4u::Host, HostLoad> HostLoad::EXTENSION_ID;
simgrid::xbt::Extension<simgrid::s4u::Host, HostLoad> HostLoad::EXTENSION_ID;
+void HostLoad::add_activity(simgrid::kernel::activity::ExecImplPtr activity)
+{
+ current_activities.insert({activity, activity_uninitialized_remaining_cost});
+}
+
void HostLoad::update()
{
double now = surf_get_clock();
void HostLoad::update()
{
double now = surf_get_clock();