extern FILE *tracing_file;
double prefix=0.0;
-xbt_dict_t tracing_files = NULL;
+xbt_dict_t tracing_files = nullptr;
extern s_instr_trace_writer_t active_writer;
{
char *filename = TRACE_get_filename();
tracing_file = fopen(filename, "w");
- if (tracing_file == NULL) {
+ if (tracing_file == nullptr) {
THROWF(system_error, 1, "Tracefile %s could not be opened for writing.", filename);
}
void print_TICreateContainer(paje_event_t event)
{
//if we are in the mode with only one file
- static FILE *temp = NULL;
+ static FILE *temp = nullptr;
- if (tracing_files == NULL) {
- tracing_files = xbt_dict_new_homogeneous(NULL);
+ if (tracing_files == nullptr) {
+ tracing_files = xbt_dict_new_homogeneous(nullptr);
//generate unique run id with time
prefix = xbt_os_time();
}
- if (!xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || temp == NULL) {
+ if (!xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || temp == nullptr) {
char *folder_name = bprintf("%s_files", TRACE_get_filename());
char *filename = bprintf("%s/%f_%s.txt", folder_name, prefix, ((createContainer_t) event->data)->container->name);
#ifdef WIN32
xbt_free(filename);
}
- xbt_dict_set(tracing_files, ((createContainer_t) event->data)->container->name, (void *) temp, NULL);
+ xbt_dict_set(tracing_files, ((createContainer_t) event->data)->container->name, (void *) temp, nullptr);
}
void print_TIDestroyContainer(paje_event_t event)
{
int i;
- //char* function=NULL;
- if (((pushState_t) event->data)->extra == NULL)
+ //char* function=nullptr;
+ if (((pushState_t) event->data)->extra == nullptr)
return;
instr_extra_data extra = (instr_extra_data) (((pushState_t) event->data)->extra);
- char *process_id = NULL;
+ char *process_id = nullptr;
//FIXME: dirty extract "rank-" from the name, as we want the bare process id here
- if (strstr(((pushState_t) event->data)->container->name, "rank-") == NULL)
+ if (strstr(((pushState_t) event->data)->container->name, "rank-") == nullptr)
process_id = xbt_strdup(((pushState_t) event->data)->container->name);
else
process_id = xbt_strdup(((pushState_t) event->data)->container->name + 5);
break;
}
- if (extra->recvcounts != NULL)
+ if (extra->recvcounts != nullptr)
xbt_free(extra->recvcounts);
- if (extra->sendcounts != NULL)
+ if (extra->sendcounts != nullptr)
xbt_free(extra->sendcounts);
xbt_free(process_id);
xbt_free(extra);
trace_precision = xbt_cfg_get_int(OPT_TRACING_PRECISION);
}
-static xbt_dynar_t TRACE_start_functions = NULL;
+static xbt_dynar_t TRACE_start_functions = nullptr;
void TRACE_add_start_function(void (*func) ())
{
- if (TRACE_start_functions == NULL)
- TRACE_start_functions = xbt_dynar_new(sizeof(void (*)()), NULL);
+ if (TRACE_start_functions == nullptr)
+ TRACE_start_functions = xbt_dynar_new(sizeof(void (*)()), nullptr);
xbt_dynar_push(TRACE_start_functions, &func);
}
user_vm_variables = xbt_dict_new_homogeneous(xbt_free_f);
user_link_variables = xbt_dict_new_homogeneous(xbt_free_f);
- if (TRACE_start_functions != NULL) {
+ if (TRACE_start_functions != nullptr) {
void (*func) ();
unsigned int iter;
xbt_dynar_foreach(TRACE_start_functions, iter, func) {
return 0;
}
-static xbt_dynar_t TRACE_end_functions = NULL;
+static xbt_dynar_t TRACE_end_functions = nullptr;
void TRACE_add_end_function(void (*func) (void))
{
- if (TRACE_end_functions == NULL)
- TRACE_end_functions = xbt_dynar_new(sizeof(void (*)(void)), NULL);
+ if (TRACE_end_functions == nullptr)
+ TRACE_end_functions = xbt_dynar_new(sizeof(void (*)(void)), nullptr);
xbt_dynar_push(TRACE_end_functions, &func);
}
PJ_container_release();
PJ_type_release();
- if (TRACE_end_functions != NULL) {
+ if (TRACE_end_functions != nullptr) {
void (*func) (void);
unsigned int iter;
xbt_dynar_foreach(TRACE_end_functions, iter, func) {
is_initialised = 1;
/* name of the tracefile */
- xbt_cfg_register_string (OPT_TRACING_FILENAME, "simgrid.trace", NULL, "Trace file created by the instrumented SimGrid.");
- xbt_cfg_register_boolean(OPT_TRACING, "no", NULL, "Enable Tracing.");
- xbt_cfg_register_boolean(OPT_TRACING_PLATFORM, "no", NULL, "Register the platform in the trace as a hierarchy.");
- xbt_cfg_register_boolean(OPT_TRACING_TOPOLOGY, "yes", NULL, "Register the platform topology in the trace as a graph.");
- xbt_cfg_register_boolean(OPT_TRACING_SMPI, "no", NULL, "Tracing of the SMPI interface.");
- xbt_cfg_register_boolean(OPT_TRACING_SMPI_GROUP,"no", NULL, "Group MPI processes by host.");
- xbt_cfg_register_boolean(OPT_TRACING_SMPI_COMPUTING, "no", NULL, "Generate states for timing out of SMPI parts of the application");
- xbt_cfg_register_boolean(OPT_TRACING_SMPI_SLEEPING, "no", NULL, "Generate states for timing out of SMPI parts of the application");
- xbt_cfg_register_boolean(OPT_TRACING_SMPI_INTERNALS, "no", NULL, "View internal messages sent by Collective communications in SMPI");
- xbt_cfg_register_boolean(OPT_TRACING_CATEGORIZED, "no", NULL, "Tracing categorized resource utilization of hosts and links.");
- xbt_cfg_register_boolean(OPT_TRACING_UNCATEGORIZED, "no", NULL, "Tracing uncategorized resource utilization of hosts and links.");
-
- xbt_cfg_register_boolean(OPT_TRACING_MSG_PROCESS, "no", NULL, "Tracing of MSG process behavior.");
- xbt_cfg_register_boolean(OPT_TRACING_MSG_VM, "no", NULL, "Tracing of MSG process behavior.");
- xbt_cfg_register_boolean(OPT_TRACING_DISABLE_LINK, "no", NULL, "Do not trace link bandwidth and latency.");
- xbt_cfg_register_boolean(OPT_TRACING_DISABLE_POWER, "no", NULL, "Do not trace host power.");
- xbt_cfg_register_boolean(OPT_TRACING_BUFFER, "yes", NULL, "Buffer trace events to put them in temporal order.");
-
- xbt_cfg_register_boolean(OPT_TRACING_ONELINK_ONLY, "no", NULL, "Use only routes with one link to trace platform.");
- xbt_cfg_register_boolean(OPT_TRACING_DISABLE_DESTROY, "no", NULL, "Disable platform containers destruction.");
- xbt_cfg_register_boolean(OPT_TRACING_BASIC, "no", NULL, "Avoid extended events (impoverished trace file).");
- xbt_cfg_register_boolean(OPT_TRACING_DISPLAY_SIZES, "no", NULL, "(smpi only) Extended events with message size information");
- xbt_cfg_register_string(OPT_TRACING_FORMAT, "Paje", NULL, "(smpi only) Switch the output format of Tracing");
- xbt_cfg_register_boolean(OPT_TRACING_FORMAT_TI_ONEFILE, "no", NULL, "(smpi only) For replay format only : output to one file only");
- xbt_cfg_register_string(OPT_TRACING_COMMENT, "", NULL, "Comment to be added on the top of the trace file.");
- xbt_cfg_register_string(OPT_TRACING_COMMENT_FILE, "", NULL,
+ xbt_cfg_register_string (OPT_TRACING_FILENAME, "simgrid.trace", nullptr, "Trace file created by the instrumented SimGrid.");
+ xbt_cfg_register_boolean(OPT_TRACING, "no", nullptr, "Enable Tracing.");
+ xbt_cfg_register_boolean(OPT_TRACING_PLATFORM, "no", nullptr, "Register the platform in the trace as a hierarchy.");
+ xbt_cfg_register_boolean(OPT_TRACING_TOPOLOGY, "yes", nullptr, "Register the platform topology in the trace as a graph.");
+ xbt_cfg_register_boolean(OPT_TRACING_SMPI, "no", nullptr, "Tracing of the SMPI interface.");
+ xbt_cfg_register_boolean(OPT_TRACING_SMPI_GROUP,"no", nullptr, "Group MPI processes by host.");
+ xbt_cfg_register_boolean(OPT_TRACING_SMPI_COMPUTING, "no", nullptr, "Generate states for timing out of SMPI parts of the application");
+ xbt_cfg_register_boolean(OPT_TRACING_SMPI_SLEEPING, "no", nullptr, "Generate states for timing out of SMPI parts of the application");
+ xbt_cfg_register_boolean(OPT_TRACING_SMPI_INTERNALS, "no", nullptr, "View internal messages sent by Collective communications in SMPI");
+ xbt_cfg_register_boolean(OPT_TRACING_CATEGORIZED, "no", nullptr, "Tracing categorized resource utilization of hosts and links.");
+ xbt_cfg_register_boolean(OPT_TRACING_UNCATEGORIZED, "no", nullptr, "Tracing uncategorized resource utilization of hosts and links.");
+
+ xbt_cfg_register_boolean(OPT_TRACING_MSG_PROCESS, "no", nullptr, "Tracing of MSG process behavior.");
+ xbt_cfg_register_boolean(OPT_TRACING_MSG_VM, "no", nullptr, "Tracing of MSG process behavior.");
+ xbt_cfg_register_boolean(OPT_TRACING_DISABLE_LINK, "no", nullptr, "Do not trace link bandwidth and latency.");
+ xbt_cfg_register_boolean(OPT_TRACING_DISABLE_POWER, "no", nullptr, "Do not trace host power.");
+ xbt_cfg_register_boolean(OPT_TRACING_BUFFER, "yes", nullptr, "Buffer trace events to put them in temporal order.");
+
+ xbt_cfg_register_boolean(OPT_TRACING_ONELINK_ONLY, "no", nullptr, "Use only routes with one link to trace platform.");
+ xbt_cfg_register_boolean(OPT_TRACING_DISABLE_DESTROY, "no", nullptr, "Disable platform containers destruction.");
+ xbt_cfg_register_boolean(OPT_TRACING_BASIC, "no", nullptr, "Avoid extended events (impoverished trace file).");
+ xbt_cfg_register_boolean(OPT_TRACING_DISPLAY_SIZES, "no", nullptr, "(smpi only) Extended events with message size information");
+ xbt_cfg_register_string(OPT_TRACING_FORMAT, "Paje", nullptr, "(smpi only) Switch the output format of Tracing");
+ xbt_cfg_register_boolean(OPT_TRACING_FORMAT_TI_ONEFILE, "no", nullptr, "(smpi only) For replay format only : output to one file only");
+ xbt_cfg_register_string(OPT_TRACING_COMMENT, "", nullptr, "Comment to be added on the top of the trace file.");
+ xbt_cfg_register_string(OPT_TRACING_COMMENT_FILE, "", nullptr,
"The contents of the file are added to the top of the trace file as comment.");
- xbt_cfg_register_int(OPT_TRACING_PRECISION, 6, NULL, "Numerical precision used when timestamping events "
+ xbt_cfg_register_int(OPT_TRACING_PRECISION, 6, nullptr, "Numerical precision used when timestamping events "
"(expressed in number of digits after decimal point)");
/* Viva graph configuration for uncategorized tracing */
- xbt_cfg_register_string(OPT_VIVA_UNCAT_CONF, "", NULL, "Viva Graph configuration file for uncategorized resource utilization traces.");
- xbt_cfg_register_string(OPT_VIVA_CAT_CONF, "", NULL, "Viva Graph configuration file for categorized resource utilization traces.");
+ xbt_cfg_register_string(OPT_VIVA_UNCAT_CONF, "", nullptr, "Viva Graph configuration file for uncategorized resource utilization traces.");
+ xbt_cfg_register_string(OPT_VIVA_CAT_CONF, "", nullptr, "Viva Graph configuration file for categorized resource utilization traces.");
xbt_cfg_register_alias(OPT_TRACING_COMMENT_FILE,"tracing/comment_file");
xbt_cfg_register_alias(OPT_TRACING_DISABLE_DESTROY, "tracing/disable_destroy");
{
if (output && strlen(output) > 0){
FILE *file = fopen (output, "w");
- if (file == NULL){
+ if (file == nullptr){
THROWF (system_error, 1, "Unable to open file (%s) for writing %s graph "
"configuration (uncategorized).", output, name);
}
}
FILE *file = fopen (output, "w");
- if (file == NULL){
+ if (file == nullptr){
THROWF (system_error, 1, "Unable to open file (%s) for writing %s graph "
"configuration (categorized).", output, name);
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API");
-xbt_dict_t created_categories = NULL;
-xbt_dict_t declared_marks = NULL;
-xbt_dict_t user_host_variables = NULL;
-xbt_dict_t user_vm_variables = NULL;
-xbt_dict_t user_link_variables = NULL;
+xbt_dict_t created_categories = nullptr;
+xbt_dict_t declared_marks = nullptr;
+xbt_dict_t user_host_variables = nullptr;
+xbt_dict_t user_vm_variables = nullptr;
+xbt_dict_t user_link_variables = nullptr;
extern xbt_dict_t trivaNodeTypes;
extern xbt_dict_t trivaEdgeTypes;
static xbt_dynar_t instr_dict_to_dynar (xbt_dict_t filter)
{
- if (!TRACE_is_enabled()) return NULL;
- if (!TRACE_needs_platform()) return NULL;
+ if (!TRACE_is_enabled()) return nullptr;
+ if (!TRACE_needs_platform()) return nullptr;
xbt_dynar_t ret = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
char *name, *value;
xbt_dict_foreach(filter, cursor, name, value) {
xbt_dynar_push_as (ret, char*, xbt_strdup(name));
*/
void TRACE_category(const char *category)
{
- TRACE_category_with_color (category, NULL);
+ TRACE_category_with_color (category, nullptr);
}
/** \ingroup TRACE_category
/* safe switch */
if (!TRACE_is_enabled()) return;
- if (!(TRACE_categorized() && category != NULL)) return;
+ if (!(TRACE_categorized() && category != nullptr)) return;
/* if platform is not traced, we can't deal with categories */
if (!TRACE_needs_platform()) return;
//check if category is already created
char *created = (char*)xbt_dict_get_or_null(created_categories, category);
if (created) return;
- xbt_dict_set (created_categories, category, xbt_strdup("1"), NULL);
+ xbt_dict_set (created_categories, category, xbt_strdup("1"), nullptr);
//define final_color
char final_color[INSTR_DEFAULT_STR_SIZE];
*/
xbt_dynar_t TRACE_get_categories (void)
{
- if (!TRACE_is_enabled()) return NULL;
- if (!TRACE_categorized()) return NULL;
+ if (!TRACE_is_enabled()) return nullptr;
+ if (!TRACE_categorized()) return nullptr;
return instr_dict_to_dynar (created_categories);
}
/* if platform is not traced, we don't allow marks */
if (!TRACE_needs_platform()) return;
- if (!mark_type) THROWF (tracing_error, 1, "mark_type is NULL");
+ if (!mark_type) THROWF (tracing_error, 1, "mark_type is nullptr");
//check if mark_type is already declared
char *created = (char*)xbt_dict_get_or_null(declared_marks, mark_type);
XBT_DEBUG("MARK,declare %s", mark_type);
PJ_type_event_new(mark_type, PJ_type_get_root());
- xbt_dict_set (declared_marks, mark_type, xbt_strdup("1"), NULL);
+ xbt_dict_set (declared_marks, mark_type, xbt_strdup("1"), nullptr);
}
/** \ingroup TRACE_mark
* This function declares a new colored value for a 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. The color needs to be
* a string with three numbers separated by spaces in the range [0,1].
- * A light-gray color can be specified using "0.7 0.7 0.7" as color. If a NULL color is provided, the color used will
+ * A light-gray color can be specified using "0.7 0.7 0.7" as color. If a nullptr color is provided, the color used will
* be white ("1 1 1").
*
* \param mark_type The name of the new type.
/* if platform is not traced, we don't allow marks */
if (!TRACE_needs_platform()) return;
- if (!mark_type) THROWF (tracing_error, 1, "mark_type is NULL");
- if (!mark_value) THROWF (tracing_error, 1, "mark_value is NULL");
+ if (!mark_type) THROWF (tracing_error, 1, "mark_type is nullptr");
+ if (!mark_value) THROWF (tracing_error, 1, "mark_value is nullptr");
type_t type = PJ_type_get (mark_type, PJ_type_get_root());
if (!type){
*
* This function declares a new value for a 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. Calling this function is the
- * same as calling \ref TRACE_declare_mark_value_with_color with a NULL color.
+ * same as calling \ref TRACE_declare_mark_value_with_color with a nullptr color.
*
* \param mark_type The name of the new type.
* \param mark_value The name of the new value for this type.
*/
void TRACE_declare_mark_value (const char *mark_type, const char *mark_value)
{
- TRACE_declare_mark_value_with_color (mark_type, mark_value, NULL);
+ TRACE_declare_mark_value_with_color (mark_type, mark_value, nullptr);
}
/**
/* if platform is not traced, we don't allow marks */
if (!TRACE_needs_platform()) return;
- if (!mark_type) THROWF (tracing_error, 1, "mark_type is NULL");
- if (!mark_value) THROWF (tracing_error, 1, "mark_value is NULL");
+ if (!mark_type) THROWF (tracing_error, 1, "mark_type is nullptr");
+ if (!mark_value) THROWF (tracing_error, 1, "mark_value is nullptr");
//check if mark_type is already declared
type_t type = PJ_type_get (mark_type, PJ_type_get_root());
*/
xbt_dynar_t TRACE_get_marks (void)
{
- if (!TRACE_is_enabled()) return NULL;
+ if (!TRACE_is_enabled()) return nullptr;
return instr_dict_to_dynar (declared_marks);
}
if (created){//already declared
return;
}else{
- xbt_dict_set (filter, variable, xbt_strdup("1"), NULL);
+ xbt_dict_set (filter, variable, xbt_strdup("1"), nullptr);
}
}else{
if (!created){//not declared, ignore
if(!dst_elm) xbt_die("Element '%s' not found!",dst);
std::vector<Link*> *route = new std::vector<Link*>();
- routing_platf->getRouteAndLatency (src_elm, dst_elm, route,NULL);
+ routing_platf->getRouteAndLatency (src_elm, dst_elm, route,nullptr);
for (auto link : *route)
- instr_user_variable (time, link->getName(), variable, father_type, value, what, NULL, user_link_variables);
+ instr_user_variable (time, link->getName(), variable, father_type, value, what, nullptr, user_link_variables);
delete route;
}
/* returns 1 if successful, 0 otherwise */
if (!TRACE_is_enabled()) return 0;
xbt_graph_t g = instr_routing_platform_graph();
- if (g == NULL) return 0;
+ if (g == nullptr) return 0;
instr_routing_platform_graph_export_graphviz (g, filename);
- xbt_graph_free_graph(g, xbt_free_f, xbt_free_f, NULL);
+ xbt_graph_free_graph(g, xbt_free_f, xbt_free_f, nullptr);
return 1;
}
*/
void TRACE_vm_variable_declare (const char *variable)
{
- instr_user_variable(0, NULL, variable, "MSG_VM", 0, INSTR_US_DECLARE, NULL, user_vm_variables);
+ instr_user_variable(0, nullptr, variable, "MSG_VM", 0, INSTR_US_DECLARE, nullptr, user_vm_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_vm_variable_declare_with_color (const char *variable, const char *color)
{
- instr_user_variable(0, NULL, variable, "MSG_VM", 0, INSTR_US_DECLARE, color, user_vm_variables);
+ instr_user_variable(0, nullptr, variable, "MSG_VM", 0, INSTR_US_DECLARE, color, user_vm_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_vm_variable_set_with_time (double time, const char *vm, const char *variable, double value)
{
- instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SET, NULL, user_vm_variables);
+ instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SET, nullptr, user_vm_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_vm_variable_add_with_time (double time, const char *vm, const char *variable, double value)
{
- instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_ADD, NULL, user_vm_variables);
+ instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_ADD, nullptr, user_vm_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_vm_variable_sub_with_time (double time, const char *vm, const char *variable, double value)
{
- instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SUB, NULL, user_vm_variables);
+ instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SUB, nullptr, user_vm_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_host_variable_declare (const char *variable)
{
- instr_user_variable(0, NULL, variable, "HOST", 0, INSTR_US_DECLARE, NULL, user_host_variables);
+ instr_user_variable(0, nullptr, variable, "HOST", 0, INSTR_US_DECLARE, nullptr, user_host_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_host_variable_declare_with_color (const char *variable, const char *color)
{
- instr_user_variable(0, NULL, variable, "HOST", 0, INSTR_US_DECLARE, color, user_host_variables);
+ instr_user_variable(0, nullptr, variable, "HOST", 0, INSTR_US_DECLARE, color, user_host_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_host_variable_set_with_time (double time, const char *host, const char *variable, double value)
{
- instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SET, NULL, user_host_variables);
+ instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SET, nullptr, user_host_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_host_variable_add_with_time (double time, const char *host, const char *variable, double value)
{
- instr_user_variable(time, host, variable, "HOST", value, INSTR_US_ADD, NULL, user_host_variables);
+ instr_user_variable(time, host, variable, "HOST", value, INSTR_US_ADD, nullptr, user_host_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_host_variable_sub_with_time (double time, const char *host, const char *variable, double value)
{
- instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SUB, NULL, user_host_variables);
+ instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SUB, nullptr, user_host_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_link_variable_declare (const char *variable)
{
- instr_user_variable (0, NULL, variable, "LINK", 0, INSTR_US_DECLARE, NULL, user_link_variables);
+ instr_user_variable (0, nullptr, variable, "LINK", 0, INSTR_US_DECLARE, nullptr, user_link_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_link_variable_declare_with_color (const char *variable, const char *color)
{
- instr_user_variable (0, NULL, variable, "LINK", 0, INSTR_US_DECLARE, color, user_link_variables);
+ instr_user_variable (0, nullptr, variable, "LINK", 0, INSTR_US_DECLARE, color, user_link_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_link_variable_set_with_time (double time, const char *link, const char *variable, double value)
{
- instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SET, NULL, user_link_variables);
+ instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SET, nullptr, user_link_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_link_variable_add_with_time (double time, const char *link, const char *variable, double value)
{
- instr_user_variable (time, link, variable, "LINK", value, INSTR_US_ADD, NULL, user_link_variables);
+ instr_user_variable (time, link, variable, "LINK", value, INSTR_US_ADD, nullptr, user_link_variables);
}
/** \ingroup TRACE_user_variables
*/
void TRACE_link_variable_sub_with_time (double time, const char *link, const char *variable, double value)
{
- instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SUB, NULL, user_link_variables);
+ instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SUB, nullptr, user_link_variables);
}
/* for link variables, but with src and dst used for get_route */
{
container_t container = PJ_container_get(host);
type_t type = PJ_type_get (state, container->type);
- val_t val = PJ_value_get_or_new (value, NULL, type); /* if user didn't declare a value with a color, use NULL color */
+ val_t val = PJ_value_get_or_new (value, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
new_pajeSetState(MSG_get_clock(), container, type, val);
}
{
container_t container = PJ_container_get(host);
type_t type = PJ_type_get (state, container->type);
- val_t val = PJ_value_get_or_new (value, NULL, type); /* if user didn't declare a value with a color, use NULL color */
+ val_t val = PJ_value_get_or_new (value, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
new_pajePushState(MSG_get_clock(), container, type, val);
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_containers, instr, "Paje tracing event system (containers)");
-static container_t rootContainer = NULL; /* the root container */
-static xbt_dict_t allContainers = NULL; /* all created containers indexed by name */
-xbt_dict_t trivaNodeTypes = NULL; /* all host types defined */
-xbt_dict_t trivaEdgeTypes = NULL; /* all link types defined */
+static container_t rootContainer = nullptr; /* the root container */
+static xbt_dict_t allContainers = nullptr; /* all created containers indexed by name */
+xbt_dict_t trivaNodeTypes = nullptr; /* all host types defined */
+xbt_dict_t trivaEdgeTypes = nullptr; /* all link types defined */
long long int instr_new_paje_id (void)
{
void PJ_container_alloc (void)
{
- allContainers = xbt_dict_new_homogeneous(NULL);
+ allContainers = xbt_dict_new_homogeneous(nullptr);
trivaNodeTypes = xbt_dict_new_homogeneous(xbt_free_f);
trivaEdgeTypes = xbt_dict_new_homogeneous(xbt_free_f);
}
container_t PJ_container_new (const char *name, e_container_types kind, container_t father)
{
- if (name == NULL){
- THROWF (tracing_error, 0, "can't create a container with a NULL name");
+ if (name == nullptr){
+ THROWF (tracing_error, 0, "can't create a container with a nullptr name");
}
static long long int container_id = 0;
if(!newContainer->netcard) xbt_die("Element '%s' not found",name);
break;
default:
- newContainer->netcard = NULL;
+ newContainer->netcard = nullptr;
break;
}
snprintf (as_typename, INSTR_DEFAULT_STR_SIZE, "L%d", newContainer->level);
if (newContainer->father){
newContainer->type = PJ_type_get_or_null (as_typename, newContainer->father->type);
- if (newContainer->type == NULL){
+ if (newContainer->type == nullptr){
newContainer->type = PJ_type_container_new (as_typename, newContainer->father->type);
}
}else{
- newContainer->type = PJ_type_container_new ("0", NULL);
+ newContainer->type = PJ_type_container_new ("0", nullptr);
}
}else{
//otherwise, the name is its kind
default: THROWF (tracing_error, 0, "new container kind is unknown."); break;
}
type_t type = PJ_type_get_or_null (typeNameBuff, newContainer->father->type);
- if (type == NULL){
+ if (type == nullptr){
newContainer->type = PJ_type_container_new (typeNameBuff, newContainer->father->type);
}else{
newContainer->type = type;
}
}
- newContainer->children = xbt_dict_new_homogeneous(NULL);
+ newContainer->children = xbt_dict_new_homogeneous(nullptr);
if (newContainer->father){
- xbt_dict_set(newContainer->father->children, newContainer->name, newContainer, NULL);
+ xbt_dict_set(newContainer->father->children, newContainer->name, newContainer, nullptr);
new_pajeCreateContainer (newContainer);
}
//register all kinds by name
- if (xbt_dict_get_or_null(allContainers, newContainer->name) != NULL){
+ if (xbt_dict_get_or_null(allContainers, newContainer->name) != nullptr){
THROWF(tracing_error, 1, "container %s already present in allContainers data structure", newContainer->name);
}
- xbt_dict_set (allContainers, newContainer->name, newContainer, NULL);
+ xbt_dict_set (allContainers, newContainer->name, newContainer, nullptr);
XBT_DEBUG("Add container name '%s'",newContainer->name);
//register NODE types for triva configuration
if (newContainer->kind == INSTR_HOST || newContainer->kind == INSTR_LINK || newContainer->kind == INSTR_ROUTER) {
- xbt_dict_set (trivaNodeTypes, newContainer->type->name, xbt_strdup("1"), NULL);
+ xbt_dict_set (trivaNodeTypes, newContainer->type->name, xbt_strdup("1"), nullptr);
}
return newContainer;
}
container_t PJ_container_get (const char *name)
{
container_t ret = PJ_container_get_or_null (name);
- if (ret == NULL){
+ if (ret == nullptr){
THROWF(tracing_error, 1, "container with name %s not found", name);
}
return ret;
container_t PJ_container_get_or_null (const char *name)
{
- return (container_t)(name ? xbt_dict_get_or_null(allContainers, name) : NULL);
+ return (container_t)(name ? xbt_dict_get_or_null(allContainers, name) : nullptr);
}
container_t PJ_container_get_root ()
void PJ_container_remove_from_parent (container_t child)
{
- if (child == NULL){
- THROWF (tracing_error, 0, "can't remove from parent with a NULL child");
+ if (child == nullptr){
+ THROWF (tracing_error, 0, "can't remove from parent with a nullptr child");
}
container_t parent = child->father;
void PJ_container_free (container_t container)
{
- if (container == NULL){
- THROWF (tracing_error, 0, "trying to free a NULL container");
+ if (container == nullptr){
+ THROWF (tracing_error, 0, "trying to free a nullptr container");
}
XBT_DEBUG("destroy container %s", container->name);
xbt_free (container->id);
xbt_dict_free (&container->children);
xbt_free (container);
- container = NULL;
+ container = nullptr;
}
static void recursiveDestroyContainer (container_t container)
{
- if (container == NULL){
- THROWF (tracing_error, 0, "trying to recursively destroy a NULL container");
+ if (container == nullptr){
+ THROWF (tracing_error, 0, "trying to recursively destroy a nullptr container");
}
XBT_DEBUG("recursiveDestroyContainer %s", container->name);
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
container_t child;
char *child_name;
xbt_dict_foreach(container->children, cursor, child_name, child) {
void PJ_container_free_all ()
{
container_t root = PJ_container_get_root();
- if (root == NULL){
- THROWF (tracing_error, 0, "trying to free all containers, but root is NULL");
+ if (root == nullptr){
+ THROWF (tracing_error, 0, "trying to free all containers, but root is nullptr");
}
recursiveDestroyContainer (root);
- rootContainer = NULL;
+ rootContainer = nullptr;
//checks
if (!xbt_dict_is_empty(allContainers)){
void TRACE_paje_start(void) {
char *filename = TRACE_get_filename();
tracing_file = fopen(filename, "w");
- if (tracing_file == NULL){
+ if (tracing_file == nullptr){
THROWF (system_error, 1, "Tracefile %s could not be opened for writing.", filename);
}
if (TRACE_display_sizes()) {
stream << " ";
- if (static_cast<pushState_t>(event->data)->extra != NULL) {
+ if (static_cast<pushState_t>(event->data)->extra != nullptr) {
stream << static_cast<instr_extra_data>(static_cast<pushState_t>(event->data)->extra)->send_size;
}
else {
print_row();
- if (static_cast<pushState_t>(event->data)->extra != NULL) {
- if (static_cast<instr_extra_data>(static_cast<pushState_t>(event->data)->extra)->sendcounts != NULL)
+ if (static_cast<pushState_t>(event->data)->extra != nullptr) {
+ if (static_cast<instr_extra_data>(static_cast<pushState_t>(event->data)->extra)->sendcounts != nullptr)
xbt_free(static_cast<instr_extra_data>(static_cast<pushState_t>(event->data)->extra)->sendcounts);
- if (static_cast<instr_extra_data>(static_cast<pushState_t>(event->data)->extra)->recvcounts != NULL)
+ if (static_cast<instr_extra_data>(static_cast<pushState_t>(event->data)->extra)->recvcounts != nullptr)
xbt_free(static_cast<instr_extra_data>(static_cast<pushState_t>(event->data)->extra)->recvcounts);
xbt_free(static_cast<pushState_t>(event->data)->extra);
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_types, instr, "Paje tracing event system (types)");
-static type_t rootType = NULL; /* the root type */
+static type_t rootType = nullptr; /* the root type */
void PJ_type_alloc ()
{
void PJ_type_release ()
{
- rootType = NULL;
+ rootType = nullptr;
}
type_t PJ_type_get_root ()
static type_t newType (const char *typeNameBuff, const char *key, const char *color, e_entity_types kind, type_t father)
{
- if (typeNameBuff == NULL || key == NULL){
- THROWF(tracing_error, 0, "can't create a new type with name or key equal NULL");
+ if (typeNameBuff == nullptr || key == nullptr){
+ THROWF(tracing_error, 0, "can't create a new type with name or key equal nullptr");
}
type_t ret = xbt_new0(s_type_t, 1);
ret->name = xbt_strdup (typeNameBuff);
ret->father = father;
ret->kind = kind;
- ret->children = xbt_dict_new_homogeneous(NULL);
- ret->values = xbt_dict_new_homogeneous(NULL);
+ ret->children = xbt_dict_new_homogeneous(nullptr);
+ ret->values = xbt_dict_new_homogeneous(nullptr);
ret->color = xbt_strdup (color);
char str_id[INSTR_DEFAULT_STR_SIZE];
snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", instr_new_paje_id());
ret->id = xbt_strdup (str_id);
- if (father != NULL){
- xbt_dict_set (father->children, key, ret, NULL);
+ if (father != nullptr){
+ xbt_dict_set (father->children, key, ret, nullptr);
XBT_DEBUG("new type %s, child of %s", typeNameBuff, father->name);
}
return ret;
{
val_t value;
char *value_name;
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
xbt_dict_foreach(type->values, cursor, value_name, value) {
PJ_value_free (value);
}
xbt_free (type->color);
xbt_dict_free (&type->children);
xbt_free (type);
- type = NULL;
+ type = nullptr;
}
static void recursiveDestroyType (type_t type)
{
XBT_DEBUG("recursiveDestroyType %s", type->name);
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
type_t child;
char *child_name;
xbt_dict_foreach(type->children, cursor, child_name, child) {
void PJ_type_free_all (void)
{
recursiveDestroyType (PJ_type_get_root());
- rootType = NULL;
+ rootType = nullptr;
}
type_t PJ_type_get (const char *name, type_t father)
{
type_t ret = PJ_type_get_or_null (name, father);
- if (ret == NULL){
+ if (ret == nullptr){
THROWF (tracing_error, 2, "type with name (%s) not found in father type (%s)", name, father->name);
}
return ret;
type_t PJ_type_get_or_null (const char *name, type_t father)
{
- if (name == NULL || father == NULL){
- THROWF (tracing_error, 0, "can't get type with a NULL name or from a NULL father");
+ if (name == nullptr || father == nullptr){
+ THROWF (tracing_error, 0, "can't get type with a nullptr name or from a nullptr father");
}
- type_t ret = NULL;
+ type_t ret = nullptr;
type_t child;
char *child_name;
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
xbt_dict_foreach(father->children, cursor, child_name, child) {
if (strcmp (child->name, name) == 0){
- if (ret != NULL){
+ if (ret != nullptr){
THROWF (tracing_error, 0, "there are two children types with the same name?");
}else{
ret = child;
type_t PJ_type_container_new (const char *name, type_t father)
{
- if (name == NULL){
- THROWF (tracing_error, 0, "can't create a container type with a NULL name");
+ if (name == nullptr){
+ THROWF (tracing_error, 0, "can't create a container type with a nullptr name");
}
- type_t ret = NULL;
+ type_t ret = nullptr;
- ret = newType (name, name, NULL, TYPE_CONTAINER, father);
- if (father == NULL){
+ ret = newType (name, name, nullptr, TYPE_CONTAINER, father);
+ if (father == nullptr){
rootType = ret;
}
type_t PJ_type_event_new (const char *name, type_t father)
{
- if (name == NULL){
- THROWF (tracing_error, 0, "can't create an event type with a NULL name");
+ if (name == nullptr){
+ THROWF (tracing_error, 0, "can't create an event type with a nullptr name");
}
- type_t ret = newType (name, name, NULL, TYPE_EVENT, father);
+ type_t ret = newType (name, name, nullptr, TYPE_EVENT, father);
XBT_DEBUG("EventType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
new_pajeDefineEventType(ret);
return ret;
type_t PJ_type_variable_new (const char *name, const char *color, type_t father)
{
- if (name == NULL){
- THROWF (tracing_error, 0, "can't create a variable type with a NULL name");
+ if (name == nullptr){
+ THROWF (tracing_error, 0, "can't create a variable type with a nullptr name");
}
- type_t ret = NULL;
+ type_t ret = nullptr;
char white[INSTR_DEFAULT_STR_SIZE] = "1 1 1";
if (!color){
type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t dest)
{
- if (name == NULL){
- THROWF (tracing_error, 0, "can't create a link type with a NULL name");
+ if (name == nullptr){
+ THROWF (tracing_error, 0, "can't create a link type with a nullptr name");
}
- type_t ret = NULL;
+ type_t ret = nullptr;
char key[INSTR_DEFAULT_STR_SIZE];
snprintf (key, INSTR_DEFAULT_STR_SIZE, "%s-%s-%s", name, source->id, dest->id);
- ret = newType (name, key, NULL, TYPE_LINK, father);
+ ret = newType (name, key, nullptr, TYPE_LINK, father);
XBT_DEBUG("LinkType %s(%s), child of %s(%s) %s(%s)->%s(%s)", ret->name, ret->id, father->name, father->id,
source->name, source->id, dest->name, dest->id);
new_pajeDefineLinkType(ret, source, dest);
type_t PJ_type_state_new (const char *name, type_t father)
{
- if (name == NULL){
- THROWF (tracing_error, 0, "can't create a state type with a NULL name");
+ if (name == nullptr){
+ THROWF (tracing_error, 0, "can't create a state type with a nullptr name");
}
- type_t ret = NULL;
+ type_t ret = nullptr;
- ret = newType (name, name, NULL, TYPE_STATE, father);
+ ret = newType (name, name, nullptr, TYPE_STATE, father);
XBT_DEBUG("StateType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
new_pajeDefineStateType(ret);
return ret;
val_t PJ_value_new (const char *name, const char *color, type_t father)
{
- if (name == NULL || father == NULL){
- THROWF (tracing_error, 0, "can't create a value with a NULL name (or a NULL father)");
+ if (name == nullptr || father == nullptr){
+ THROWF (tracing_error, 0, "can't create a value with a nullptr name (or a nullptr father)");
}
val_t ret = xbt_new0(s_val_t, 1);
snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", instr_new_paje_id());
ret->id = xbt_strdup (str_id);
- xbt_dict_set (father->values, name, ret, NULL);
+ xbt_dict_set (father->values, name, ret, nullptr);
XBT_DEBUG("new value %s, child of %s", ret->name, ret->father->name);
new_pajeDefineEntityValue(ret);
return ret;
val_t PJ_value_get (const char *name, type_t father)
{
- if (name == NULL || father == NULL){
- THROWF (tracing_error, 0, "can't get a value with a NULL name (or a NULL father)");
+ if (name == nullptr || father == nullptr){
+ THROWF (tracing_error, 0, "can't get a value with a nullptr name (or a nullptr father)");
}
if (father->kind == TYPE_VARIABLE)
THROWF(tracing_error, 0, "variables can't have different values (%s)", father->name);
val_t ret = (val_t)xbt_dict_get_or_null (father->values, name);
- if (ret == NULL) {
+ if (ret == nullptr) {
THROWF(tracing_error, 2, "value with name (%s) not found in father type (%s)", name, father->name);
}
return ret;
container_t container = PJ_container_get (resource);
type_t type = PJ_type_get (variable, container->type);
new_pajeSetVariable (now, container, type, 0);
- xbt_dict_set(platform_variables, key, (char*)"", NULL);
+ xbt_dict_set(platform_variables, key, (char*)"", nullptr);
}
xbt_free(key);
}
void TRACE_surf_resource_utilization_alloc()
{
- platform_variables = xbt_dict_new_homogeneous(NULL);
+ platform_variables = xbt_dict_new_homogeneous(nullptr);
}
void TRACE_surf_resource_utilization_release()
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_trace, instr, "tracing event system");
-FILE *tracing_file = NULL;
+FILE *tracing_file = nullptr;
void print_NULL(paje_event_t event){}
print_NULL, print_NULL
};
-xbt_dynar_t buffer = NULL;
+xbt_dynar_t buffer = nullptr;
void dump_comment (const char *comment)
{
void TRACE_init()
{
- buffer = xbt_dynar_new(sizeof(paje_event_t), NULL);
+ buffer = xbt_dynar_new(sizeof(paje_event_t), nullptr);
}
void TRACE_finalize()
event->free (event);
}
xbt_dynar_free (&buffer);
- buffer = xbt_dynar_new (sizeof(paje_event_t), NULL);
+ buffer = xbt_dynar_new (sizeof(paje_event_t), nullptr);
}else{
paje_event_t event;
unsigned int cursor;
jed_res_subset_t res_set;
unsigned int i;
- resource_subset_list = xbt_dynar_new(sizeof(jed_res_subset_t), NULL);
+ resource_subset_list = xbt_dynar_new(sizeof(jed_res_subset_t), nullptr);
jed_simgrid_get_resource_selection_by_hosts(resource_subset_list, host_selection);
xbt_dynar_foreach(resource_subset_list, i, res_set) {
}
void jed_event_add_characteristic(jed_event_t event, char *characteristic) {
- xbt_assert( characteristic != NULL );
+ xbt_assert( characteristic != nullptr );
xbt_dynar_push(event->characteristics_list, &characteristic);
}
void jed_event_add_info(jed_event_t event, char *key, char *value) {
char *val_cp;
- xbt_assert(key != NULL);
- xbt_assert(value != NULL);
+ xbt_assert(key != nullptr);
+ xbt_assert(value != nullptr);
val_cp = strdup(value);
- xbt_dict_set(event->info_hash, key, val_cp, NULL);
+ xbt_dict_set(event->info_hash, key, val_cp, nullptr);
}
void create_jed_event(jed_event_t *event, char *name, double start_time,
(*event)->type = xbt_strdup(type);
(*event)->resource_subsets = xbt_dynar_new(sizeof(jed_res_subset_t), xbt_free_ref);
- (*event)->characteristics_list = xbt_dynar_new(sizeof(char*), NULL);
- (*event)->info_hash = xbt_dict_new_homogeneous(NULL);
+ (*event)->characteristics_list = xbt_dynar_new(sizeof(char*), nullptr);
+ (*event)->info_hash = xbt_dict_new_homogeneous(nullptr);
}
void jed_event_free(jed_event_t event) {
static FILE *jed_file;
static void get_hierarchy_list(xbt_dynar_t hier_list, jed_simgrid_container_t container) {
- xbt_assert( container != NULL );
+ xbt_assert( container != nullptr );
- if( container->parent != NULL ) {
+ if( container->parent != nullptr ) {
- if( container->parent->container_children == NULL ) {
+ if( container->parent->container_children == nullptr ) {
// we are in the last level
get_hierarchy_list(hier_list, container->parent);
} else {
unsigned int length;
outbuf[0] = '\0';
- hier_list = xbt_dynar_new(sizeof(int), NULL);
+ hier_list = xbt_dynar_new(sizeof(int), nullptr);
get_hierarchy_list(hier_list, container);
length = xbt_dynar_length(hier_list);
}
static void print_key_value_dict(xbt_dict_t key_value_dict) {
- xbt_dict_cursor_t cursor=NULL;
+ xbt_dict_cursor_t cursor=nullptr;
char *key,*data;
- if( key_value_dict != NULL ) {
+ if( key_value_dict != nullptr ) {
xbt_dict_foreach(key_value_dict,cursor,key,data) {
fprintf(jed_file, " <prop key=\"%s\" value=\"%s\" />\n",key,data);
}
unsigned int i;
char *res_name;
char resid[STR_BUF_SIZE];
- xbt_assert( resource_parent->resource_list != NULL );
+ xbt_assert( resource_parent->resource_list != nullptr );
res_nb = xbt_dynar_length(resource_parent->resource_list);
unsigned int i;
jed_simgrid_container_t child_container;
- xbt_assert( container != NULL );
+ xbt_assert( container != nullptr );
fprintf(jed_file, " <res name=\"%s\">\n", container->name);
- if( container->container_children != NULL ) {
+ if( container->container_children != nullptr ) {
xbt_dynar_foreach(container->container_children, i, child_container) {
print_container(child_container);
}
unsigned int i;
jed_res_subset_t subset;
- xbt_assert( event != NULL );
- xbt_assert( event->resource_subsets != NULL );
+ xbt_assert( event != nullptr );
+ xbt_assert( event->resource_subsets != nullptr );
fprintf(jed_file, " <event>\n");
}
void jedule_store_event(jed_event_t event) {
- xbt_assert(event != NULL);
+ xbt_assert(event != nullptr);
xbt_dynar_push(jedule_event_list, &event);
}
#endif
xbt_dict_free(&container->name2id);
xbt_dynar_free(&container->resource_list);
- if( container->container_children != NULL ) {
+ if( container->container_children != nullptr ) {
unsigned int iter;
jed_simgrid_container_t child_container;
xbt_dynar_foreach(container->container_children, iter, child_container) {
void jed_simgrid_create_container(jed_simgrid_container_t *container, const char *name)
{
- xbt_assert( name != NULL );
+ xbt_assert( name != nullptr );
*container = xbt_new0(s_jed_simgrid_container_t,1);
(*container)->name = xbt_strdup(name);
(*container)->is_lowest = 0;
- (*container)->container_children = xbt_dynar_new(sizeof(jed_simgrid_container_t), NULL);
- (*container)->parent = NULL;
+ (*container)->container_children = xbt_dynar_new(sizeof(jed_simgrid_container_t), nullptr);
+ (*container)->parent = nullptr;
- xbt_dict_set(container_name2container, (*container)->name, *container, NULL);
+ xbt_dict_set(container_name2container, (*container)->name, *container, nullptr);
}
void jed_simgrid_add_container(jed_simgrid_container_t parent, jed_simgrid_container_t child) {
- xbt_assert(parent != NULL);
- xbt_assert(child != NULL);
+ xbt_assert(parent != nullptr);
+ xbt_assert(child != nullptr);
xbt_dynar_push(parent->container_children, &child);
child->parent = parent;
}
parent->is_lowest = 1;
xbt_dynar_free(&parent->container_children);
- parent->container_children = NULL;
+ parent->container_children = nullptr;
parent->name2id = xbt_dict_new_homogeneous(xbt_free_f);
parent->last_id = 0;
- parent->resource_list = xbt_dynar_new(sizeof(char *), NULL);
+ parent->resource_list = xbt_dynar_new(sizeof(char *), nullptr);
xbt_dynar_sort_strings(host_names);
xbt_dynar_foreach(host_names, iter, host_name) {
buf = bprintf("%d", parent->last_id);
(parent->last_id)++;
- xbt_dict_set(parent->name2id, host_name, buf, NULL);
- xbt_dict_set(host2_simgrid_parent_container, host_name, parent, NULL);
+ xbt_dict_set(parent->name2id, host_name, buf, nullptr);
+ xbt_dict_set(host2_simgrid_parent_container, host_name, parent, nullptr);
xbt_dynar_push(parent->resource_list, &host_name);
}
}
static void add_subset_to(xbt_dynar_t subset_list, int start, int end, jed_simgrid_container_t parent) {
jed_res_subset_t subset;
- xbt_assert( subset_list != NULL );
- xbt_assert( parent != NULL );
+ xbt_assert( subset_list != nullptr );
+ xbt_assert( parent != nullptr );
subset = xbt_new0(s_jed_res_subset_t,1);
subset->start_idx = start;
// compact ids
// create subset for each id group
- xbt_assert( host2_simgrid_parent_container != NULL );
- xbt_assert( subset_list != NULL );
- xbt_assert( hostgroup != NULL );
- xbt_assert( parent != NULL );
+ xbt_assert( host2_simgrid_parent_container != nullptr );
+ xbt_assert( subset_list != nullptr );
+ xbt_assert( hostgroup != nullptr );
+ xbt_assert( parent != nullptr );
- id_list = xbt_dynar_new(sizeof(char *), NULL);
+ id_list = xbt_dynar_new(sizeof(char *), nullptr);
xbt_dynar_foreach(hostgroup, iter, host_name) {
jed_simgrid_container_t parent;
- xbt_assert( host_name != NULL );
+ xbt_assert( host_name != nullptr );
parent = (jed_simgrid_container_t)xbt_dict_get(host2_simgrid_parent_container, host_name);
id_str = (char*)xbt_dict_get(parent->name2id, host_name);
xbt_dynar_push(id_list, &id_str);
unsigned int iter;
xbt_dict_t parent2hostgroup; // group hosts by parent
- parent2hostgroup = xbt_dict_new_homogeneous(NULL);
+ parent2hostgroup = xbt_dict_new_homogeneous(nullptr);
- xbt_assert( host_names != NULL );
+ xbt_assert( host_names != nullptr );
// for each host name
// find parent container
xbt_dynar_foreach(host_names, iter, host_name) {
jed_simgrid_container_t parent = (jed_simgrid_container_t)xbt_dict_get(host2_simgrid_parent_container, host_name);
- xbt_assert( parent != NULL );
+ xbt_assert( parent != nullptr );
xbt_dynar_t hostgroup = (xbt_dynar_t)xbt_dict_get_or_null (parent2hostgroup, parent->name);
- if( hostgroup == NULL ) {
- hostgroup = xbt_dynar_new(sizeof(char*), NULL);
- xbt_dict_set(parent2hostgroup, parent->name, hostgroup, NULL);
+ if( hostgroup == nullptr ) {
+ hostgroup = xbt_dynar_new(sizeof(char*), nullptr);
+ xbt_dict_set(parent2hostgroup, parent->name, hostgroup, nullptr);
}
xbt_dynar_push(hostgroup, &host_name);
}
- xbt_dict_cursor_t cursor=NULL;
+ xbt_dict_cursor_t cursor=nullptr;
char *parent_name;
xbt_dynar_t hostgroup;
jed_simgrid_container_t parent;
void jedule_add_meta_info(jedule_t jedule, char *key, char *value) {
char *val_cp;
- xbt_assert(key != NULL);
- xbt_assert(value != NULL);
+ xbt_assert(key != nullptr);
+ xbt_assert(value != nullptr);
val_cp = xbt_strdup(value);
- xbt_dict_set(jedule->jedule_meta_info, key, val_cp, NULL);
+ xbt_dict_set(jedule->jedule_meta_info, key, val_cp, nullptr);
}
void jed_create_jedule(jedule_t *jedule) {
*jedule = xbt_new0(s_jedule_t,1);
- host2_simgrid_parent_container = xbt_dict_new_homogeneous(NULL);
- container_name2container = xbt_dict_new_homogeneous(NULL);
- (*jedule)->jedule_meta_info = xbt_dict_new_homogeneous(NULL);
+ host2_simgrid_parent_container = xbt_dict_new_homogeneous(nullptr);
+ container_name2container = xbt_dict_new_homogeneous(nullptr);
+ (*jedule)->jedule_meta_info = xbt_dict_new_homogeneous(nullptr);
}
void jed_free_jedule(jedule_t jedule) {
{
jed_event_t event;
- xbt_assert(task != NULL);
+ xbt_assert(task != nullptr);
- xbt_dynar_t host_list = xbt_dynar_new(sizeof(char*), NULL);
+ xbt_dynar_t host_list = xbt_dynar_new(sizeof(char*), nullptr);
for(int i=0; i<task->host_count; i++) {
const char *hostname = sg_host_get_name(task->host_list[i]);
static void create_hierarchy(AS_t current_comp, jed_simgrid_container_t current_container)
{
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
char *key;
AS_t elem;
xbt_dict_t routing_sons = current_comp->children();
unsigned int dynar_cursor;
sg_host_t host_elem;
- hosts = xbt_dynar_new(sizeof(char*), NULL);
+ hosts = xbt_dynar_new(sizeof(char*), nullptr);
xbt_dynar_foreach(table, dynar_cursor, host_elem) {
xbt_dynar_push_as(hosts, const char*, sg_host_get_name(host_elem));
{
if (jedule) {
jed_free_jedule(jedule);
- jedule = NULL;
+ jedule = nullptr;
}
}
fh = fopen(fname, "w");
- write_jedule_output(fh, jedule, jedule_event_list, NULL);
+ write_jedule_output(fh, jedule, jedule_event_list, nullptr);
fclose(fh);
free(fname);