1 /* Copyright (c) 2010-2022. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include <simgrid/Exception.hpp>
7 #include <simgrid/kernel/routing/NetPoint.hpp>
8 #include <simgrid/s4u/Engine.hpp>
9 #include <xbt/random.hpp>
11 #include "src/instr/instr_private.hpp"
12 #include "src/kernel/resource/StandardLinkImpl.hpp"
16 enum class InstrUserVariable { DECLARE, SET, ADD, SUB };
18 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API");
20 std::set<std::string, std::less<>> created_categories;
21 std::set<std::string, std::less<>> declared_marks;
22 std::set<std::string, std::less<>> user_host_variables;
23 std::set<std::string, std::less<>> user_vm_variables;
24 std::set<std::string, std::less<>> user_link_variables;
26 static void instr_user_variable(double time, const std::string& resource, const std::string& variable_name,
27 const std::string& parent_type, double value, InstrUserVariable what,
28 const std::string& color, std::set<std::string, std::less<>>* filter)
30 /* safe switches. tracing has to be activated and if platform is not traced, we don't allow user variables */
31 if (not TRACE_is_enabled() || not TRACE_needs_platform())
34 // check if variable is already declared
35 auto created = filter->find(variable_name);
36 if (what == InstrUserVariable::DECLARE) {
37 if (created == filter->end()) { // not declared yet
38 filter->insert(variable_name);
39 instr_new_user_variable_type(parent_type, variable_name, color);
42 if (created != filter->end()) { // declared, let's work
43 simgrid::instr::VariableType* variable =
44 simgrid::instr::Container::by_name(resource)->get_variable(variable_name);
46 case InstrUserVariable::SET:
47 variable->set_event(time, value);
49 case InstrUserVariable::ADD:
50 variable->add_event(time, value);
52 case InstrUserVariable::SUB:
53 variable->sub_event(time, value);
62 static void instr_user_srcdst_variable(double time, const std::string& src, const std::string& dst,
63 const std::string& variable, double value, InstrUserVariable what)
65 const auto* engine = simgrid::s4u::Engine::get_instance();
66 const auto* src_elm = engine->netpoint_by_name_or_null(src);
67 xbt_assert(src_elm, "Element '%s' not found!", src.c_str());
69 const auto* dst_elm = engine->netpoint_by_name_or_null(dst);
70 xbt_assert(dst_elm, "Element '%s' not found!", dst.c_str());
72 std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
73 simgrid::kernel::routing::NetZoneImpl::get_global_route(src_elm, dst_elm, route, nullptr);
74 for (auto const& link : route)
75 instr_user_variable(time, link->get_cname(), variable, "LINK", value, what, "", &user_link_variables);
80 /* for host variables */
81 /** @brief Declare a new user variable associated to hosts.
83 * Declare a user variable that will be associated to hosts.
84 * A user host variable can be used to trace user variables such as the number of tasks in a server, the number of
85 * clients in an application (for hosts), and so on. The color associated to this new variable will be random if
86 * not given as parameter.
88 void declare_host_variable(const std::string& variable, const std::string& color)
90 instr_user_variable(0, "", variable, "HOST", 0, InstrUserVariable::DECLARE, color, &user_host_variables);
93 void set_host_variable(const std::string& host, const std::string& variable, double value, double time)
95 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::SET, "", &user_host_variables);
98 /** @brief Add a value to a variable of a host */
99 void add_host_variable(const std::string& host, const std::string& variable, double value, double time)
101 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::ADD, "", &user_host_variables);
104 /** @brief Subtract a value to a variable of a host */
105 void sub_host_variable(const std::string& host, const std::string& variable, double value, double time)
107 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::SUB, "", &user_host_variables);
110 /** @brief Get host variables that were already declared with #declare_host_variable. */
111 const std::set<std::string, std::less<>>& get_host_variables()
113 return user_host_variables;
116 /* for link variables */
117 /** @brief Declare a new user variable associated to links.
119 * Declare a user variable that will be associated to links.
120 * A user link variable can be used, for example, to trace user variables such as the number of messages being
121 * transferred through network links. The color associated to this new variable will be random if not given as
124 void declare_link_variable(const std::string& variable, const std::string& color)
126 instr_user_variable(0, "", variable, "LINK", 0, InstrUserVariable::DECLARE, color, &user_link_variables);
129 /** @brief Set the value of a variable of a link */
130 void set_link_variable(const std::string& link, const std::string& variable, double value, double time)
132 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::SET, "", &user_link_variables);
135 void set_link_variable(const std::string& src, const std::string& dst, const std::string& variable, double value,
138 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::SET);
141 /** @brief Add a value to a variable of a link */
142 void add_link_variable(const std::string& link, const std::string& variable, double value, double time)
144 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::ADD, "", &user_link_variables);
147 /** @brief Add a value to a variable of a link */
148 void add_link_variable(const std::string& src, const std::string& dst, const std::string& variable, double value,
151 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::ADD);
154 /** @brief Subtract a value to a variable of a link */
155 void sub_link_variable(const std::string& link, const std::string& variable, double value, double time)
157 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::SUB, "", &user_link_variables);
160 /** @brief Subtract a value to a variable of a link */
161 void sub_link_variable(const std::string& src, const std::string& dst, const std::string& variable, double value,
164 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::SUB);
167 /** @brief Get link variables that were already declared with #declare_link_variable. */
168 const std::set<std::string, std::less<>>& get_link_variables()
170 return user_link_variables;
173 /* for VM variables */
174 /** @brief Declare a new user variable associated to VMs.
176 * Declare a user variable that will be associated to VMs. A user host variable can be used to trace user variables
177 * such as the number of tasks in a VM, the number of clients in an application (for hosts), and so on. The color
178 * associated to this new variable will be random if not given as parameter.
180 void declare_vm_variable(const std::string& variable, const std::string& color)
182 instr_user_variable(0, "", variable, "VM", 0, InstrUserVariable::DECLARE, color, &user_vm_variables);
185 /** @brief Set the value of a variable of a vm */
186 void set_vm_variable(const std::string& vm, const std::string& variable, double value, double time)
188 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::SET, "", &user_vm_variables);
191 /** @brief Add a value to a variable of a VM */
192 void add_vm_variable(const std::string& vm, const std::string& variable, double value, double time)
194 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::ADD, "", &user_vm_variables);
197 /** @brief Subtract a value from a variable of a VM */
198 void sub_vm_variable(const std::string& vm, const std::string& variable, double value, double time)
200 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::SUB, "", &user_vm_variables);
203 /** @brief Get VM variables that were already declared with #declare_vm_variable. */
204 const std::set<std::string, std::less<>>& get_vm_variables()
206 return user_vm_variables;
209 /**@brief Declare a new type for tracing mark.
211 * This function declares a new Paje event type in the trace file that can be used by simulators to declare
212 * application-level marks. This function is independent of which API is used in SimGrid.
214 void declare_mark(const std::string& mark_type)
216 /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with marks */
217 if (not TRACE_is_enabled() || not TRACE_needs_platform())
220 // check if mark_type is already declared
221 if (declared_marks.find(mark_type) != declared_marks.end()) {
222 throw TracingError(XBT_THROW_POINT,
223 xbt::string_printf("mark_type with name (%s) is already declared", mark_type.c_str()));
226 XBT_DEBUG("MARK,declare %s", mark_type.c_str());
227 Container::get_root()->get_type()->by_name_or_create<EventType>(mark_type);
228 declared_marks.emplace(mark_type);
231 /** @brief Declare a new colored value for a previously declared mark type.
233 * This function declares a new colored value for a Paje event type in the trace file that can be used by simulators to
234 * declare application-level marks. This function is independent of which API is used in SimGrid. The color needs to be
235 * a string with three numbers separated by spaces in the range [0,1].
236 * A light-gray color can be specified using "0.7 0.7 0.7" as color. If no color is provided, the default color used
237 * will be white ("1 1 1").
239 void declare_mark_value(const std::string& mark_type, const std::string& mark_value, const std::string& mark_color)
241 /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with marks */
242 if (not TRACE_is_enabled() || not TRACE_needs_platform())
245 auto* type = static_cast<EventType*>(Container::get_root()->get_type()->by_name(mark_type));
247 throw TracingError(XBT_THROW_POINT,
248 xbt::string_printf("mark_type with name (%s) is not declared", mark_type.c_str()));
250 XBT_DEBUG("MARK, declare_value %s %s %s", mark_type.c_str(), mark_value.c_str(), mark_color.c_str());
251 type->add_entity_value(mark_value, mark_color);
255 /** @brief Create a new instance of a tracing mark type.
257 * This function creates a mark in the trace file. The first parameter had to be previously declared using
258 * #declare_mark, the second is the identifier for this mark instance. We recommend that the mark_value is a
259 * unique value for the whole simulation. Nevertheless, this is not a strong requirement: the trace will be valid even
260 * if there are multiple mark identifiers for the same trace.
262 void mark(const std::string& mark_type, const std::string& mark_value)
264 /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with marks */
265 if (not TRACE_is_enabled() || not TRACE_needs_platform())
268 // check if mark_type is already declared
269 auto* type = static_cast<EventType*>(Container::get_root()->get_type()->by_name(mark_type));
271 throw TracingError(XBT_THROW_POINT,
272 xbt::string_printf("mark_type with name (%s) is not declared", mark_type.c_str()));
274 XBT_DEBUG("MARK %s %s", mark_type.c_str(), mark_value.c_str());
275 new NewEvent(simgrid_get_clock(), Container::get_root(), type, type->get_entity_value(mark_value));
279 /** @brief Get marks that were already declared with #declare_mark. */
280 const std::set<std::string, std::less<>>& get_marks()
282 return declared_marks;
285 /** @brief Declare a new category.
287 * This function should be used to define a user category. The category can be used to differentiate the tasks that
288 * are created during the simulation (for example, tasks from server1, server2, or request tasks, computation tasks,
289 * communication tasks). All resource utilization (host power and link bandwidth) will be classified according to the
290 * task category. Tasks that do not belong to a category are not traced. The color for the category that is being
291 * declared is random. This function has no effect if a category with the same name has been already declared.
293 * See @ref outcomes_vizu for details on how to trace the (categorized) resource utilization.
295 void declare_tracing_category(const std::string& name, const std::string& color)
297 /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with categories */
298 if (not TRACE_is_enabled() || not TRACE_needs_platform() || not TRACE_categorized())
301 // check if category is already created
302 if (created_categories.find(name) != created_categories.end())
305 created_categories.emplace(name);
307 // define final_color
308 std::string final_color;
310 // generate a random color
311 double red = simgrid::xbt::random::uniform_real(0.0, std::nextafter(1.0, 2.0));
312 double green = simgrid::xbt::random::uniform_real(0.0, std::nextafter(1.0, 2.0));
313 double blue = simgrid::xbt::random::uniform_real(0.0, std::nextafter(1.0, 2.0));
314 final_color = std::to_string(red) + " " + std::to_string(green) + " " + std::to_string(blue);
316 final_color = std::string(color);
319 XBT_DEBUG("CAT,declare %s, \"%s\" \"%s\"", name.c_str(), color.c_str(), final_color.c_str());
321 // define the type of this category on top of hosts and links
322 instr_new_variable_type(name, final_color);
325 /** @brief Get categories that were already declared with #declare_tracing_category.
327 * See @ref outcomes_vizu for details on how to trace the (categorized) resource utilization.
329 const std::set<std::string, std::less<>>& get_tracing_categories()
331 return created_categories;
335 } // namespace simgrid
337 static xbt_dynar_t instr_set_to_dynar(const std::set<std::string, std::less<>>& filter) // XBT_ATTRIB_DEPRECATED_v334
339 if (not TRACE_is_enabled() || not TRACE_needs_platform())
342 xbt_dynar_t ret = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
343 for (auto const& name : filter)
344 xbt_dynar_push_as(ret, char*, xbt_strdup(name.c_str()));
349 void TRACE_category(const char* category) // XBT_ATTRIB_DEPRECATED_v334
351 simgrid::instr::declare_tracing_category(category);
354 void TRACE_category_with_color(const char* category, const char* color) // XBT_ATTRIB_DEPRECATED_v334
356 simgrid::instr::declare_tracing_category(category, color);
359 xbt_dynar_t TRACE_get_categories() // XBT_ATTRIB_DEPRECATED_v334
361 if (not TRACE_is_enabled() || not TRACE_categorized())
363 return instr_set_to_dynar(created_categories);
366 void TRACE_declare_mark(const char* mark_type) // XBT_ATTRIB_DEPRECATED_v334
368 simgrid::instr::declare_mark(mark_type);
371 void TRACE_declare_mark_value_with_color(const char* mark_type, const char* mark_value,
372 const char* mark_color) // XBT_ATTRIB_DEPRECATED_v334
374 simgrid::instr::declare_mark_value(mark_type, mark_value, mark_color);
377 void TRACE_declare_mark_value(const char* mark_type, const char* mark_value) // XBT_ATTRIB_DEPRECATED_v334
379 simgrid::instr::declare_mark_value(mark_type, mark_value);
382 void TRACE_mark(const char* mark_type, const char* mark_value) // XBT_ATTRIB_DEPRECATED_v334
384 simgrid::instr::mark(mark_type, mark_value);
387 xbt_dynar_t TRACE_get_marks() // XBT_ATTRIB_DEPRECATED_v334
389 if (not TRACE_is_enabled())
392 return instr_set_to_dynar(declared_marks);
395 int TRACE_platform_graph_export_graphviz(const char* filename) // XBT_ATTRIB_DEPRECATED_v334
397 simgrid::instr::platform_graph_export_graphviz(filename);
401 void TRACE_vm_variable_declare(const char* variable) // XBT_ATTRIB_DEPRECATED_v334
403 instr_user_variable(0, "", variable, "VM", 0, InstrUserVariable::DECLARE, "", &user_vm_variables);
405 void TRACE_vm_variable_declare_with_color(const char* variable, const char* color) // XBT_ATTRIB_DEPRECATED_v334
407 instr_user_variable(0, "", variable, "VM", 0, InstrUserVariable::DECLARE, color, &user_vm_variables);
410 void TRACE_vm_variable_set(const char* vm, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
412 instr_user_variable(simgrid_get_clock(), vm, variable, "VM", value, InstrUserVariable::SET, "", &user_vm_variables);
415 void TRACE_vm_variable_add(const char* vm, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
417 instr_user_variable(simgrid_get_clock(), vm, variable, "VM", value, InstrUserVariable::ADD, "", &user_vm_variables);
419 void TRACE_vm_variable_sub(const char* vm, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
421 instr_user_variable(simgrid_get_clock(), vm, variable, "VM", value, InstrUserVariable::SUB, "", &user_vm_variables);
424 void TRACE_vm_variable_set_with_time(double time, const char* vm, const char* variable,
425 double value) // XBT_ATTRIB_DEPRECATED_v334
427 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::SET, "", &user_vm_variables);
430 void TRACE_vm_variable_add_with_time(double time, const char* vm, const char* variable,
431 double value) // XBT_ATTRIB_DEPRECATED_v334
433 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::ADD, "", &user_vm_variables);
435 void TRACE_vm_variable_sub_with_time(double time, const char* vm, const char* variable,
436 double value) // XBT_ATTRIB_DEPRECATED_v334
438 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::SUB, "", &user_vm_variables);
441 void TRACE_host_variable_declare(const char* variable) // XBT_ATTRIB_DEPRECATED_v334
443 simgrid::instr::declare_host_variable(variable);
446 void TRACE_host_variable_declare_with_color(const char* variable, const char* color) // XBT_ATTRIB_DEPRECATED_v334
448 simgrid::instr::declare_host_variable(variable, color);
451 void TRACE_host_variable_set(const char* host, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
453 instr_user_variable(simgrid_get_clock(), host, variable, "HOST", value, InstrUserVariable::SET, "",
454 &user_host_variables);
457 void TRACE_host_variable_add(const char* host, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
459 instr_user_variable(simgrid_get_clock(), host, variable, "HOST", value, InstrUserVariable::ADD, "",
460 &user_host_variables);
463 void TRACE_host_variable_sub(const char* host, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
465 instr_user_variable(simgrid_get_clock(), host, variable, "HOST", value, InstrUserVariable::SUB, "",
466 &user_host_variables);
469 void TRACE_host_variable_set_with_time(double time, const char* host, const char* variable,
470 double value) // XBT_ATTRIB_DEPRECATED_v334
472 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::SET, "", &user_host_variables);
475 void TRACE_host_variable_add_with_time(double time, const char* host, const char* variable,
476 double value) // XBT_ATTRIB_DEPRECATED_v334
478 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::ADD, "", &user_host_variables);
481 void TRACE_host_variable_sub_with_time(double time, const char* host, const char* variable,
482 double value) // XBT_ATTRIB_DEPRECATED_v334
484 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::SUB, "", &user_host_variables);
487 xbt_dynar_t TRACE_get_host_variables() // XBT_ATTRIB_DEPRECATED_v334
489 return instr_set_to_dynar(user_host_variables);
492 void TRACE_link_variable_declare(const char* variable) // XBT_ATTRIB_DEPRECATED_v334
494 simgrid::instr::declare_link_variable(variable);
497 void TRACE_link_variable_declare_with_color(const char* variable, const char* color) // XBT_ATTRIB_DEPRECATED_v334
499 simgrid::instr::declare_link_variable(variable, color);
502 void TRACE_link_variable_set(const char* link, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
504 instr_user_variable(simgrid_get_clock(), link, variable, "LINK", value, InstrUserVariable::SET, "",
505 &user_link_variables);
508 void TRACE_link_variable_add(const char* link, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
510 instr_user_variable(simgrid_get_clock(), link, variable, "LINK", value, InstrUserVariable::ADD, "",
511 &user_link_variables);
514 void TRACE_link_variable_sub(const char* link, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
516 instr_user_variable(simgrid_get_clock(), link, variable, "LINK", value, InstrUserVariable::SUB, "",
517 &user_link_variables);
520 void TRACE_link_variable_set_with_time(double time, const char* link, const char* variable,
521 double value) // XBT_ATTRIB_DEPRECATED_v334
523 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::SET, "", &user_link_variables);
526 void TRACE_link_variable_add_with_time(double time, const char* link, const char* variable,
527 double value) // XBT_ATTRIB_DEPRECATED_v334
529 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::ADD, "", &user_link_variables);
532 void TRACE_link_variable_sub_with_time(double time, const char* link, const char* variable,
533 double value) // XBT_ATTRIB_DEPRECATED_v334
535 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::SUB, "", &user_link_variables);
538 void TRACE_link_srcdst_variable_set(const char* src, const char* dst, const char* variable,
539 double value) // XBT_ATTRIB_DEPRECATED_v334
541 instr_user_srcdst_variable(simgrid_get_clock(), src, dst, variable, value, InstrUserVariable::SET);
544 void TRACE_link_srcdst_variable_add(const char* src, const char* dst, const char* variable,
545 double value) // XBT_ATTRIB_DEPRECATED_v334
547 instr_user_srcdst_variable(simgrid_get_clock(), src, dst, variable, value, InstrUserVariable::ADD);
550 void TRACE_link_srcdst_variable_sub(const char* src, const char* dst, const char* variable,
551 double value) // XBT_ATTRIB_DEPRECATED_v334
553 instr_user_srcdst_variable(simgrid_get_clock(), src, dst, variable, value, InstrUserVariable::SUB);
556 void TRACE_link_srcdst_variable_set_with_time(double time, const char* src, const char* dst, const char* variable,
557 double value) // XBT_ATTRIB_DEPRECATED_v334
559 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::SET);
562 void TRACE_link_srcdst_variable_add_with_time(double time, const char* src, const char* dst, const char* variable,
563 double value) // XBT_ATTRIB_DEPRECATED_v334
565 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::ADD);
568 void TRACE_link_srcdst_variable_sub_with_time(double time, const char* src, const char* dst, const char* variable,
569 double value) // XBT_ATTRIB_DEPRECATED_v334
571 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::SUB);
574 xbt_dynar_t TRACE_get_link_variables() // XBT_ATTRIB_DEPRECATED_v334
576 return instr_set_to_dynar(user_link_variables);
579 /** @ingroup TRACE_user_variables
580 * @brief Declare a new user state associated to hosts.
582 * Declare a user state that will be associated to hosts.
583 * A user host state can be used to trace application states.
585 * @param state The name of the new state to be declared.
587 * @see TRACE_host_state_declare_value
589 void TRACE_host_state_declare (const char *state)
591 instr_new_user_state_type("HOST", state);
594 /** @ingroup TRACE_user_variables
595 * @brief Declare a new value for a user state associated to hosts.
597 * Declare a value for a state. The color needs to be a string with 3 numbers separated by spaces in the range [0,1].
598 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
600 * @param state The name of the new state to be declared.
601 * @param value The name of the value
602 * @param color The color of the value
604 * @see TRACE_host_state_declare
606 void TRACE_host_state_declare_value (const char *state, const char *value, const char *color)
608 instr_new_value_for_user_state_type (state, value, color);
611 /** @ingroup TRACE_user_variables
612 * @brief Set the user state to the given value.
614 * Change a user state previously declared to the given value.
616 * @param host The name of the host to be considered.
617 * @param state_name The name of the state previously declared.
618 * @param value_name The new value of the state.
620 * @see TRACE_host_state_declare, TRACE_host_push_state, TRACE_host_pop_state
622 void TRACE_host_set_state(const char* host, const char* state_name, const char* value_name)
624 simgrid::instr::StateType* state = simgrid::instr::Container::by_name(host)->get_state(state_name);
625 state->add_entity_value(value_name);
626 state->set_event(value_name);
629 /** @ingroup TRACE_user_variables
630 * @brief Push a new value for a state of a given host.
632 * Change a user state previously declared by pushing the new value to the state.
634 * @param host The name of the host to be considered.
635 * @param state_name The name of the state previously declared.
636 * @param value_name The value to be pushed.
638 * @see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_pop_state
640 void TRACE_host_push_state(const char* host, const char* state_name, const char* value_name)
642 simgrid::instr::Container::by_name(host)->get_state(state_name)->push_event(value_name);
645 /** @ingroup TRACE_user_variables
646 * @brief Pop the last value of a state of a given host.
648 * Change a user state previously declared by removing the last value of the state.
650 * @param host The name of the host to be considered.
651 * @param state_name The name of the state to be popped.
653 * @see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_push_state
655 void TRACE_host_pop_state(const char* host, const char* state_name)
657 simgrid::instr::Container::by_name(host)->get_state(state_name)->pop_event();