- if (TRACE_vm_is_enabled()) {
- simgrid::instr::ContainerType* msg_vm = container->type_->getOrCreateContainerType("MSG_VM");
- simgrid::instr::StateType* state = msg_vm->getOrCreateStateType("MSG_VM_STATE");
- state->addEntityValue("suspend", "1 0 1");
- state->addEntityValue("sleep", "1 1 0");
- state->addEntityValue("receive", "1 0 0");
- state->addEntityValue("send", "0 0 1");
- state->addEntityValue("task_execute", "0 1 1");
- root->type_->getOrCreateLinkType("MSG_VM_LINK", msg_vm, msg_vm);
- root->type_->getOrCreateLinkType("MSG_VM_ACTOR_LINK", msg_vm, msg_vm);
+static void instr_host_on_speed_change(simgrid::s4u::Host& host)
+{
+ simgrid::instr::Container::by_name(host.get_cname())
+ ->get_variable("power")
+ ->set_event(surf_get_clock(), host.get_core_count() * host.get_available_speed());
+}
+
+static void instr_cpu_action_on_state_change(simgrid::surf::CpuAction* action)
+{
+ simgrid::surf::Cpu* cpu = static_cast<simgrid::surf::Cpu*>(action->get_variable()->get_constraint(0)->get_id());
+ TRACE_surf_resource_set_utilization("HOST", "power_used", cpu->get_cname(), action->get_category(),
+ action->get_variable()->get_value(), action->get_last_update(),
+ SIMIX_get_clock() - action->get_last_update());
+}
+
+static void instr_link_on_communication_state_change(simgrid::kernel::resource::NetworkAction* action)
+{
+ int n = action->get_variable()->get_number_of_constraint();
+
+ for (int i = 0; i < n; i++) {
+ simgrid::kernel::lmm::Constraint* constraint = action->get_variable()->get_constraint(i);
+ simgrid::kernel::resource::LinkImpl* link = static_cast<simgrid::kernel::resource::LinkImpl*>(constraint->get_id());
+ double value = action->get_variable()->get_value() * action->get_variable()->get_constraint_weight(i);
+ TRACE_surf_resource_set_utilization("LINK", "bandwidth_used", link->get_cname(), action->get_category(), value,
+ action->get_last_update(), SIMIX_get_clock() - action->get_last_update());