#include "simgrid/s4u/Engine.hpp"
#include "src/instr/instr_private.hpp"
#include "surf/surf.hpp"
+#include "xbt/virtu.h" /* sg_cmdline */
#include <string>
#include <vector>
XBT_LOG_NEW_CATEGORY(instr, "Logging the behavior of the tracing system (used for Visualization/Analysis of simulations)");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_config, instr, "Configuration");
+extern FILE* tracing_file;
+
#define OPT_TRACING_BASIC "tracing/basic"
#define OPT_TRACING_BUFFER "tracing/buffer"
#define OPT_TRACING_CATEGORIZED "tracing/categorized"
XBT_DEBUG("Tracing starts");
/* init the tracing module to generate the right output */
-
- /* open the trace file(s) */
std::string format = simgrid::config::get_value<std::string>(OPT_TRACING_FORMAT);
XBT_DEBUG("Tracing format %s", format.c_str());
+
+ /* open the trace file(s) */
+ std::string filename = TRACE_get_filename();
+ tracing_file = fopen(filename.c_str(), "w");
+ if (tracing_file == nullptr) {
+ THROWF(system_error, 1, "Tracefile %s could not be opened for writing.", filename.c_str());
+ }
+
+ XBT_DEBUG("Filename %s is open for writing", filename.c_str());
+
if (format == "Paje") {
- TRACE_paje_start();
- } else if (format == "TI") {
- simgrid::instr::trace_format = simgrid::instr::TraceFormat::Ti;
- TRACE_TI_start();
- }else{
- xbt_die("Unknown trace format :%s ", format.c_str());
+ /* 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, "#[");
+ unsigned int cpt;
+ char* str;
+ xbt_dynar_foreach (xbt_cmdline, cpt, str) {
+ fprintf(tracing_file, "%s ", str);
+ }
+ fprintf(tracing_file, "]\n");
}
+ /* output one line comment */
+ dump_comment(TRACE_get_comment());
+
+ /* output comment file */
+ dump_comment_file(TRACE_get_comment_file());
+
+ if (format == "Paje") {
+ /* output Pajé header */
+ TRACE_header(TRACE_basic(), TRACE_display_sizes());
+ } else
+ simgrid::instr::trace_format = simgrid::instr::TraceFormat::Ti;
+
trace_active = true;
XBT_DEBUG("Tracing is on");
}
delete root_type;
/* close the trace files */
- std::string format = simgrid::config::get_value<std::string>(OPT_TRACING_FORMAT);
- XBT_DEBUG("Tracing format %s\n", format.c_str());
- if (format == "Paje") {
- TRACE_paje_end();
- } else if (format == "TI") {
- TRACE_TI_end();
- } else {
- xbt_die("Unknown trace format :%s ", format.c_str());
- }
+ fclose(tracing_file);
+ XBT_DEBUG("Filename %s is closed", TRACE_get_filename().c_str());
/* de-activate trace */
trace_active = false;
#include "src/instr/instr_smpi.hpp"
#include "src/smpi/include/private.hpp"
#include "typeinfo"
-#include "xbt/virtu.h" /* sg_cmdline */
#include <fstream>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje_trace, instr, "tracing event system");
buffer_debug(&buffer);
}
-
-void TRACE_paje_start() {
- std::string filename = TRACE_get_filename();
- tracing_file = fopen(filename.c_str(), "w");
- if (tracing_file == nullptr){
- THROWF(system_error, 1, "Tracefile %s could not be opened for writing.", filename.c_str());
- }
-
- XBT_DEBUG("Filename %s is open for writing", filename.c_str());
-
- /* 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, "#[");
- unsigned int cpt;
- char *str;
- xbt_dynar_foreach (xbt_cmdline, cpt, str){
- fprintf(tracing_file, "%s ",str);
- }
- fprintf (tracing_file, "]\n");
-
- /* output one line comment */
- dump_comment (TRACE_get_comment());
-
- /* output comment file */
- dump_comment_file (TRACE_get_comment_file());
-
- /* output header */
- TRACE_header(TRACE_basic(),TRACE_display_sizes());
-}
-
-void TRACE_paje_end() {
- fclose(tracing_file);
- XBT_DEBUG("Filename %s is closed", TRACE_get_filename().c_str());
-}
-
-
-void TRACE_TI_start()
-{
- std::string filename = TRACE_get_filename();
- tracing_file = fopen(filename.c_str(), "w");
- if (tracing_file == nullptr) {
- THROWF(system_error, 1, "Tracefile %s could not be opened for writing.", filename.c_str());
- }
-
- XBT_DEBUG("Filename %s is open for writing", filename.c_str());
-
- /* output one line comment */
- dump_comment(TRACE_get_comment());
-
- /* output comment file */
- dump_comment_file(TRACE_get_comment_file());
-}
-
-void TRACE_TI_end()
-{
- fclose(tracing_file);
- XBT_DEBUG("Filename %s is closed", TRACE_get_filename().c_str());
-}
if (currentContainer.empty()) // No ongoing parsing. Are you creating the loopback?
return;
- container_t father = currentContainer.back();
- container_t container = new simgrid::instr::Container(link.get_name(), "LINK", father);
+ container_t container = new simgrid::instr::Container(link.get_name(), "LINK", currentContainer.back());
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_link())) {
simgrid::instr::VariableType* bandwidth = container->type_->getOrCreateVariableType("bandwidth", "");
/* instr_paje_header.c */
XBT_PRIVATE void TRACE_header(bool basic, int size);
-/* from paje.c */
-XBT_PRIVATE void TRACE_paje_start();
-XBT_PRIVATE void TRACE_paje_end();
-
/* from instr_config.c */
XBT_PRIVATE bool TRACE_needs_platform();
XBT_PRIVATE bool TRACE_is_enabled();
void instr_new_user_state_type(std::string father_type, std::string new_typename);
void instr_new_value_for_user_state_type(std::string new_typename, const char* value, std::string color);
-/* instr_config.c */
-XBT_PRIVATE void TRACE_TI_start();
-XBT_PRIVATE void TRACE_TI_end();
XBT_PRIVATE void TRACE_global_init();
XBT_PRIVATE void TRACE_help(int detailed);