From: Frederic Suter Date: Tue, 1 Mar 2016 14:30:53 +0000 (+0100) Subject: blank lines and indent in instr X-Git-Tag: v3_13~594^2~1 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3eb2083c05f047dcdb72bcccd697687ca3ee6aac blank lines and indent in instr --- diff --git a/src/instr/instr_TI_trace.cpp b/src/instr/instr_TI_trace.cpp index ce579e3c07..84e1e73d5b 100644 --- a/src/instr/instr_TI_trace.cpp +++ b/src/instr/instr_TI_trace.cpp @@ -38,8 +38,7 @@ void TRACE_TI_start(void) char *filename = TRACE_get_filename(); tracing_file = fopen(filename, "w"); if (tracing_file == NULL) { - THROWF(system_error, 1, "Tracefile %s could not be opened for writing.", - filename); + THROWF(system_error, 1, "Tracefile %s could not be opened for writing.", filename); } XBT_DEBUG("Filename %s is open for writing", filename); @@ -49,7 +48,6 @@ void TRACE_TI_start(void) /* output comment file */ dump_comment_file(TRACE_get_comment_file()); - } void TRACE_TI_end(void) @@ -71,11 +69,9 @@ void print_TICreateContainer(paje_event_t event) prefix = xbt_os_time(); } - if (!xbt_cfg_get_boolean(_sg_cfg_set, "tracing/smpi/format/ti_one_file") - || temp == NULL) { + if (!xbt_cfg_get_boolean(_sg_cfg_set, "tracing/smpi/format/ti_one_file") || temp == NULL) { 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); + char *filename = bprintf("%s/%f_%s.txt", folder_name, prefix, ((createContainer_t) event->data)->container->name); #ifdef WIN32 _mkdir(folder_name); #else @@ -83,42 +79,33 @@ void print_TICreateContainer(paje_event_t event) #endif temp = fopen(filename, "w"); if (temp == NULL) - xbt_die("Tracefile %s could not be opened for writing: %s", - filename, strerror(errno)); + xbt_die("Tracefile %s could not be opened for writing: %s", filename, strerror(errno)); fprintf(tracing_file, "%s\n", filename); xbt_free(folder_name); 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, NULL); } void print_TIDestroyContainer(paje_event_t event) { - if (!xbt_cfg_get_boolean(_sg_cfg_set, "tracing/smpi/format/ti_one_file")|| - xbt_dict_length(tracing_files) == 1) { - FILE* f = (FILE*)xbt_dict_get_or_null(tracing_files, - ((destroyContainer_t) event->data)->container->name); + if (!xbt_cfg_get_boolean(_sg_cfg_set, "tracing/smpi/format/ti_one_file")|| xbt_dict_length(tracing_files) == 1) { + FILE* f = (FILE*)xbt_dict_get_or_null(tracing_files, ((destroyContainer_t) event->data)->container->name); fclose(f); } xbt_dict_remove(tracing_files, ((destroyContainer_t) event->data)->container->name); } - void print_TIPushState(paje_event_t event) { - - int i; //char* function=NULL; if (((pushState_t) event->data)->extra == NULL) return; - instr_extra_data extra = - (instr_extra_data) (((pushState_t) event->data)->extra); + instr_extra_data extra = (instr_extra_data) (((pushState_t) event->data)->extra); char *process_id = NULL; //FIXME: dirty extract "rank-" from the name, as we want the bare process id here @@ -130,7 +117,6 @@ void print_TIPushState(paje_event_t event) FILE* trace_file = (FILE* )xbt_dict_get(tracing_files, ((pushState_t) event->data)->container->name); switch (extra->type) { - case TRACING_INIT: fprintf(trace_file, "%s init\n", process_id); break; @@ -138,20 +124,16 @@ void print_TIPushState(paje_event_t event) fprintf(trace_file, "%s finalize\n", process_id); break; case TRACING_SEND: - fprintf(trace_file, "%s send %d %d %s\n", process_id, extra->dst, - extra->send_size, extra->datatype1); + fprintf(trace_file, "%s send %d %d %s\n", process_id, extra->dst, extra->send_size, extra->datatype1); break; case TRACING_ISEND: - fprintf(trace_file, "%s isend %d %d %s\n", process_id, extra->dst, - extra->send_size, extra->datatype1); + fprintf(trace_file, "%s isend %d %d %s\n", process_id, extra->dst, extra->send_size, extra->datatype1); break; case TRACING_RECV: - fprintf(trace_file, "%s recv %d %d %s\n", process_id, extra->src, - extra->send_size, extra->datatype1); + fprintf(trace_file, "%s recv %d %d %s\n", process_id, extra->src, extra->send_size, extra->datatype1); break; case TRACING_IRECV: - fprintf(trace_file, "%s irecv %d %d %s\n", process_id, extra->src, - extra->send_size, extra->datatype1); + fprintf(trace_file, "%s irecv %d %d %s\n", process_id, extra->src, extra->send_size, extra->datatype1); break; case TRACING_TEST: fprintf(trace_file, "%s test\n", process_id); @@ -172,19 +154,16 @@ void print_TIPushState(paje_event_t event) fprintf(trace_file, "\n"); break; case TRACING_REDUCE: // rank reduce comm_size comp_size (root) (datatype) - fprintf(trace_file, "%s reduce %d %f ", process_id, extra->send_size, - extra->comp_size); + fprintf(trace_file, "%s reduce %d %f ", process_id, extra->send_size, extra->comp_size); if (extra->root != 0 || (extra->datatype1 && strcmp(extra->datatype1, ""))) fprintf(trace_file, "%d %s", extra->root, extra->datatype1); fprintf(trace_file, "\n"); break; case TRACING_ALLREDUCE: // rank allreduce comm_size comp_size (datatype) - fprintf(trace_file, "%s allreduce %d %f %s\n", process_id, - extra->send_size, extra->comp_size, extra->datatype1); + fprintf(trace_file, "%s allreduce %d %f %s\n", process_id, extra->send_size, extra->comp_size, extra->datatype1); break; case TRACING_ALLTOALL: // rank alltoall send_size recv_size (sendtype) (recvtype) - fprintf(trace_file, "%s alltoall %d %d %s %s\n", process_id, - extra->send_size, extra->recv_size, extra->datatype1, + fprintf(trace_file, "%s alltoall %d %d %s %s\n", process_id, extra->send_size, extra->recv_size, extra->datatype1, extra->datatype2); break; case TRACING_ALLTOALLV: // rank alltoallv send_size [sendcounts] recv_size [recvcounts] (sendtype) (recvtype) @@ -197,9 +176,8 @@ void print_TIPushState(paje_event_t event) fprintf(trace_file, "%s %s \n", extra->datatype1, extra->datatype2); break; case TRACING_GATHER: // rank gather send_size recv_size root (sendtype) (recvtype) - fprintf(trace_file, "%s gather %d %d %d %s %s\n", process_id, - extra->send_size, extra->recv_size, extra->root, extra->datatype1, - extra->datatype2); + fprintf(trace_file, "%s gather %d %d %d %s %s\n", process_id, extra->send_size, extra->recv_size, extra->root, + extra->datatype1, extra->datatype2); break; case TRACING_ALLGATHERV: // rank allgatherv send_size [recvcounts] (sendtype) (recvtype) fprintf(trace_file, "%s allgatherv %d ", process_id, extra->send_size); @@ -238,9 +216,7 @@ void print_TIPushState(paje_event_t event) case TRACING_SSEND: case TRACING_ISSEND: default: - - XBT_WARN - ("Call from %s impossible to translate into replay command : Not implemented (yet)", + XBT_WARN ("Call from %s impossible to translate into replay command : Not implemented (yet)", ((pushState_t) event->data)->value->name); break; } diff --git a/src/instr/instr_config.cpp b/src/instr/instr_config.cpp index 47b9554636..1bd97943b5 100644 --- a/src/instr/instr_config.cpp +++ b/src/instr/instr_config.cpp @@ -63,8 +63,6 @@ static int trace_precision; static int trace_configured = 0; static int trace_active = 0; - - static void TRACE_getopts(void) { trace_enabled = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING); @@ -108,7 +106,6 @@ int TRACE_start() if (TRACE_is_enabled()) { XBT_DEBUG("Tracing starts"); - /* init the tracing module to generate the right output */ /* open internal buffer */ TRACE_init(); @@ -219,12 +216,8 @@ int TRACE_end() int TRACE_needs_platform (void) { - return TRACE_msg_process_is_enabled() || - TRACE_msg_vm_is_enabled() || - TRACE_categorized() || - TRACE_uncategorized() || - TRACE_platform () || - (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped()); + return TRACE_msg_process_is_enabled() || TRACE_msg_vm_is_enabled() || TRACE_categorized() || + TRACE_uncategorized() || TRACE_platform () || (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped()); } int TRACE_is_enabled(void) @@ -249,8 +242,7 @@ int TRACE_is_configured(void) int TRACE_smpi_is_enabled(void) { - return (trace_smpi_enabled || TRACE_smpi_is_grouped()) - && TRACE_is_enabled(); + return (trace_smpi_enabled || TRACE_smpi_is_grouped()) && TRACE_is_enabled(); } int TRACE_smpi_is_grouped(void) @@ -365,134 +357,107 @@ void TRACE_global_init(int *argc, char **argv) is_initialised = 1; /* name of the tracefile */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_FILENAME, - "Trace file created by the instrumented SimGrid.", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_FILENAME, "Trace file created by the instrumented SimGrid.", xbt_cfgelm_string, 1, 1, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, OPT_TRACING_FILENAME, "simgrid.trace"); /* tracing */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING, - "Enable Tracing.", - xbt_cfgelm_boolean, 1, 1, NULL); + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING, "Enable Tracing.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING, "no"); /* register platform in the trace */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_PLATFORM, - "Register the platform in the trace as a hierarchy.", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_PLATFORM, "Register the platform in the trace as a hierarchy.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_PLATFORM, "no"); /* register platform in the trace */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_TOPOLOGY, - "Register the platform topology in the trace as a graph.", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_TOPOLOGY, "Register the platform topology in the trace as a graph.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_TOPOLOGY, "yes"); /* smpi */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_SMPI, - "Tracing of the SMPI interface.", - xbt_cfgelm_boolean, 1, 1, NULL); + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_SMPI, "Tracing of the SMPI interface.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_SMPI, "no"); /* smpi grouped */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_SMPI_GROUP, - "Group MPI processes by host.", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_SMPI_GROUP, "Group MPI processes by host.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_SMPI_GROUP, "no"); /* smpi computing */ xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_SMPI_COMPUTING, - "Generate states for timing out of SMPI parts of the application", - xbt_cfgelm_boolean, 1, 1, NULL); + "Generate states for timing out of SMPI parts of the application", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_SMPI_COMPUTING, "no"); /* smpi sleeping */ xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_SMPI_SLEEPING, - "Generate states for timing out of SMPI parts of the application", - xbt_cfgelm_boolean, 1, 1, NULL); + "Generate states for timing out of SMPI parts of the application", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_SMPI_SLEEPING, "no"); - /* smpi internals */ xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_SMPI_INTERNALS, - "View internal messages sent by Collective communications in SMPI", - xbt_cfgelm_boolean, 1, 1, NULL); + "View internal messages sent by Collective communications in SMPI", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_SMPI_INTERNALS, "no"); /* tracing categorized resource utilization traces */ xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_CATEGORIZED, - "Tracing categorized resource utilization of hosts and links.", - xbt_cfgelm_boolean, 1, 1, NULL); + "Tracing categorized resource utilization of hosts and links.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_CATEGORIZED, "no"); /* tracing uncategorized resource utilization */ xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_UNCATEGORIZED, - "Tracing uncategorized resource utilization of hosts and links.", - xbt_cfgelm_boolean, 1, 1, NULL); + "Tracing uncategorized resource utilization of hosts and links.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_UNCATEGORIZED, "no"); /* msg process */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_MSG_PROCESS, - "Tracing of MSG process behavior.", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_MSG_PROCESS, "Tracing of MSG process behavior.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_MSG_PROCESS, "no"); /* msg process */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_MSG_VM, - "Tracing of MSG process behavior.", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_MSG_VM, "Tracing of MSG process behavior.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_MSG_VM, "no"); /* disable tracing link */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_DISABLE_LINK, - "Do not trace link bandwidth and latency.", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_DISABLE_LINK, "Do not trace link bandwidth and latency.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_DISABLE_LINK, "no"); /* disable tracing link */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_DISABLE_POWER, - "Do not trace host power.", - xbt_cfgelm_boolean, 1, 1, NULL); + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_DISABLE_POWER, "Do not trace host power.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_DISABLE_POWER, "no"); - /* tracing buffer */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_BUFFER, - "Buffer trace events to put them in temporal order.", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_BUFFER, "Buffer trace events to put them in temporal order.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_BUFFER, "yes"); /* tracing one link only */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_ONELINK_ONLY, - "Use only routes with one link to trace platform.", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_ONELINK_ONLY, "Use only routes with one link to trace platform.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_ONELINK_ONLY, "no"); /* disable destroy */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_DISABLE_DESTROY, - "Disable platform containers destruction.", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_DISABLE_DESTROY, "Disable platform containers destruction.", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_DISABLE_DESTROY, "no"); /* basic -- Avoid extended events (impoverished trace file) */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_BASIC, - "Avoid extended events (impoverished trace file).", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_BASIC, "Avoid extended events (impoverished trace file).", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_BASIC, "no"); /* display_sizes -- Extended events with message size information */ xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_DISPLAY_SIZES, - "(smpi only for now) Extended events with message size information", - xbt_cfgelm_boolean, 1, 1, NULL); + "(smpi only for now) Extended events with message size information", xbt_cfgelm_boolean, 1, 1, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_DISPLAY_SIZES, "no"); /* format -- Switch the ouput format of Tracing */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_FORMAT, - "(smpi only for now) Switch the output format of Tracing", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_FORMAT, "(smpi only for now) Switch the output format of Tracing", xbt_cfgelm_string, 1, 1, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, OPT_TRACING_FORMAT, "Paje"); - /* format -- Switch the ouput format of Tracing */ xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_FORMAT_TI_ONEFILE, "(smpi only for now) For replay format only : output to one file only", @@ -500,8 +465,7 @@ void TRACE_global_init(int *argc, char **argv) xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_FORMAT_TI_ONEFILE, "no"); /* comment */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_COMMENT, - "Comment to be added on the top of the trace file.", + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_COMMENT, "Comment to be added on the top of the trace file.", xbt_cfgelm_string, 1, 1, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, OPT_TRACING_COMMENT, ""); @@ -512,9 +476,8 @@ void TRACE_global_init(int *argc, char **argv) xbt_cfg_setdefault_string(_sg_cfg_set, OPT_TRACING_COMMENT_FILE, ""); /* trace timestamp precision */ - xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_PRECISION, - "Numerical precision used when timestamping events (hence this value is expressed in number of digits after decimal point)", - xbt_cfgelm_int, 1, 1, NULL); + xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_PRECISION, "Numerical precision used when timestamping events (hence " + "this value is expressed in number of digits after decimal point)", xbt_cfgelm_int, 1, 1, NULL); xbt_cfg_setdefault_int(_sg_cfg_set, OPT_TRACING_PRECISION, 6); /* Viva graph configuration for uncategorized tracing */ @@ -547,120 +510,97 @@ static void print_line (const char *option, const char *desc, const char *longde void TRACE_help (int detailed) { - printf( - "Description of the tracing options accepted by this simulator:\n\n"); + printf("Description of the tracing options accepted by this simulator:\n\n"); print_line (OPT_TRACING, "Enable the tracing system", " It activates the tracing system and register the simulation platform\n" - " in the trace file. You have to enable this option to others take effect.", - detailed); + " in the trace file. You have to enable this option to others take effect.", detailed); print_line (OPT_TRACING_CATEGORIZED, "Trace categorized resource utilization", " It activates the categorized resource utilization tracing. It should\n" - " be enabled if tracing categories are used by this simulator.", - detailed); + " be enabled if tracing categories are used by this simulator.", detailed); print_line (OPT_TRACING_UNCATEGORIZED, "Trace uncategorized resource utilization", " It activates the uncategorized resource utilization tracing. Use it if\n" " this simulator do not use tracing categories and resource use have to be\n" - " traced.", - detailed); + " traced.", detailed); print_line (OPT_TRACING_FILENAME, "Filename to register traces", " A file with this name will be created to register the simulation. The file\n" " is in the Paje format and can be analyzed using Viva, Paje, and PajeNG visualization\n" " tools. More information can be found in these webpages:\n" " http://github.com/schnorr/viva/\n" " http://github.com/schnorr/pajeng/\n" - " http://paje.sourceforge.net/", - detailed); + " http://paje.sourceforge.net/", detailed); print_line (OPT_TRACING_SMPI, "Trace the MPI Interface (SMPI)", " This option only has effect if this simulator is SMPI-based. Traces the MPI\n" " interface and generates a trace that can be analyzed using Gantt-like\n" " visualizations. Every MPI function (implemented by SMPI) is transformed in a\n" - " state, and point-to-point communications can be analyzed with arrows.", - detailed); + " state, and point-to-point communications can be analyzed with arrows.", detailed); print_line (OPT_TRACING_SMPI_GROUP, "Group MPI processes by host (SMPI)", " This option only has effect if this simulator is SMPI-based. The processes\n" - " are grouped by the hosts where they were executed.", - detailed); + " are grouped by the hosts where they were executed.", detailed); print_line (OPT_TRACING_SMPI_COMPUTING, "Generates a \" Computing \" State", " This option aims at tracing computations in the application, outside SMPI\n" - " to allow further study of simulated or real computation time", - detailed); + " to allow further study of simulated or real computation time", detailed); print_line (OPT_TRACING_SMPI_SLEEPING, "Generates a \" Sleeping \" State", " This option aims at tracing sleeps in the application, outside SMPI\n" - " to allow further study of simulated or real sleep time", - detailed); + " to allow further study of simulated or real sleep time", detailed); print_line (OPT_TRACING_SMPI_INTERNALS, "Generates tracing events corresponding", - " to point-to-point messages sent by collective communications", - detailed); + " to point-to-point messages sent by collective communications", detailed); print_line (OPT_TRACING_MSG_PROCESS, "Trace processes behavior (MSG)", " This option only has effect if this simulator is MSG-based. It traces the\n" " behavior of all categorized MSG processes, grouping them by hosts. This option\n" - " can be used to track process location if this simulator has process migration.", - detailed); + " can be used to track process location if this simulator has process migration.", detailed); print_line (OPT_TRACING_BUFFER, "Buffer events to put them in temporal order", " This option put some events in a time-ordered buffer using the insertion\n" " sort algorithm. The process of acquiring and releasing locks to access this\n" " buffer and the cost of the sorting algorithm make this process slow. The\n" " simulator performance can be severely impacted if this option is activated,\n" - " but you are sure to get a trace file with events sorted.", - detailed); + " but you are sure to get a trace file with events sorted.", detailed); print_line (OPT_TRACING_ONELINK_ONLY, "Consider only one link routes to trace platform", " This option changes the way SimGrid register its platform on the trace file.\n" " Normally, the tracing considers all routes (no matter their size) on the\n" " platform file to re-create the resource topology. If this option is activated,\n" " only the routes with one link are used to register the topology within an AS.\n" - " Routes among AS continue to be traced as usual.", - detailed); + " Routes among AS continue to be traced as usual.", detailed); print_line (OPT_TRACING_DISABLE_DESTROY, "Disable platform containers destruction", " Disable the destruction of containers at the end of simulation. This can be\n" " used with simulators that have a different notion of time (different from\n" - " the simulated time).", - detailed); + " the simulated time).", detailed); print_line (OPT_TRACING_BASIC, "Avoid extended events (impoverished trace file).", " Some visualization tools are not able to parse correctly the Paje file format.\n" " Use this option if you are using one of these tools to visualize the simulation\n" " trace. Keep in mind that the trace might be incomplete, without all the\n" - " information that would be registered otherwise.", - detailed); + " information that would be registered otherwise.", detailed); print_line (OPT_TRACING_DISPLAY_SIZES, "Only works for SMPI now. Add message size information", " Message size (in bytes) is added to links, and to states. For collectives,\n" " the displayed value is the more relevant to the collective (total sent by\n" - " the process, usually)", - detailed); + " the process, usually)", detailed); print_line (OPT_TRACING_FORMAT, "Only works for SMPI now. Switch output format", " Default format is Paje. Time independent traces are also supported,\n" - " to output traces that can later be used by the trace replay tool", - detailed); + " to output traces that can later be used by the trace replay tool", detailed); print_line (OPT_TRACING_FORMAT_TI_ONEFILE, "Only works for SMPI now, and TI output format", " By default, each process outputs to a separate file, inside a filename_files folder\n" " By setting this option to yes, all processes will output to only one file\n" - " This is meant to avoid opening thousands of files with large simulations", - detailed); + " This is meant to avoid opening thousands of files with large simulations", detailed); print_line (OPT_TRACING_COMMENT, "Comment to be added on the top of the trace file.", - " Use this to add a comment line to the top of the trace file.", - detailed); + " Use this to add a comment line to the top of the trace file.", detailed); print_line (OPT_TRACING_COMMENT_FILE, "File contents added to trace file as comment.", - " Use this to add the contents of a file to the top of the trace file as comment.", - detailed); + " Use this to add the contents of a file to the top of the trace file as comment.", detailed); print_line (OPT_VIVA_UNCAT_CONF, "Generate a graph configuration for Viva", " This option can be used in all types of simulators build with SimGrid\n" " to generate a uncategorized resource utilization graph to be used as\n" " configuration for the Viva visualization tool. This option\n" " can be used with tracing/categorized:1 and tracing:1 options to\n" " analyze an unmodified simulator before changing it to contain\n" - " categories.", - detailed); + " categories.", detailed); print_line (OPT_VIVA_CAT_CONF, "Generate an uncategorized graph configuration for Viva", " This option can be used if this simulator uses tracing categories\n" " in its code. The file specified by this option holds a graph configuration\n" " file for the Viva visualization tool that can be used to analyze a categorized\n" - " resource utilization.", - detailed); + " resource utilization.", detailed); print_line (OPT_TRACING_TOPOLOGY, "Register the platform topology as a graph", " This option (enabled by default) can be used to disable the tracing of\n" " the platform topology in the trace file. Sometimes, such task is really\n" " time consuming, since it must get the route from each host ot other hosts\n" - " within the same Autonomous System (AS).", - detailed); + " within the same Autonomous System (AS).", detailed); } static void output_types (const char *name, xbt_dynar_t types, FILE *file) diff --git a/src/instr/instr_interface.cpp b/src/instr/instr_interface.cpp index 5be023c7fb..6c03941593 100644 --- a/src/instr/instr_interface.cpp +++ b/src/instr/instr_interface.cpp @@ -5,7 +5,6 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid_config.h" - #include "src/surf/network_interface.hpp" #include "src/instr/instr_private.h" #include "surf/surf.h" @@ -45,18 +44,13 @@ static xbt_dynar_t instr_dict_to_dynar (xbt_dict_t filter) /** \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. + * 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 tracing for details on how to trace - * the (categorized) resource utilization. + * See \ref tracing for details on how to trace the (categorized) resource utilization. * * \param category The name of the new tracing category to be created. * @@ -70,14 +64,11 @@ void TRACE_category(const char *category) /** \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. + * 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 tracing for details on how to trace - * the (categorized) resource utilization. + * See \ref tracing 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 tracing to @@ -118,15 +109,13 @@ void TRACE_category_with_color (const char *category, const char *color) 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. + * This function should be used to get categories that were already declared with #TRACE_category or with + * #TRACE_category_with_color. * - * See \ref tracing for details on how to trace - * the (categorized) resource utilization. + * See \ref tracing for details on how to trace the (categorized) resource utilization. * * \return A dynar with the declared categories, must be freed with xbt_dynar_free. * @@ -143,11 +132,8 @@ xbt_dynar_t TRACE_get_categories (void) /** \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. + * 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. * @@ -177,14 +163,11 @@ void TRACE_declare_mark(const char *mark_type) /** \ingroup TRACE_mark * \brief Declare a new colored value for a previously declared mark type. * - * 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 + * 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 be white ("1 1 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 + * be white ("1 1 1"). * * \param mark_type The name of the new type. * \param mark_value The name of the new value for this type. @@ -218,12 +201,9 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar /** \ingroup TRACE_mark * \brief Declare a new value for a previously declared mark 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. + * 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. * * \param mark_type The name of the new type. * \param mark_value The name of the new value for this type. @@ -239,14 +219,10 @@ void TRACE_declare_mark_value (const char *mark_type, const char *mark_value) * \ingroup TRACE_mark * \brief Create a new instance of a tracing mark type. * - * This function creates a mark in the trace file. The - * first parameter had to be previously declared using - * #TRACE_declare_mark, the second is the identifier - * for this mark instance. We recommend that the - * mark_value is a unique value for the whole simulation. - * Nevertheless, this is not a strong requirement: the - * trace will be valid even if there are multiple mark - * identifiers for the same trace. + * This function creates a mark in the trace file. The first parameter had to be previously declared using + * #TRACE_declare_mark, the second is the identifier for this mark instance. We recommend that the mark_value is a + * unique value for the whole simulation. Nevertheless, this is not a strong requirement: the trace will be valid even + * if there are multiple mark identifiers for the same trace. * * \param mark_type The name of the type for which the new instance will belong. * \param mark_value The name of the new instance mark. @@ -278,11 +254,9 @@ void TRACE_mark(const char *mark_type, const char *mark_value) /** \ingroup TRACE_mark * \brief Get declared marks * - * This function should be used to get marks that were already - * declared with #TRACE_declare_mark. + * This function should be used to get marks that were already declared with #TRACE_declare_mark. * * \return A dynar with the declared marks, must be freed with xbt_dynar_free. - * */ xbt_dynar_t TRACE_get_marks (void) { @@ -291,14 +265,8 @@ xbt_dynar_t TRACE_get_marks (void) return instr_dict_to_dynar (declared_marks); } -static void instr_user_variable(double time, - const char *resource, - const char *variable, - const char *father_type, - double value, - InstrUserVariable what, - const char *color, - xbt_dict_t filter) +static void instr_user_variable(double time, const char *resource, const char *variable, const char *father_type, + double value, InstrUserVariable what, const char *color, xbt_dict_t filter) { /* safe switch */ if (!TRACE_is_enabled()) return; @@ -309,15 +277,13 @@ static void instr_user_variable(double time, //check if variable is already declared char *created = (char*)xbt_dict_get_or_null(filter, variable); if (what == INSTR_US_DECLARE){ - if (created){ - //already declared + if (created){//already declared return; }else{ xbt_dict_set (filter, variable, xbt_strdup("1"), NULL); } }else{ - if (!created){ - //not declared, ignore + if (!created){//not declared, ignore return; } } @@ -330,39 +296,34 @@ static void instr_user_variable(double time, instr_new_user_variable_type (father_type, variable, color); break; case INSTR_US_SET: - { - container_t container = PJ_container_get(resource); - type_t type = PJ_type_get (variable, container->type); - new_pajeSetVariable(time, container, type, value); + { + container_t container = PJ_container_get(resource); + type_t type = PJ_type_get (variable, container->type); + new_pajeSetVariable(time, container, type, value); + } break; - } case INSTR_US_ADD: - { - container_t container = PJ_container_get(resource); - type_t type = PJ_type_get (variable, container->type); - new_pajeAddVariable(time, container, type, value); + { + container_t container = PJ_container_get(resource); + type_t type = PJ_type_get (variable, container->type); + new_pajeAddVariable(time, container, type, value); + } break; - } case INSTR_US_SUB: - { - container_t container = PJ_container_get(resource); - type_t type = PJ_type_get (variable, container->type); - new_pajeSubVariable(time, container, type, value); - break; - } + { + container_t container = PJ_container_get(resource); + type_t type = PJ_type_get (variable, container->type); + new_pajeSubVariable(time, container, type, value); + } + break; default: //TODO: launch exception break; } } -static void instr_user_srcdst_variable(double time, - const char *src, - const char *dst, - const char *variable, - const char *father_type, - double value, - InstrUserVariable what) +static void instr_user_srcdst_variable(double time, const char *src, const char *dst, const char *variable, + const char *father_type, double value, InstrUserVariable what) { sg_netcard_t src_elm = sg_netcard_by_name_or_null(src); if(!src_elm) xbt_die("Element '%s' not found!",src); @@ -380,8 +341,8 @@ static void instr_user_srcdst_variable(double time, /** \ingroup TRACE_API * \brief Creates a file with the topology of the platform file used for the simulator. * - * The graph topology will have the following properties: all hosts, links and routers - * of the platform file are mapped to graph nodes; routes are mapped to edges. + * The graph topology will have the following properties: all hosts, links and routers of the platform file are mapped + * to graph nodes; routes are mapped to edges. * The platform's AS are not represented in the output. * * \param filename The name of the file that will hold the graph. @@ -400,19 +361,16 @@ int TRACE_platform_graph_export_graphviz (const char *filename) } /* - * Derived functions that use instr_user_variable and TRACE_user_srcdst_variable. - * They were previously defined as pre-processors directives, but were transformed - * into functions so the user can track them using gdb. + * Derived functions that use instr_user_variable and TRACE_user_srcdst_variable. They were previously defined as + * pre-processors directives, but were transformed into functions so the user can track them using gdb. */ /* for VM variables */ /** \ingroup TRACE_user_variables * \brief Declare a new user variable associated to VMs. * - * Declare a user variable that will be associated to VMs. - * A user vm variable can be used to trace user variables - * such as the number of tasks in a VM, the number of - * clients in an application (for VMs), and so on. The color + * Declare a user variable that will be associated to VMs. A user vm variable can be used to trace user variables + * such as the number of tasks in a VM, the number of clients in an application (for VMs), and so on. The color * associated to this new variable will be random. * * \param variable The name of the new variable to be declared. @@ -427,14 +385,12 @@ void TRACE_vm_variable_declare (const char *variable) /** \ingroup TRACE_user_variables * \brief Declare a new user variable associated to VMs with a color. * - * Same as #TRACE_vm_variable_declare, but associated a color - * to the newly created user host variable. The color needs to be - * a string with three numbers separated by spaces in the range [0,1]. + * Same as #TRACE_vm_variable_declare, but associated a color to the newly created user host variable. 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. * * \param variable The name of the new variable to be declared. * \param color The color for the new variable. - * */ void TRACE_vm_variable_declare_with_color (const char *variable, const char *color) { @@ -452,7 +408,6 @@ void TRACE_vm_variable_declare_with_color (const char *variable, const char *col */ void TRACE_vm_variable_set (const char *vm, const char *variable, double value) { - TRACE_vm_variable_set_with_time (MSG_get_clock(), vm, variable, value); } @@ -487,12 +442,10 @@ void TRACE_vm_variable_sub (const char *vm, const char *variable, double value) /** \ingroup TRACE_user_variables * \brief Set the value of a variable of a VM at a given timestamp. * - * Same as #TRACE_vm_variable_set, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_vm_variable_set, but let user specify the time used to trace it. Users can specify a time that + * is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param vm The name of the VM to be considered. @@ -509,12 +462,10 @@ void TRACE_vm_variable_set_with_time (double time, const char *vm, const char *v /** \ingroup TRACE_user_variables * \brief Add a value to a variable of a VM at a given timestamp. * - * Same as #TRACE_vm_variable_add, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_vm_variable_add, but let user specify the time used to trace it. Users can specify a time that + * is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param vm The name of the VM to be considered. @@ -531,12 +482,10 @@ void TRACE_vm_variable_add_with_time (double time, const char *vm, const char *v /** \ingroup TRACE_user_variables * \brief Subtract a value from a variable of a VM at a given timestamp. * - * Same as #TRACE_vm_variable_sub, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_vm_variable_sub, but let user specify the time used to trace it. Users can specify a time that + * is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param vm The name of the VM to be considered. @@ -553,8 +502,8 @@ void TRACE_vm_variable_sub_with_time (double time, const char *vm, const char *v /** \ingroup TRACE_user_variables * \brief Get declared user vm variables * - * This function should be used to get VM variables that were already - * declared with #TRACE_vm_variable_declare or with #TRACE_vm_variable_declare_with_color. + * This function should be used to get VM variables that were already declared with #TRACE_vm_variable_declare or with + * #TRACE_vm_variable_declare_with_color. * * \return A dynar with the declared host variables, must be freed with xbt_dynar_free. */ @@ -563,17 +512,13 @@ xbt_dynar_t TRACE_get_vm_variables (void) return instr_dict_to_dynar (user_vm_variables); } - - /* for host variables */ /** \ingroup TRACE_user_variables * \brief Declare a new user variable associated to hosts. * * Declare a user variable that will be associated to hosts. - * A user host variable can be used to trace user variables - * such as the number of tasks in a server, the number of - * clients in an application (for hosts), and so on. The color - * associated to this new variable will be random. + * A user host variable can be used to trace user variables such as the number of tasks in a server, the number of + * clients in an application (for hosts), and so on. The color associated to this new variable will be random. * * \param variable The name of the new variable to be declared. * @@ -587,14 +532,12 @@ void TRACE_host_variable_declare (const char *variable) /** \ingroup TRACE_user_variables * \brief Declare a new user variable associated to hosts with a color. * - * Same as #TRACE_host_variable_declare, but associated a color - * to the newly created user host variable. The color needs to be - * a string with three numbers separated by spaces in the range [0,1]. + * Same as #TRACE_host_variable_declare, but associated a color to the newly created user host variable. 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. * * \param variable The name of the new variable to be declared. * \param color The color for the new variable. - * */ void TRACE_host_variable_declare_with_color (const char *variable, const char *color) { @@ -646,12 +589,10 @@ void TRACE_host_variable_sub (const char *host, const char *variable, double val /** \ingroup TRACE_user_variables * \brief Set the value of a variable of a host at a given timestamp. * - * Same as #TRACE_host_variable_set, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_host_variable_set, but let user specify the time used to trace it. Users can specify a time that + * is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param host The name of the host to be considered. @@ -668,12 +609,10 @@ void TRACE_host_variable_set_with_time (double time, const char *host, const cha /** \ingroup TRACE_user_variables * \brief Add a value to a variable of a host at a given timestamp. * - * Same as #TRACE_host_variable_add, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_host_variable_add, but let user specify the time used to trace it. Users can specify a time that + * is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param host The name of the host to be considered. @@ -690,12 +629,10 @@ void TRACE_host_variable_add_with_time (double time, const char *host, const cha /** \ingroup TRACE_user_variables * \brief Subtract a value from a variable of a host at a given timestamp. * - * Same as #TRACE_host_variable_sub, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_host_variable_sub, but let user specify the time used to trace it. Users can specify a time that + * is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param host The name of the host to be considered. @@ -712,8 +649,8 @@ void TRACE_host_variable_sub_with_time (double time, const char *host, const cha /** \ingroup TRACE_user_variables * \brief Get declared user host variables * - * This function should be used to get host variables that were already - * declared with #TRACE_host_variable_declare or with #TRACE_host_variable_declare_with_color. + * This function should be used to get host variables that were already declared with #TRACE_host_variable_declare or + * with #TRACE_host_variable_declare_with_color. * * \return A dynar with the declared host variables, must be freed with xbt_dynar_free. */ @@ -727,10 +664,8 @@ xbt_dynar_t TRACE_get_host_variables (void) * \brief Declare a new user variable associated to links. * * Declare a user variable that will be associated to links. - * A user link variable can be used, for example, to trace - * user variables such as the number of messages being - * transferred through network links. The color - * associated to this new variable will be random. + * A user link variable can be used, for example, to trace user variables such as the number of messages being + * transferred through network links. The color associated to this new variable will be random. * * \param variable The name of the new variable to be declared. * @@ -744,14 +679,12 @@ void TRACE_link_variable_declare (const char *variable) /** \ingroup TRACE_user_variables * \brief Declare a new user variable associated to links with a color. * - * Same as #TRACE_link_variable_declare, but associated a color - * to the newly created user link variable. The color needs to be - * a string with three numbers separated by spaces in the range [0,1]. + * Same as #TRACE_link_variable_declare, but associated a color to the newly created user link variable. 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. * * \param variable The name of the new variable to be declared. * \param color The color for the new variable. - * */ void TRACE_link_variable_declare_with_color (const char *variable, const char *color) { @@ -803,12 +736,10 @@ void TRACE_link_variable_sub (const char *link, const char *variable, double val /** \ingroup TRACE_user_variables * \brief Set the value of a variable of a link at a given timestamp. * - * Same as #TRACE_link_variable_set, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_link_variable_set, but let user specify the time used to trace it. Users can specify a time that + * is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param link The name of the link to be considered. @@ -825,12 +756,10 @@ void TRACE_link_variable_set_with_time (double time, const char *link, const cha /** \ingroup TRACE_user_variables * \brief Add a value to a variable of a link at a given timestamp. * - * Same as #TRACE_link_variable_add, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_link_variable_add, but let user specify the time used to trace it. Users can specify a time that + * is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param link The name of the link to be considered. @@ -847,12 +776,10 @@ void TRACE_link_variable_add_with_time (double time, const char *link, const cha /** \ingroup TRACE_user_variables * \brief Subtract a value from a variable of a link at a given timestamp. * - * Same as #TRACE_link_variable_sub, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_link_variable_sub, but let user specify the time used to trace it. Users can specify a time that + * is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param link The name of the link to be considered. @@ -870,10 +797,9 @@ void TRACE_link_variable_sub_with_time (double time, const char *link, const cha /** \ingroup TRACE_user_variables * \brief Set the value of the variable present in the links connecting source and destination. * - * Same as #TRACE_link_variable_set, but instead of providing the - * name of link to be considered, provide the source and destination - * hosts. All links that are part of the route between source and - * destination will have the variable set to the provided value. + * Same as #TRACE_link_variable_set, but instead of providing the name of link to be considered, provide the source + * and destination hosts. All links that are part of the route between source and destination will have the variable + * set to the provided value. * * \param src The name of the source host for get route. * \param dst The name of the destination host for get route. @@ -890,11 +816,9 @@ void TRACE_link_srcdst_variable_set (const char *src, const char *dst, const cha /** \ingroup TRACE_user_variables * \brief Add a value to the variable present in the links connecting source and destination. * - * Same as #TRACE_link_variable_add, but instead of providing the - * name of link to be considered, provide the source and destination - * hosts. All links that are part of the route between source and - * destination will have the value passed as parameter added to - * the current value of the variable name to be considered. + * Same as #TRACE_link_variable_add, but instead of providing the name of link to be considered, provide the source + * and destination hosts. All links that are part of the route between source and destination will have the value + * passed as parameter added to the current value of the variable name to be considered. * * \param src The name of the source host for get route. * \param dst The name of the destination host for get route. @@ -911,11 +835,9 @@ void TRACE_link_srcdst_variable_add (const char *src, const char *dst, const cha /** \ingroup TRACE_user_variables * \brief Subtract a value from the variable present in the links connecting source and destination. * - * Same as #TRACE_link_variable_sub, but instead of providing the - * name of link to be considered, provide the source and destination - * hosts. All links that are part of the route between source and - * destination will have the value passed as parameter subtracted from - * the current value of the variable name to be considered. + * Same as #TRACE_link_variable_sub, but instead of providing the name of link to be considered, provide the source + * and destination hosts. All links that are part of the route between source and destination will have the value + * passed as parameter subtracted from the current value of the variable name to be considered. * * \param src The name of the source host for get route. * \param dst The name of the destination host for get route. @@ -932,12 +854,10 @@ void TRACE_link_srcdst_variable_sub (const char *src, const char *dst, const cha /** \ingroup TRACE_user_variables * \brief Set the value of the variable present in the links connecting source and destination at a given timestamp. * - * Same as #TRACE_link_srcdst_variable_set, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_link_srcdst_variable_set, but let user specify the time used to trace it. Users can specify a time + * that is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param src The name of the source host for get route. @@ -947,7 +867,8 @@ void TRACE_link_srcdst_variable_sub (const char *src, const char *dst, const cha * * \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_add_with_time, TRACE_link_srcdst_variable_sub_with_time */ -void TRACE_link_srcdst_variable_set_with_time (double time, const char *src, const char *dst, const char *variable, double value) +void TRACE_link_srcdst_variable_set_with_time (double time, const char *src, const char *dst, const char *variable, + double value) { instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_SET); } @@ -955,12 +876,10 @@ void TRACE_link_srcdst_variable_set_with_time (double time, const char *src, con /** \ingroup TRACE_user_variables * \brief Add a value to the variable present in the links connecting source and destination at a given timestamp. * - * Same as #TRACE_link_srcdst_variable_add, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_link_srcdst_variable_add, but let user specify the time used to trace it. Users can specify a time + * that is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param src The name of the source host for get route. @@ -970,20 +889,19 @@ void TRACE_link_srcdst_variable_set_with_time (double time, const char *src, con * * \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_set_with_time, TRACE_link_srcdst_variable_sub_with_time */ -void TRACE_link_srcdst_variable_add_with_time (double time, const char *src, const char *dst, const char *variable, double value) +void TRACE_link_srcdst_variable_add_with_time (double time, const char *src, const char *dst, const char *variable, + double value) { instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_ADD); } /** \ingroup TRACE_user_variables - * \brief Subtract a value from the variable present in the links connecting source and destination at a given timestamp. + * \brief Subtract a value from the variable present in the links connecting source and dest. at a given timestamp. * - * Same as #TRACE_link_srcdst_variable_sub, but let user specify - * the time used to trace it. Users can specify a time that - * is not the simulated clock time as defined by the core - * simulator. This allows a fine-grain control of time - * definition, but should be used with caution since the trace - * can be inconsistent if resource utilization traces are also traced. + * Same as #TRACE_link_srcdst_variable_sub, but let user specify the time used to trace it. Users can specify a time + * that is not the simulated clock time as defined by the core simulator. This allows a fine-grain control of time + * definition, but should be used with caution since the trace can be inconsistent if resource utilization traces are + * also traced. * * \param time The timestamp to be used to tag this change of value. * \param src The name of the source host for get route. @@ -993,7 +911,8 @@ void TRACE_link_srcdst_variable_add_with_time (double time, const char *src, con * * \see TRACE_link_variable_declare, TRACE_link_srcdst_variable_set_with_time, TRACE_link_srcdst_variable_add_with_time */ -void TRACE_link_srcdst_variable_sub_with_time (double time, const char *src, const char *dst, const char *variable, double value) +void TRACE_link_srcdst_variable_sub_with_time (double time, const char *src, const char *dst, const char *variable, + double value) { instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_SUB); } @@ -1001,8 +920,8 @@ void TRACE_link_srcdst_variable_sub_with_time (double time, const char *src, con /** \ingroup TRACE_user_variables * \brief Get declared user link variables * - * This function should be used to get link variables that were already - * declared with #TRACE_link_variable_declare or with #TRACE_link_variable_declare_with_color. + * This function should be used to get link variables that were already declared with #TRACE_link_variable_declare or + * with #TRACE_link_variable_declare_with_color. * * \return A dynar with the declared link variables, must be freed with xbt_dynar_free. */ @@ -1029,8 +948,7 @@ void TRACE_host_state_declare (const char *state) /** \ingroup TRACE_user_variables * \brief Declare a new value for a user state associated to hosts. * - * Declare a value for a state. The color needs to be - * a string with three numbers separated by spaces in the range [0,1]. + * Declare a value for a state. The color needs to be a string with 3 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. * * \param state The name of the new state to be declared. @@ -1059,7 +977,7 @@ void TRACE_host_set_state (const char *host, const char *state, const char *valu { 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, user a NULL color */ + val_t val = PJ_value_get_or_new (value, NULL, type); /* if user didn't declare a value with a color, use NULL color */ new_pajeSetState(MSG_get_clock(), container, type, val); } @@ -1078,7 +996,7 @@ void TRACE_host_push_state (const char *host, const char *state, const char *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, user a NULL color */ + val_t val = PJ_value_get_or_new (value, NULL, type); /* if user didn't declare a value with a color, use NULL color */ new_pajePushState(MSG_get_clock(), container, type, val); } @@ -1119,9 +1037,8 @@ void TRACE_host_reset_state (const char *host, const char *state) /** \ingroup TRACE_API * \brief Get Paje container types that can be mapped to the nodes of a graph. * - * This function can be used to create a user made - * graph configuration file for Triva. Normally, it is - * used with the functions defined in \ref TRACE_user_variables. + * This function can be used to create a user made graph configuration file for Triva. Normally, it is used with the + * functions defined in \ref TRACE_user_variables. * * \return A dynar with the types, must be freed with xbt_dynar_free. */ @@ -1133,9 +1050,8 @@ xbt_dynar_t TRACE_get_node_types (void) /** \ingroup TRACE_API * \brief Get Paje container types that can be mapped to the edges of a graph. * - * This function can be used to create a user made - * graph configuration file for Triva. Normally, it is - * used with the functions defined in \ref TRACE_user_variables. + * This function can be used to create a user made graph configuration file for Triva. Normally, it is used with the + * functions defined in \ref TRACE_user_variables. * * \return A dynar with the types, must be freed with xbt_dynar_free. */ diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index cab67f4014..31f825e466 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -135,7 +135,6 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe if (newContainer->kind == INSTR_HOST || newContainer->kind == INSTR_LINK || newContainer->kind == INSTR_ROUTER) { xbt_dict_set (trivaNodeTypes, newContainer->type->name, xbt_strdup("1"), NULL); } - return newContainer; } diff --git a/src/instr/instr_paje_trace.cpp b/src/instr/instr_paje_trace.cpp index 2cce1065dd..8d586155a0 100644 --- a/src/instr/instr_paje_trace.cpp +++ b/src/instr/instr_paje_trace.cpp @@ -45,7 +45,8 @@ void TRACE_paje_start(void) XBT_DEBUG("Filename %s is open for writing", filename); /* output generator version */ - fprintf (tracing_file, "#This file was generated using SimGrid-%d.%d.%d\n", SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR, SIMGRID_VERSION_PATCH); + fprintf (tracing_file, "#This file was generated using SimGrid-%d.%d.%d\n", + SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR, SIMGRID_VERSION_PATCH); fprintf (tracing_file, "#["); unsigned int cpt; char *str; @@ -62,7 +63,6 @@ void TRACE_paje_start(void) /* output header */ TRACE_header(TRACE_basic(),TRACE_display_sizes()); - } void TRACE_paje_end(void) @@ -72,217 +72,152 @@ void TRACE_paje_end(void) XBT_DEBUG("Filename %s is closed", filename); } - void print_pajeDefineContainerType(paje_event_t event) { XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event->event_type); - fprintf(tracing_file, "%d %s %s %s\n", - (int)event->event_type, - ((defineContainerType_t)event->data)->type->id, - ((defineContainerType_t)event->data)->type->father->id, - ((defineContainerType_t)event->data)->type->name); + fprintf(tracing_file, "%d %s %s %s\n", (int)event->event_type, ((defineContainerType_t)event->data)->type->id, + ((defineContainerType_t)event->data)->type->father->id, ((defineContainerType_t)event->data)->type->name); } void print_pajeDefineVariableType(paje_event_t event) { XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event->event_type); - fprintf(tracing_file, "%d %s %s %s \"%s\"\n", - (int)event->event_type, - ((defineVariableType_t)event->data)->type->id, - ((defineVariableType_t)event->data)->type->father->id, - ((defineVariableType_t)event->data)->type->name, - ((defineVariableType_t)event->data)->type->color); + fprintf(tracing_file, "%d %s %s %s \"%s\"\n", (int)event->event_type, + ((defineVariableType_t)event->data)->type->id, ((defineVariableType_t)event->data)->type->father->id, + ((defineVariableType_t)event->data)->type->name, ((defineVariableType_t)event->data)->type->color); } void print_pajeDefineStateType(paje_event_t event) { XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event->event_type); - fprintf(tracing_file, "%d %s %s %s\n", - (int)event->event_type, - ((defineStateType_t)event->data)->type->id, - ((defineStateType_t)event->data)->type->father->id, - ((defineStateType_t)event->data)->type->name); + fprintf(tracing_file, "%d %s %s %s\n", (int)event->event_type, ((defineStateType_t)event->data)->type->id, + ((defineStateType_t)event->data)->type->father->id, ((defineStateType_t)event->data)->type->name); } void print_pajeDefineEventType(paje_event_t event) { XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event->event_type); - fprintf(tracing_file, "%d %s %s %s\n", - (int)event->event_type, - ((defineEventType_t)event->data)->type->id, - ((defineEventType_t)event->data)->type->father->id, - ((defineEventType_t)event->data)->type->name); + fprintf(tracing_file, "%d %s %s %s\n", (int)event->event_type, ((defineEventType_t)event->data)->type->id, + ((defineEventType_t)event->data)->type->father->id, ((defineEventType_t)event->data)->type->name); } void print_pajeDefineLinkType(paje_event_t event) { XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event->event_type); - fprintf(tracing_file, "%d %s %s %s %s %s\n", - (int)event->event_type, - ((defineLinkType_t)event->data)->type->id, - ((defineLinkType_t)event->data)->type->father->id, - ((defineLinkType_t)event->data)->source->id, - ((defineLinkType_t)event->data)->dest->id, - ((defineLinkType_t)event->data)->type->name); + fprintf(tracing_file, "%d %s %s %s %s %s\n", (int)event->event_type, ((defineLinkType_t)event->data)->type->id, + ((defineLinkType_t)event->data)->type->father->id, ((defineLinkType_t)event->data)->source->id, + ((defineLinkType_t)event->data)->dest->id, ((defineLinkType_t)event->data)->type->name); } void print_pajeDefineEntityValue (paje_event_t event) { XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event->event_type); - fprintf(tracing_file, "%d %s %s %s \"%s\"\n", - (int)event->event_type, - ((defineEntityValue_t)event->data)->value->id, - ((defineEntityValue_t)event->data)->value->father->id, - ((defineEntityValue_t)event->data)->value->name, + fprintf(tracing_file, "%d %s %s %s \"%s\"\n", (int)event->event_type, ((defineEntityValue_t)event->data)->value->id, + ((defineEntityValue_t)event->data)->value->father->id, ((defineEntityValue_t)event->data)->value->name, ((defineEntityValue_t)event->data)->value->color); } void print_pajeCreateContainer(paje_event_t event) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s %s \"%s\"\n", - (int)event->event_type, - ((createContainer_t)event->data)->container->id, - ((createContainer_t)event->data)->container->type->id, - ((createContainer_t)event->data)->container->father->id, - ((createContainer_t)event->data)->container->name); + fprintf(tracing_file, "%d 0 %s %s %s \"%s\"\n", (int)event->event_type, + ((createContainer_t)event->data)->container->id, ((createContainer_t)event->data)->container->type->id, + ((createContainer_t)event->data)->container->father->id, ((createContainer_t)event->data)->container->name); }else{ - fprintf(tracing_file, "%d %.*f %s %s %s \"%s\"\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((createContainer_t)event->data)->container->id, - ((createContainer_t)event->data)->container->type->id, - ((createContainer_t)event->data)->container->father->id, - ((createContainer_t)event->data)->container->name); + fprintf(tracing_file, "%d %.*f %s %s %s \"%s\"\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((createContainer_t)event->data)->container->id, ((createContainer_t)event->data)->container->type->id, + ((createContainer_t)event->data)->container->father->id, ((createContainer_t)event->data)->container->name); } } void print_pajeDestroyContainer(paje_event_t event) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s\n", - (int)event->event_type, - ((destroyContainer_t)event->data)->container->type->id, - ((destroyContainer_t)event->data)->container->id); + fprintf(tracing_file, "%d 0 %s %s\n", (int)event->event_type, + ((destroyContainer_t)event->data)->container->type->id, ((destroyContainer_t)event->data)->container->id); }else{ - fprintf(tracing_file, "%d %.*f %s %s\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((destroyContainer_t)event->data)->container->type->id, - ((destroyContainer_t)event->data)->container->id); + fprintf(tracing_file, "%d %.*f %s %s\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((destroyContainer_t)event->data)->container->type->id, ((destroyContainer_t)event->data)->container->id); } } void print_pajeSetVariable(paje_event_t event) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s %f\n", - (int)event->event_type, - ((setVariable_t)event->data)->type->id, - ((setVariable_t)event->data)->container->id, - ((setVariable_t)event->data)->value); + fprintf(tracing_file, "%d 0 %s %s %f\n", (int)event->event_type, ((setVariable_t)event->data)->type->id, + ((setVariable_t)event->data)->container->id, ((setVariable_t)event->data)->value); }else{ - fprintf(tracing_file, "%d %.*f %s %s %f\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((setVariable_t)event->data)->type->id, - ((setVariable_t)event->data)->container->id, + fprintf(tracing_file, "%d %.*f %s %s %f\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((setVariable_t)event->data)->type->id, ((setVariable_t)event->data)->container->id, ((setVariable_t)event->data)->value); } } void print_pajeAddVariable(paje_event_t event) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s %f\n", - (int)event->event_type, - ((addVariable_t)event->data)->type->id, - ((addVariable_t)event->data)->container->id, - ((addVariable_t)event->data)->value); + fprintf(tracing_file, "%d 0 %s %s %f\n", (int)event->event_type, ((addVariable_t)event->data)->type->id, + ((addVariable_t)event->data)->container->id, ((addVariable_t)event->data)->value); }else{ - fprintf(tracing_file, "%d %.*f %s %s %f\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((addVariable_t)event->data)->type->id, - ((addVariable_t)event->data)->container->id, + fprintf(tracing_file, "%d %.*f %s %s %f\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((addVariable_t)event->data)->type->id, ((addVariable_t)event->data)->container->id, ((addVariable_t)event->data)->value); } } void print_pajeSubVariable(paje_event_t event) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s %f\n", - (int)event->event_type, - ((subVariable_t)event->data)->type->id, - ((subVariable_t)event->data)->container->id, - ((subVariable_t)event->data)->value); + fprintf(tracing_file, "%d 0 %s %s %f\n", (int)event->event_type, ((subVariable_t)event->data)->type->id, + ((subVariable_t)event->data)->container->id, ((subVariable_t)event->data)->value); }else{ - fprintf(tracing_file, "%d %.*f %s %s %f\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((subVariable_t)event->data)->type->id, - ((subVariable_t)event->data)->container->id, + fprintf(tracing_file, "%d %.*f %s %s %f\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((subVariable_t)event->data)->type->id, ((subVariable_t)event->data)->container->id, ((subVariable_t)event->data)->value); } } void print_pajeSetState(paje_event_t event) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s %s\n", - (int)event->event_type, - ((setState_t)event->data)->type->id, - ((setState_t)event->data)->container->id, - ((setState_t)event->data)->value->id); + fprintf(tracing_file, "%d 0 %s %s %s\n", (int)event->event_type, ((setState_t)event->data)->type->id, + ((setState_t)event->data)->container->id, ((setState_t)event->data)->value->id); }else{ - fprintf(tracing_file, "%d %.*f %s %s %s\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((setState_t)event->data)->type->id, - ((setState_t)event->data)->container->id, + fprintf(tracing_file, "%d %.*f %s %s %s\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((setState_t)event->data)->type->id, ((setState_t)event->data)->container->id, ((setState_t)event->data)->value->id); } } void print_pajePushState(paje_event_t event) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (!TRACE_display_sizes()){ if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s %s\n", - (int)event->event_type, - ((pushState_t)event->data)->type->id, - ((pushState_t)event->data)->container->id, - ((pushState_t)event->data)->value->id); + fprintf(tracing_file, "%d 0 %s %s %s\n", (int)event->event_type, ((pushState_t)event->data)->type->id, + ((pushState_t)event->data)->container->id, ((pushState_t)event->data)->value->id); }else{ - fprintf(tracing_file, "%d %.*f %s %s %s\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((pushState_t)event->data)->type->id, - ((pushState_t)event->data)->container->id, + fprintf(tracing_file, "%d %.*f %s %s %s\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((pushState_t)event->data)->type->id, ((pushState_t)event->data)->container->id, ((pushState_t)event->data)->value->id); } }else{ if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s %s ", - (int)event->event_type, - ((pushState_t)event->data)->type->id, - ((pushState_t)event->data)->container->id, - ((pushState_t)event->data)->value->id); + fprintf(tracing_file, "%d 0 %s %s %s ", (int)event->event_type, ((pushState_t)event->data)->type->id, + ((pushState_t)event->data)->container->id, ((pushState_t)event->data)->value->id); if(((pushState_t)event->data)->extra !=NULL){ fprintf(tracing_file, "%d ", ((instr_extra_data)((pushState_t)event->data)->extra)->send_size); }else{ @@ -291,12 +226,8 @@ void print_pajePushState(paje_event_t event) fprintf(tracing_file, "\n"); }else{ - fprintf(tracing_file, "%d %.*f %s %s %s ", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((pushState_t)event->data)->type->id, - ((pushState_t)event->data)->container->id, + fprintf(tracing_file, "%d %.*f %s %s %s ", (int)event->event_type, TRACE_precision(), event->timestamp, + ((pushState_t)event->data)->type->id, ((pushState_t)event->data)->container->id, ((pushState_t)event->data)->value->id); if(((pushState_t)event->data)->extra !=NULL){ fprintf(tracing_file, "%d ", ((instr_extra_data)((pushState_t)event->data)->extra)->send_size); @@ -304,7 +235,6 @@ void print_pajePushState(paje_event_t event) fprintf(tracing_file, "0 "); } fprintf(tracing_file, "\n"); - } } if(((pushState_t)event->data)->extra!=NULL){ @@ -318,37 +248,27 @@ void print_pajePushState(paje_event_t event) void print_pajePopState(paje_event_t event) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s\n", - (int)event->event_type, - ((popState_t)event->data)->type->id, + fprintf(tracing_file, "%d 0 %s %s\n", (int)event->event_type, ((popState_t)event->data)->type->id, ((popState_t)event->data)->container->id); }else{ - fprintf(tracing_file, "%d %.*f %s %s\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((popState_t)event->data)->type->id, - ((popState_t)event->data)->container->id); + fprintf(tracing_file, "%d %.*f %s %s\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((popState_t)event->data)->type->id, ((popState_t)event->data)->container->id); } } void print_pajeResetState(paje_event_t event) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s\n", - (int)event->event_type, - ((resetState_t)event->data)->type->id, + fprintf(tracing_file, "%d 0 %s %s\n", (int)event->event_type, ((resetState_t)event->data)->type->id, ((resetState_t)event->data)->container->id); }else{ - fprintf(tracing_file, "%d %.*f %s %s\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((resetState_t)event->data)->type->id, - ((resetState_t)event->data)->container->id); + fprintf(tracing_file, "%d %.*f %s %s\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((resetState_t)event->data)->type->id, ((resetState_t)event->data)->container->id); } } @@ -356,90 +276,57 @@ void print_pajeStartLink(paje_event_t event) { if (!TRACE_display_sizes()){ if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s %s %s %s\n", - (int)event->event_type, - ((startLink_t)event->data)->type->id, - ((startLink_t)event->data)->container->id, - ((startLink_t)event->data)->value, - ((startLink_t)event->data)->sourceContainer->id, - ((startLink_t)event->data)->key); + fprintf(tracing_file, "%d 0 %s %s %s %s %s\n", (int)event->event_type, ((startLink_t)event->data)->type->id, + ((startLink_t)event->data)->container->id, ((startLink_t)event->data)->value, + ((startLink_t)event->data)->sourceContainer->id, ((startLink_t)event->data)->key); }else { - fprintf(tracing_file, "%d %.*f %s %s %s %s %s\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((startLink_t)event->data)->type->id, - ((startLink_t)event->data)->container->id, - ((startLink_t)event->data)->value, - ((startLink_t)event->data)->sourceContainer->id, + fprintf(tracing_file, "%d %.*f %s %s %s %s %s\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((startLink_t)event->data)->type->id, ((startLink_t)event->data)->container->id, + ((startLink_t)event->data)->value, ((startLink_t)event->data)->sourceContainer->id, ((startLink_t)event->data)->key); } }else{ - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s %s %s %s %d\n", - (int)event->event_type, - ((startLink_t)event->data)->type->id, - ((startLink_t)event->data)->container->id, - ((startLink_t)event->data)->value, - ((startLink_t)event->data)->sourceContainer->id, - ((startLink_t)event->data)->key, + fprintf(tracing_file, "%d 0 %s %s %s %s %s %d\n", (int)event->event_type, ((startLink_t)event->data)->type->id, + ((startLink_t)event->data)->container->id, ((startLink_t)event->data)->value, + ((startLink_t)event->data)->sourceContainer->id, ((startLink_t)event->data)->key, ((startLink_t)event->data)->size); }else { - fprintf(tracing_file, "%d %.*f %s %s %s %s %s %d\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((startLink_t)event->data)->type->id, - ((startLink_t)event->data)->container->id, - ((startLink_t)event->data)->value, - ((startLink_t)event->data)->sourceContainer->id, - ((startLink_t)event->data)->key, - ((startLink_t)event->data)->size); + fprintf(tracing_file, "%d %.*f %s %s %s %s %s %d\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((startLink_t)event->data)->type->id, ((startLink_t)event->data)->container->id, + ((startLink_t)event->data)->value, ((startLink_t)event->data)->sourceContainer->id, + ((startLink_t)event->data)->key, ((startLink_t)event->data)->size); } } } void print_pajeEndLink(paje_event_t event) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s %s %s %s\n", - (int)event->event_type, - ((endLink_t)event->data)->type->id, - ((endLink_t)event->data)->container->id, - ((endLink_t)event->data)->value, - ((endLink_t)event->data)->destContainer->id, - ((endLink_t)event->data)->key); + fprintf(tracing_file, "%d 0 %s %s %s %s %s\n", (int)event->event_type, ((endLink_t)event->data)->type->id, + ((endLink_t)event->data)->container->id, ((endLink_t)event->data)->value, + ((endLink_t)event->data)->destContainer->id, ((endLink_t)event->data)->key); }else { - fprintf(tracing_file, "%d %.*f %s %s %s %s %s\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((endLink_t)event->data)->type->id, - ((endLink_t)event->data)->container->id, - ((endLink_t)event->data)->value, - ((endLink_t)event->data)->destContainer->id, - ((endLink_t)event->data)->key); + fprintf(tracing_file, "%d %.*f %s %s %s %s %s\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((endLink_t)event->data)->type->id, ((endLink_t)event->data)->container->id, ((endLink_t)event->data)->value, + ((endLink_t)event->data)->destContainer->id, ((endLink_t)event->data)->key); } } void print_pajeNewEvent (paje_event_t event) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), event->timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(), + event->timestamp); if (event->timestamp == 0){ - fprintf(tracing_file, "%d 0 %s %s %s\n", - (int)event->event_type, - ((newEvent_t)event->data)->type->id, - ((newEvent_t)event->data)->container->id, - ((newEvent_t)event->data)->value->id); + fprintf(tracing_file, "%d 0 %s %s %s\n", (int)event->event_type, ((newEvent_t)event->data)->type->id, + ((newEvent_t)event->data)->container->id, ((newEvent_t)event->data)->value->id); }else{ - fprintf(tracing_file, "%d %.*f %s %s %s\n", - (int)event->event_type, - TRACE_precision(), - event->timestamp, - ((newEvent_t)event->data)->type->id, - ((newEvent_t)event->data)->container->id, + fprintf(tracing_file, "%d %.*f %s %s %s\n", (int)event->event_type, TRACE_precision(), event->timestamp, + ((newEvent_t)event->data)->type->id, ((newEvent_t)event->data)->container->id, ((newEvent_t)event->data)->value->id); } } diff --git a/src/instr/instr_paje_types.cpp b/src/instr/instr_paje_types.cpp index da248047b1..68ab4440a4 100644 --- a/src/instr/instr_paje_types.cpp +++ b/src/instr/instr_paje_types.cpp @@ -176,7 +176,8 @@ type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t 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); - 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); + 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); return ret; } diff --git a/src/instr/instr_paje_values.cpp b/src/instr/instr_paje_values.cpp index a45729b49c..50de8f8183 100644 --- a/src/instr/instr_paje_values.cpp +++ b/src/instr/instr_paje_values.cpp @@ -50,13 +50,10 @@ val_t PJ_value_get (const char *name, type_t father) } if (father->kind == TYPE_VARIABLE) - THROWF(tracing_error, 0, - "variables can't have different values (%s)", father->name); + 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) { - THROWF(tracing_error, 2, - "value with name (%s) not found in father type (%s)", - name, father->name); + THROWF(tracing_error, 2, "value with name (%s) not found in father type (%s)", name, father->name); } return ret; } diff --git a/src/instr/instr_private.h b/src/instr/instr_private.h index c9aeb64f89..c004b99634 100644 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@ -255,12 +255,16 @@ XBT_PUBLIC(void) new_pajeAddVariable (double timestamp, container_t container, t XBT_PUBLIC(void) new_pajeSubVariable (double timestamp, container_t container, type_t type, double value); XBT_PUBLIC(void) new_pajeSetState (double timestamp, container_t container, type_t type, val_t value); XBT_PUBLIC(void) new_pajePushState (double timestamp, container_t container, type_t type, val_t value); -XBT_PUBLIC(void) new_pajePushStateWithExtra (double timestamp, container_t container, type_t type, val_t value, void* extra); +XBT_PUBLIC(void) new_pajePushStateWithExtra (double timestamp, container_t container, type_t type, val_t value, + void* extra); XBT_PUBLIC(void) new_pajePopState (double timestamp, container_t container, type_t type); XBT_PUBLIC(void) new_pajeResetState (double timestamp, container_t container, type_t type); -XBT_PUBLIC(void) new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key); -XBT_PUBLIC(void) new_pajeStartLinkWithSize (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key, int size); -XBT_PUBLIC(void) new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, const char *value, const char *key); +XBT_PUBLIC(void) new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, + const char *value, const char *key); +XBT_PUBLIC(void) new_pajeStartLinkWithSize (double timestamp, container_t container, type_t type, + container_t sourceContainer, const char *value, const char *key, int size); +XBT_PUBLIC(void) new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, + const char *value, const char *key); XBT_PUBLIC(void) new_pajeNewEvent (double timestamp, container_t container, type_t type, val_t value); /* from instr_config.c */ @@ -299,15 +303,9 @@ XBT_PUBLIC(int) TRACE_smpi_is_sleeping(void); XBT_PUBLIC(int) TRACE_smpi_view_internals(void); /* from resource_utilization.c */ -XBT_PRIVATE void TRACE_surf_host_set_utilization(const char *resource, - const char *category, - double value, - double now, +XBT_PRIVATE void TRACE_surf_host_set_utilization(const char *resource, const char *category, double value, double now, double delta); -XBT_PRIVATE void TRACE_surf_link_set_utilization(const char *resource, - const char *category, - double value, - double now, +XBT_PRIVATE void TRACE_surf_link_set_utilization(const char *resource,const char *category, double value, double now, double delta); XBT_PUBLIC(void) TRACE_surf_resource_utilization_alloc(void); @@ -377,9 +375,6 @@ XBT_PRIVATE void TRACE_paje_dump_buffer (int force); XBT_PRIVATE void dump_comment_file (const char *filename); XBT_PRIVATE void dump_comment (const char *comment); - - - typedef struct instr_trace_writer { void (*print_DefineContainerType) (paje_event_t event); void (*print_DefineVariableType)(paje_event_t event); @@ -401,12 +396,9 @@ typedef struct instr_trace_writer { void (*print_NewEvent) (paje_event_t event); } s_instr_trace_writer_t; - - struct s_instr_extra_data; typedef struct s_instr_extra_data *instr_extra_data; - typedef enum{ TRACING_INIT, TRACING_FINALIZE, @@ -443,8 +435,6 @@ typedef enum{ TRACING_EXSCAN } e_caller_type ; - - typedef struct s_instr_extra_data { e_caller_type type; int send_size; diff --git a/src/instr/instr_resource_utilization.cpp b/src/instr/instr_resource_utilization.cpp index 33d13c02ac..42012ec37f 100644 --- a/src/instr/instr_resource_utilization.cpp +++ b/src/instr/instr_resource_utilization.cpp @@ -12,15 +12,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_resource, instr, "tracing (un)-categorize static xbt_dict_t platform_variables; //used by all methods -static void __TRACE_surf_check_variable_set_to_zero(double now, - const char *variable, - const char *resource) +static void __TRACE_surf_check_variable_set_to_zero(double now, const char *variable, const char *resource) { - /* - * To trace resource utilization, we use pajeAddVariable and pajeSubVariable only. - * The Paje simulator needs a pajeSetVariable in the first place so it knows - * the initial value of all variables for subsequent adds/subs. If we don't do - * so, the first pajeAddVariable is added to a non-determined value within + /* To trace resource utilization, we use pajeAddVariable and pajeSubVariable only. + * The Paje simulator needs a pajeSetVariable in the first place so it knows the initial value of all variables for + * subsequent adds/subs. If we don't do so, the first pajeAddVariable is added to a non-determined value within * the Paje simulator, causing analysis problems. */ @@ -46,14 +42,8 @@ static void instr_event (double now, double delta, type_t variable, container_t new_pajeSubVariable(now + delta, resource, variable, value); } -/* - * TRACE_surf_link_set_utilization: entry point from SimGrid - */ -void TRACE_surf_link_set_utilization(const char *resource, - const char *category, - double value, - double now, - double delta) +/* TRACE_surf_link_set_utilization: entry point from SimGrid */ +void TRACE_surf_link_set_utilization(const char *resource, const char *category, double value, double now, double delta) { //only trace link utilization if link is known by tracing mechanism if (!PJ_container_get_or_null(resource)) @@ -84,14 +74,8 @@ void TRACE_surf_link_set_utilization(const char *resource, return; } -/* - * TRACE_surf_host_set_utilization: entry point from SimGrid - */ -void TRACE_surf_host_set_utilization(const char *resource, - const char *category, - double value, - double now, - double delta) +/* TRACE_surf_host_set_utilization: entry point from SimGrid */ +void TRACE_surf_host_set_utilization(const char *resource, const char *category, double value, double now, double delta) { //only trace host utilization if host is known by tracing mechanism container_t container = PJ_container_get_or_null(resource); diff --git a/src/instr/instr_trace.cpp b/src/instr/instr_trace.cpp index 69fdf0329e..615e3249c5 100644 --- a/src/instr/instr_trace.cpp +++ b/src/instr/instr_trace.cpp @@ -9,7 +9,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_trace, instr, "tracing event system"); - FILE *tracing_file = NULL; void print_NULL(paje_event_t event){} @@ -118,11 +117,9 @@ static void insert_into_buffer (paje_event_t tbi) if (i == 0) XBT_DEBUG("%s: inserted at beginning", __FUNCTION__); else - XBT_DEBUG("%s: inserted at%s %u", __FUNCTION__, - (i == xbt_dynar_length(buffer) - 1 ? " end, pos =" : ""), i); + XBT_DEBUG("%s: inserted at%s %u", __FUNCTION__, (i == xbt_dynar_length(buffer) - 1 ? " end, pos =" : ""), i); } - static void free_paje_event (paje_event_t event) { XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event->event_type, event->timestamp); @@ -418,7 +415,8 @@ void new_pajeResetState (double timestamp, container_t container, type_t type) insert_into_buffer (event); } -void new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key) +void new_pajeStartLink (double timestamp, container_t container, type_t type, container_t sourceContainer, + const char *value, const char *key) { paje_event_t event = xbt_new0(s_paje_event_t, 1); event->event_type = PAJE_StartLink; @@ -437,7 +435,8 @@ void new_pajeStartLink (double timestamp, container_t container, type_t type, co insert_into_buffer (event); } -void new_pajeStartLinkWithSize (double timestamp, container_t container, type_t type, container_t sourceContainer, const char *value, const char *key, int size) +void new_pajeStartLinkWithSize (double timestamp, container_t container, type_t type, container_t sourceContainer, + const char *value, const char *key, int size) { paje_event_t event = xbt_new0(s_paje_event_t, 1); event->event_type = PAJE_StartLink; @@ -457,7 +456,8 @@ void new_pajeStartLinkWithSize (double timestamp, container_t container, type_t insert_into_buffer (event); } -void new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, const char *value, const char *key) +void new_pajeEndLink (double timestamp, container_t container, type_t type, container_t destContainer, + const char *value, const char *key) { paje_event_t event = xbt_new0(s_paje_event_t, 1); event->event_type = PAJE_EndLink; diff --git a/src/instr/jedule/jedule_events.cpp b/src/instr/jedule/jedule_events.cpp index 12572e325a..3578ec7524 100644 --- a/src/instr/jedule/jedule_events.cpp +++ b/src/instr/jedule/jedule_events.cpp @@ -37,7 +37,6 @@ void jed_event_add_characteristic(jed_event_t event, char *characteristic) { xbt_dynar_push(event->characteristics_list, &characteristic); } - void jed_event_add_info(jed_event_t event, char *key, char *value) { char *val_cp; @@ -48,7 +47,6 @@ void jed_event_add_info(jed_event_t event, char *key, char *value) { xbt_dict_set(event->info_hash, key, val_cp, NULL); } - void create_jed_event(jed_event_t *event, char *name, double start_time, double end_time, const char *type) { @@ -63,12 +61,9 @@ void create_jed_event(jed_event_t *event, char *name, double start_time, (*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); - } - void jed_event_free(jed_event_t event) { - free(event->name); free(event->type); @@ -79,5 +74,4 @@ void jed_event_free(jed_event_t event) { free(event); } - #endif diff --git a/src/instr/jedule/jedule_output.cpp b/src/instr/jedule/jedule_output.cpp index 1bac445f37..fa047a51c8 100644 --- a/src/instr/jedule/jedule_output.cpp +++ b/src/instr/jedule/jedule_output.cpp @@ -15,29 +15,13 @@ #ifdef HAVE_JEDULE -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_out, jedule, - "Logging specific to Jedule output"); - -/*********************************************************/ +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jed_out, jedule, "Logging specific to Jedule output"); xbt_dynar_t jedule_event_list; static FILE *jed_file; -static void print_platform(jed_simgrid_container_t root_container); -static void print_container(jed_simgrid_container_t container); -static void print_resources(jed_simgrid_container_t resource_parent); -static void print_key_value_dict(xbt_dict_t meta_info_dict); -static void print_events(xbt_dynar_t event_list); -static void get_hierarchy_list(xbt_dynar_t hier_list, - jed_simgrid_container_t container); - -/*********************************************************/ - - -static void get_hierarchy_list(xbt_dynar_t hier_list, - jed_simgrid_container_t container) { - +static void get_hierarchy_list(xbt_dynar_t hier_list, jed_simgrid_container_t container) { xbt_assert( container != NULL ); if( container->parent != NULL ) { @@ -45,14 +29,12 @@ static void get_hierarchy_list(xbt_dynar_t hier_list, if( container->parent->container_children == NULL ) { // we are in the last level get_hierarchy_list(hier_list, container->parent); - } else { unsigned int i; int child_nb = -1; jed_simgrid_container_t child_container; - xbt_dynar_foreach(container->parent->container_children, i, - child_container) { + xbt_dynar_foreach(container->parent->container_children, i, child_container) { if( child_container == container ) { child_nb = i; break; @@ -60,7 +42,6 @@ static void get_hierarchy_list(xbt_dynar_t hier_list, } xbt_assert( child_nb > - 1); - xbt_dynar_insert_at(hier_list, 0, &child_nb); get_hierarchy_list(hier_list, container->parent); @@ -69,23 +50,21 @@ static void get_hierarchy_list(xbt_dynar_t hier_list, int top_level = 0; xbt_dynar_insert_at(hier_list, 0, &top_level); } - } -static void get_hierarchy_string(jed_simgrid_container_t container, - char *outbuf) { +static void get_hierarchy_string(jed_simgrid_container_t container, char *outbuf) { char buf[1024]; xbt_dynar_t hier_list; unsigned int iter; int number; unsigned int length; - + outbuf[0] = '\0'; hier_list = xbt_dynar_new(sizeof(int), NULL); get_hierarchy_list(hier_list, container); - + length = xbt_dynar_length(hier_list); - + xbt_dynar_foreach(hier_list, iter, number) { if( iter != length-1 ) { sprintf(buf, "%d.", number); @@ -94,8 +73,8 @@ static void get_hierarchy_string(jed_simgrid_container_t container, } strcat(outbuf, buf); } - - xbt_dynar_free(&hier_list); + + xbt_dynar_free(&hier_list); } static void print_key_value_dict(xbt_dict_t key_value_dict) { @@ -134,8 +113,8 @@ static void print_resources(jed_simgrid_container_t resource_parent) { xbt_assert( resource_parent->resource_list != NULL ); res_nb = xbt_dynar_length(resource_parent->resource_list); - - get_hierarchy_string(resource_parent, resid); + + get_hierarchy_string(resource_parent, resid); fprintf(jed_file, " resource_list, i, res_name) { @@ -147,7 +126,6 @@ static void print_resources(jed_simgrid_container_t resource_parent) { fprintf(jed_file, "\" />\n"); } - static void print_platform(jed_simgrid_container_t root_container) { fprintf(jed_file, " \n"); print_container(root_container); @@ -158,46 +136,37 @@ static void print_event(jed_event_t event) { unsigned int i; jed_res_subset_t subset; - xbt_assert( event != NULL ); xbt_assert( event->resource_subsets != NULL ); fprintf(jed_file, " \n"); - fprintf(jed_file, " \n", event->name); - fprintf(jed_file, " \n", - event->start_time); - fprintf(jed_file, " \n", - event->end_time); + fprintf(jed_file, " \n", event->start_time); + fprintf(jed_file, " \n", event->end_time); fprintf(jed_file, " \n", event->type); fprintf(jed_file, " \n"); xbt_dynar_foreach(event->resource_subsets, i, subset) { - int start = subset->start_idx; int end = subset->start_idx + subset->nres - 1; char resid[1024]; get_hierarchy_string(subset->parent, resid); - fprintf(jed_file, "