-std::set<std::string> created_categories;
-std::set<std::string> declared_marks;
-std::set<std::string> user_host_variables;
-std::set<std::string> user_vm_variables;
-std::set<std::string> user_link_variables;
-extern std::set<std::string> trivaNodeTypes;
-extern std::set<std::string> trivaEdgeTypes;
-
-static xbt_dynar_t instr_set_to_dynar(std::set<std::string>* filter)
-{
- if (not TRACE_is_enabled() || not TRACE_needs_platform())
- return nullptr;
-
- xbt_dynar_t ret = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
- for (auto const& name : *filter)
- xbt_dynar_push_as(ret, char*, xbt_strdup(name.c_str()));
-
- return ret;
-}
-
-/** \ingroup TRACE_category
- * \brief Declare a new category with a random color.
- *
- * This function should be used to define a user category. The category can be used to differentiate the tasks that
- * are created during the simulation (for example, tasks from server1, server2, or request tasks, computation tasks,
- * communication tasks). All resource utilization (host power and link bandwidth) will be classified according to the
- * task category. Tasks that do not belong to a category are not traced. The color for the category that is being
- * declared is random. This function has no effect if a category with the same name has been already declared.
- *
- * See \ref outcomes_vizu for details on how to trace the (categorized) resource utilization.
- *
- * \param category The name of the new tracing category to be created.
- *
- * \see TRACE_category_with_color, MSG_task_set_category, SD_task_set_category
- */
-void TRACE_category(const char *category)
-{
- TRACE_category_with_color (category, nullptr);
-}
-
-/** \ingroup TRACE_category
- * \brief Declare a new category with a color.
- *
- * Same as #TRACE_category, but let user specify a color encoded as a RGB-like string with three floats from 0 to 1.
- * So, to specify a red color, pass "1 0 0" as color parameter. A light-gray color can be specified using "0.7 0.7 0.7"
- * as color. This function has no effect if a category with the same name has been already declared.
- *
- * See \ref outcomes_vizu for details on how to trace the (categorized) resource utilization.
- *
- * \param category The name of the new tracing category to be created.
- * \param color The color of the category (see \ref outcomes_vizu to
- * know how to correctly specify the color)
- *
- * \see MSG_task_set_category, SD_task_set_category
- */
-void TRACE_category_with_color (const char *category, const char *color)
-{
- /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with categories */
- if (not TRACE_is_enabled() || not TRACE_needs_platform())
- return;
-
- if (not(TRACE_categorized() && category != nullptr))
- return;
-
- //check if category is already created
- if (created_categories.find(category) != created_categories.end())
- return;
- else
- created_categories.insert(category);
-
- //define final_color
- std::string final_color;
- if (not color) {
- //generate a random color
- double red = drand48();
- double green = drand48();
- double blue = drand48();
- final_color = std::to_string(red) + " " + std::to_string(green) + " " + std::to_string(blue);
- }else{
- final_color = std::string(color);
- }
-
- XBT_DEBUG("CAT,declare %s, \"%s\" \"%s\"", category, color, final_color.c_str());
-
- //define the type of this category on top of hosts and links
- instr_new_variable_type (category, final_color);
-}
-
-/** \ingroup TRACE_category
- * \brief Get declared categories
- *
- * This function should be used to get categories that were already declared with #TRACE_category or with
- * #TRACE_category_with_color.
- *
- * See \ref outcomes_vizu for details on how to trace the (categorized) resource utilization.
- *
- * \return A dynar with the declared categories, must be freed with xbt_dynar_free.
- *
- * \see MSG_task_set_category, SD_task_set_category
- */
-xbt_dynar_t TRACE_get_categories ()
-{
- if (not TRACE_is_enabled() || not TRACE_categorized())
- return nullptr;
- return instr_set_to_dynar(&created_categories);
-}
-
-/** \ingroup TRACE_mark
- * \brief Declare a new type for tracing mark.
- *
- * This function declares a new Paje event type in the trace file that can be used by simulators to declare
- * application-level marks. This function is independent of which API is used in SimGrid.
- *
- * \param mark_type The name of the new type.
- *
- * \see TRACE_mark
- */
-void TRACE_declare_mark(const char *mark_type)
-{
- /* safe switchs. tracing has to be activated and if platform is not traced, we can't deal with marks */
- if (not TRACE_is_enabled() || not TRACE_needs_platform())
- return;
-
- if (not mark_type)
- THROWF (tracing_error, 1, "mark_type is nullptr");
-
- //check if mark_type is already declared
- if (declared_marks.find(mark_type) != declared_marks.end()) {
- THROWF (tracing_error, 1, "mark_type with name (%s) is already declared", mark_type);
- }
-
- XBT_DEBUG("MARK,declare %s", mark_type);
- simgrid::instr::Type::getRootType()->getOrCreateEventType(mark_type);
- declared_marks.insert(mark_type);
-}