Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
stringify tracing category
[simgrid.git] / src / instr / instr_resource_utilization.cpp
index ace1ff0..d9d96fc 100644 (file)
@@ -9,7 +9,7 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_resource, instr, "tracing (un)-categorized resource utilization");
 
-void TRACE_surf_resource_set_utilization(const char* type, const char* name, const char* resource, const char* category,
+void TRACE_surf_resource_set_utilization(const char* type, const char* name, const char* resource, std::string category,
                                          double value, double now, double delta)
 {
   // only trace resource utilization if resource is known by tracing mechanism
@@ -24,8 +24,8 @@ void TRACE_surf_resource_set_utilization(const char* type, const char* name, con
   }
 
   // trace categorized resource utilization
-  if (TRACE_categorized() && category) {
-    std::string category_type = name[0] + std::string(category);
+  if (TRACE_categorized() && !category.empty()) {
+    std::string category_type = name[0] + category;
     XBT_DEBUG("CAT %s [%f - %f] %s %s %f", type, now, now + delta, resource, category_type.c_str(), value);
     container->get_variable(name)->instr_event(now, delta, resource, value);
   }