1 /* Copyright (c) 2010-2023. 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 static std::set<std::string, std::less<>> created_categories;
21 static std::set<std::string, std::less<>> declared_marks;
22 static std::set<std::string, std::less<>> user_host_variables;
23 static std::set<std::string, std::less<>> user_vm_variables;
24 static 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);
78 namespace simgrid::instr {
79 /* for host variables */
80 /** @brief Declare a new user variable associated to hosts.
82 * Declare a user variable that will be associated to hosts.
83 * A user host variable can be used to trace user variables such as the number of tasks in a server, the number of
84 * clients in an application (for hosts), and so on. The color associated to this new variable will be random if
85 * not given as parameter.
87 void declare_host_variable(const std::string& variable, const std::string& color)
89 instr_user_variable(0, "", variable, "HOST", 0, InstrUserVariable::DECLARE, color, &user_host_variables);
92 void set_host_variable(const std::string& host, const std::string& variable, double value, double time)
94 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::SET, "", &user_host_variables);
97 /** @brief Add a value to a variable of a host */
98 void add_host_variable(const std::string& host, const std::string& variable, double value, double time)
100 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::ADD, "", &user_host_variables);
103 /** @brief Subtract a value to a variable of a host */
104 void sub_host_variable(const std::string& host, const std::string& variable, double value, double time)
106 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::SUB, "", &user_host_variables);
109 /** @brief Get host variables that were already declared with #declare_host_variable. */
110 const std::set<std::string, std::less<>>& get_host_variables()
112 return user_host_variables;
115 /* for link variables */
116 /** @brief Declare a new user variable associated to links.
118 * Declare a user variable that will be associated to links.
119 * A user link variable can be used, for example, to trace user variables such as the number of messages being
120 * transferred through network links. The color associated to this new variable will be random if not given as
123 void declare_link_variable(const std::string& variable, const std::string& color)
125 instr_user_variable(0, "", variable, "LINK", 0, InstrUserVariable::DECLARE, color, &user_link_variables);
128 /** @brief Set the value of a variable of a link */
129 void set_link_variable(const std::string& link, const std::string& variable, double value, double time)
131 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::SET, "", &user_link_variables);
134 void set_link_variable(const std::string& src, const std::string& dst, const std::string& variable, double value,
137 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::SET);
140 /** @brief Add a value to a variable of a link */
141 void add_link_variable(const std::string& link, const std::string& variable, double value, double time)
143 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::ADD, "", &user_link_variables);
146 /** @brief Add a value to a variable of a link */
147 void add_link_variable(const std::string& src, const std::string& dst, const std::string& variable, double value,
150 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::ADD);
153 /** @brief Subtract a value to a variable of a link */
154 void sub_link_variable(const std::string& link, const std::string& variable, double value, double time)
156 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::SUB, "", &user_link_variables);
159 /** @brief Subtract a value to a variable of a link */
160 void sub_link_variable(const std::string& src, const std::string& dst, const std::string& variable, double value,
163 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::SUB);
166 /** @brief Get link variables that were already declared with #declare_link_variable. */
167 const std::set<std::string, std::less<>>& get_link_variables()
169 return user_link_variables;
172 /* for VM variables */
173 /** @brief Declare a new user variable associated to VMs.
175 * Declare a user variable that will be associated to VMs. A user host variable can be used to trace user variables
176 * such as the number of tasks in a VM, the number of clients in an application (for hosts), and so on. The color
177 * associated to this new variable will be random if not given as parameter.
179 void declare_vm_variable(const std::string& variable, const std::string& color)
181 instr_user_variable(0, "", variable, "VM", 0, InstrUserVariable::DECLARE, color, &user_vm_variables);
184 /** @brief Set the value of a variable of a vm */
185 void set_vm_variable(const std::string& vm, const std::string& variable, double value, double time)
187 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::SET, "", &user_vm_variables);
190 /** @brief Add a value to a variable of a VM */
191 void add_vm_variable(const std::string& vm, const std::string& variable, double value, double time)
193 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::ADD, "", &user_vm_variables);
196 /** @brief Subtract a value from a variable of a VM */
197 void sub_vm_variable(const std::string& vm, const std::string& variable, double value, double time)
199 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::SUB, "", &user_vm_variables);
202 /** @brief Get VM variables that were already declared with #declare_vm_variable. */
203 const std::set<std::string, std::less<>>& get_vm_variables()
205 return user_vm_variables;
208 /**@brief Declare a new type for tracing mark.
210 * This function declares a new Paje event type in the trace file that can be used by simulators to declare
211 * application-level marks. This function is independent of which API is used in SimGrid.
213 void declare_mark(const std::string& mark_type)
215 /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with marks */
216 if (not TRACE_is_enabled() || not TRACE_needs_platform())
219 // check if mark_type is already declared
220 if (declared_marks.find(mark_type) != declared_marks.end()) {
221 throw TracingError(XBT_THROW_POINT,
222 xbt::string_printf("mark_type with name (%s) is already declared", mark_type.c_str()));
225 XBT_DEBUG("MARK,declare %s", mark_type.c_str());
226 Container::get_root()->get_type()->by_name_or_create<EventType>(mark_type);
227 declared_marks.emplace(mark_type);
230 /** @brief Declare a new colored value for a previously declared mark type.
232 * This function declares a new colored value for a Paje event type in the trace file that can be used by simulators to
233 * declare application-level marks. This function is independent of which API is used in SimGrid. The color needs to be
234 * a string with three numbers separated by spaces in the range [0,1].
235 * 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
236 * will be white ("1 1 1").
238 void declare_mark_value(const std::string& mark_type, const std::string& mark_value, const std::string& mark_color)
240 /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with marks */
241 if (not TRACE_is_enabled() || not TRACE_needs_platform())
244 auto* type = static_cast<EventType*>(Container::get_root()->get_type()->by_name(mark_type));
246 throw TracingError(XBT_THROW_POINT,
247 xbt::string_printf("mark_type with name (%s) is not declared", mark_type.c_str()));
249 XBT_DEBUG("MARK, declare_value %s %s %s", mark_type.c_str(), mark_value.c_str(), mark_color.c_str());
250 type->add_entity_value(mark_value, mark_color);
254 /** @brief Create a new instance of a tracing mark type.
256 * This function creates a mark in the trace file. The first parameter had to be previously declared using
257 * #declare_mark, the second is the identifier for this mark instance. We recommend that the mark_value is a
258 * unique value for the whole simulation. Nevertheless, this is not a strong requirement: the trace will be valid even
259 * if there are multiple mark identifiers for the same trace.
261 void mark(const std::string& mark_type, const std::string& mark_value)
263 /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with marks */
264 if (not TRACE_is_enabled() || not TRACE_needs_platform())
267 // check if mark_type is already declared
268 auto* type = static_cast<EventType*>(Container::get_root()->get_type()->by_name(mark_type));
270 throw TracingError(XBT_THROW_POINT,
271 xbt::string_printf("mark_type with name (%s) is not declared", mark_type.c_str()));
273 XBT_DEBUG("MARK %s %s", mark_type.c_str(), mark_value.c_str());
274 new NewEvent(simgrid_get_clock(), Container::get_root(), type, type->get_entity_value(mark_value));
278 /** @brief Get marks that were already declared with #declare_mark. */
279 const std::set<std::string, std::less<>>& get_marks()
281 return declared_marks;
284 /** @brief Declare a new category.
286 * This function should be used to define a user category. The category can be used to differentiate the tasks that
287 * are created during the simulation (for example, tasks from server1, server2, or request tasks, computation tasks,
288 * communication tasks). All resource utilization (host power and link bandwidth) will be classified according to the
289 * task category. Tasks that do not belong to a category are not traced. The color for the category that is being
290 * declared is random. This function has no effect if a category with the same name has been already declared.
292 * See @ref outcomes_vizu for details on how to trace the (categorized) resource utilization.
294 void declare_tracing_category(const std::string& name, const std::string& color)
296 /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with categories */
297 if (not TRACE_is_enabled() || not TRACE_needs_platform() || not TRACE_categorized())
300 // check if category is already created
301 if (created_categories.find(name) != created_categories.end())
304 created_categories.emplace(name);
306 // define final_color
307 std::string final_color;
309 // generate a random color
310 double red = simgrid::xbt::random::uniform_real(0.0, std::nextafter(1.0, 2.0));
311 double green = simgrid::xbt::random::uniform_real(0.0, std::nextafter(1.0, 2.0));
312 double blue = simgrid::xbt::random::uniform_real(0.0, std::nextafter(1.0, 2.0));
313 final_color = std::to_string(red) + " " + std::to_string(green) + " " + std::to_string(blue);
318 XBT_DEBUG("CAT,declare %s, \"%s\" \"%s\"", name.c_str(), color.c_str(), final_color.c_str());
320 // define the type of this category on top of hosts and links
321 instr_new_variable_type(name, final_color);
324 /** @brief Get categories that were already declared with #declare_tracing_category.
326 * See @ref outcomes_vizu for details on how to trace the (categorized) resource utilization.
328 const std::set<std::string, std::less<>>& get_tracing_categories()
330 return created_categories;
333 } // namespace simgrid::instr
335 static xbt_dynar_t instr_set_to_dynar(const std::set<std::string, std::less<>>& filter) // XBT_ATTRIB_DEPRECATED_v334
337 if (not TRACE_is_enabled() || not TRACE_needs_platform())
340 xbt_dynar_t ret = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
341 for (auto const& name : filter)
342 xbt_dynar_push_as(ret, char*, xbt_strdup(name.c_str()));
347 void TRACE_category(const char* category) // XBT_ATTRIB_DEPRECATED_v334
349 simgrid::instr::declare_tracing_category(category);
352 void TRACE_category_with_color(const char* category, const char* color) // XBT_ATTRIB_DEPRECATED_v334
354 simgrid::instr::declare_tracing_category(category, color);
357 xbt_dynar_t TRACE_get_categories() // XBT_ATTRIB_DEPRECATED_v334
359 if (not TRACE_is_enabled() || not TRACE_categorized())
361 return instr_set_to_dynar(created_categories);
364 void TRACE_declare_mark(const char* mark_type) // XBT_ATTRIB_DEPRECATED_v334
366 simgrid::instr::declare_mark(mark_type);
369 void TRACE_declare_mark_value_with_color(const char* mark_type, const char* mark_value,
370 const char* mark_color) // XBT_ATTRIB_DEPRECATED_v334
372 simgrid::instr::declare_mark_value(mark_type, mark_value, mark_color);
375 void TRACE_declare_mark_value(const char* mark_type, const char* mark_value) // XBT_ATTRIB_DEPRECATED_v334
377 simgrid::instr::declare_mark_value(mark_type, mark_value);
380 void TRACE_mark(const char* mark_type, const char* mark_value) // XBT_ATTRIB_DEPRECATED_v334
382 simgrid::instr::mark(mark_type, mark_value);
385 xbt_dynar_t TRACE_get_marks() // XBT_ATTRIB_DEPRECATED_v334
387 if (not TRACE_is_enabled())
390 return instr_set_to_dynar(declared_marks);
393 int TRACE_platform_graph_export_graphviz(const char* filename) // XBT_ATTRIB_DEPRECATED_v334
395 simgrid::instr::platform_graph_export_graphviz(filename);
399 void TRACE_vm_variable_declare(const char* variable) // XBT_ATTRIB_DEPRECATED_v334
401 instr_user_variable(0, "", variable, "VM", 0, InstrUserVariable::DECLARE, "", &user_vm_variables);
403 void TRACE_vm_variable_declare_with_color(const char* variable, const char* color) // XBT_ATTRIB_DEPRECATED_v334
405 instr_user_variable(0, "", variable, "VM", 0, InstrUserVariable::DECLARE, color, &user_vm_variables);
408 void TRACE_vm_variable_set(const char* vm, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
410 instr_user_variable(simgrid_get_clock(), vm, variable, "VM", value, InstrUserVariable::SET, "", &user_vm_variables);
413 void TRACE_vm_variable_add(const char* vm, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
415 instr_user_variable(simgrid_get_clock(), vm, variable, "VM", value, InstrUserVariable::ADD, "", &user_vm_variables);
417 void TRACE_vm_variable_sub(const char* vm, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
419 instr_user_variable(simgrid_get_clock(), vm, variable, "VM", value, InstrUserVariable::SUB, "", &user_vm_variables);
422 void TRACE_vm_variable_set_with_time(double time, const char* vm, const char* variable,
423 double value) // XBT_ATTRIB_DEPRECATED_v334
425 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::SET, "", &user_vm_variables);
428 void TRACE_vm_variable_add_with_time(double time, const char* vm, const char* variable,
429 double value) // XBT_ATTRIB_DEPRECATED_v334
431 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::ADD, "", &user_vm_variables);
433 void TRACE_vm_variable_sub_with_time(double time, const char* vm, const char* variable,
434 double value) // XBT_ATTRIB_DEPRECATED_v334
436 instr_user_variable(time, vm, variable, "VM", value, InstrUserVariable::SUB, "", &user_vm_variables);
439 void TRACE_host_variable_declare(const char* variable) // XBT_ATTRIB_DEPRECATED_v334
441 simgrid::instr::declare_host_variable(variable);
444 void TRACE_host_variable_declare_with_color(const char* variable, const char* color) // XBT_ATTRIB_DEPRECATED_v334
446 simgrid::instr::declare_host_variable(variable, color);
449 void TRACE_host_variable_set(const char* host, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
451 instr_user_variable(simgrid_get_clock(), host, variable, "HOST", value, InstrUserVariable::SET, "",
452 &user_host_variables);
455 void TRACE_host_variable_add(const char* host, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
457 instr_user_variable(simgrid_get_clock(), host, variable, "HOST", value, InstrUserVariable::ADD, "",
458 &user_host_variables);
461 void TRACE_host_variable_sub(const char* host, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
463 instr_user_variable(simgrid_get_clock(), host, variable, "HOST", value, InstrUserVariable::SUB, "",
464 &user_host_variables);
467 void TRACE_host_variable_set_with_time(double time, const char* host, const char* variable,
468 double value) // XBT_ATTRIB_DEPRECATED_v334
470 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::SET, "", &user_host_variables);
473 void TRACE_host_variable_add_with_time(double time, const char* host, const char* variable,
474 double value) // XBT_ATTRIB_DEPRECATED_v334
476 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::ADD, "", &user_host_variables);
479 void TRACE_host_variable_sub_with_time(double time, const char* host, const char* variable,
480 double value) // XBT_ATTRIB_DEPRECATED_v334
482 instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::SUB, "", &user_host_variables);
485 xbt_dynar_t TRACE_get_host_variables() // XBT_ATTRIB_DEPRECATED_v334
487 return instr_set_to_dynar(user_host_variables);
490 void TRACE_link_variable_declare(const char* variable) // XBT_ATTRIB_DEPRECATED_v334
492 simgrid::instr::declare_link_variable(variable);
495 void TRACE_link_variable_declare_with_color(const char* variable, const char* color) // XBT_ATTRIB_DEPRECATED_v334
497 simgrid::instr::declare_link_variable(variable, color);
500 void TRACE_link_variable_set(const char* link, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
502 instr_user_variable(simgrid_get_clock(), link, variable, "LINK", value, InstrUserVariable::SET, "",
503 &user_link_variables);
506 void TRACE_link_variable_add(const char* link, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
508 instr_user_variable(simgrid_get_clock(), link, variable, "LINK", value, InstrUserVariable::ADD, "",
509 &user_link_variables);
512 void TRACE_link_variable_sub(const char* link, const char* variable, double value) // XBT_ATTRIB_DEPRECATED_v334
514 instr_user_variable(simgrid_get_clock(), link, variable, "LINK", value, InstrUserVariable::SUB, "",
515 &user_link_variables);
518 void TRACE_link_variable_set_with_time(double time, const char* link, const char* variable,
519 double value) // XBT_ATTRIB_DEPRECATED_v334
521 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::SET, "", &user_link_variables);
524 void TRACE_link_variable_add_with_time(double time, const char* link, const char* variable,
525 double value) // XBT_ATTRIB_DEPRECATED_v334
527 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::ADD, "", &user_link_variables);
530 void TRACE_link_variable_sub_with_time(double time, const char* link, const char* variable,
531 double value) // XBT_ATTRIB_DEPRECATED_v334
533 instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::SUB, "", &user_link_variables);
536 void TRACE_link_srcdst_variable_set(const char* src, const char* dst, const char* variable,
537 double value) // XBT_ATTRIB_DEPRECATED_v334
539 instr_user_srcdst_variable(simgrid_get_clock(), src, dst, variable, value, InstrUserVariable::SET);
542 void TRACE_link_srcdst_variable_add(const char* src, const char* dst, const char* variable,
543 double value) // XBT_ATTRIB_DEPRECATED_v334
545 instr_user_srcdst_variable(simgrid_get_clock(), src, dst, variable, value, InstrUserVariable::ADD);
548 void TRACE_link_srcdst_variable_sub(const char* src, const char* dst, const char* variable,
549 double value) // XBT_ATTRIB_DEPRECATED_v334
551 instr_user_srcdst_variable(simgrid_get_clock(), src, dst, variable, value, InstrUserVariable::SUB);
554 void TRACE_link_srcdst_variable_set_with_time(double time, const char* src, const char* dst, const char* variable,
555 double value) // XBT_ATTRIB_DEPRECATED_v334
557 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::SET);
560 void TRACE_link_srcdst_variable_add_with_time(double time, const char* src, const char* dst, const char* variable,
561 double value) // XBT_ATTRIB_DEPRECATED_v334
563 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::ADD);
566 void TRACE_link_srcdst_variable_sub_with_time(double time, const char* src, const char* dst, const char* variable,
567 double value) // XBT_ATTRIB_DEPRECATED_v334
569 instr_user_srcdst_variable(time, src, dst, variable, value, InstrUserVariable::SUB);
572 xbt_dynar_t TRACE_get_link_variables() // XBT_ATTRIB_DEPRECATED_v334
574 return instr_set_to_dynar(user_link_variables);
577 /** @ingroup TRACE_user_variables
578 * @brief Declare a new user state associated to hosts.
580 * Declare a user state that will be associated to hosts.
581 * A user host state can be used to trace application states.
583 * @param state The name of the new state to be declared.
585 * @see TRACE_host_state_declare_value
587 void TRACE_host_state_declare (const char *state)
589 instr_new_user_state_type("HOST", state);
592 /** @ingroup TRACE_user_variables
593 * @brief Declare a new value for a user state associated to hosts.
595 * Declare a value for a state. The color needs to be a string with 3 numbers separated by spaces in the range [0,1].
596 * A light-gray color can be specified using "0.7 0.7 0.7" as color.
598 * @param state The name of the new state to be declared.
599 * @param value The name of the value
600 * @param color The color of the value
602 * @see TRACE_host_state_declare
604 void TRACE_host_state_declare_value (const char *state, const char *value, const char *color)
606 instr_new_value_for_user_state_type (state, value, color);
609 /** @ingroup TRACE_user_variables
610 * @brief Set the user state to the given value.
612 * Change a user state previously declared to the given value.
614 * @param host The name of the host to be considered.
615 * @param state_name The name of the state previously declared.
616 * @param value_name The new value of the state.
618 * @see TRACE_host_state_declare, TRACE_host_push_state, TRACE_host_pop_state
620 void TRACE_host_set_state(const char* host, const char* state_name, const char* value_name)
622 simgrid::instr::StateType* state = simgrid::instr::Container::by_name(host)->get_state(state_name);
623 state->add_entity_value(value_name);
624 state->set_event(value_name);
627 /** @ingroup TRACE_user_variables
628 * @brief Push a new value for a state of a given host.
630 * Change a user state previously declared by pushing the new value to the state.
632 * @param host The name of the host to be considered.
633 * @param state_name The name of the state previously declared.
634 * @param value_name The value to be pushed.
636 * @see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_pop_state
638 void TRACE_host_push_state(const char* host, const char* state_name, const char* value_name)
640 simgrid::instr::Container::by_name(host)->get_state(state_name)->push_event(value_name);
643 /** @ingroup TRACE_user_variables
644 * @brief Pop the last value of a state of a given host.
646 * Change a user state previously declared by removing the last value of the state.
648 * @param host The name of the host to be considered.
649 * @param state_name The name of the state to be popped.
651 * @see TRACE_host_state_declare, TRACE_host_set_state, TRACE_host_push_state
653 void TRACE_host_pop_state(const char* host, const char* state_name)
655 simgrid::instr::Container::by_name(host)->get_state(state_name)->pop_event();