void tw_init(int *argc, char ***argv) { int i; #if HAVE_CTIME time_t raw_time; #endif tw_opt_add(tw_net_init(argc, argv)); // Print out the command-line so we know what we passed in if (tw_ismaster()) { for (i = 0; i < *argc; i++) { printf("%s ", (*argv)[i]); } printf("\n\n"); } // Print our revision if we have it #ifdef ROSS_VERSION if (tw_ismaster()) { #if HAVE_CTIME time(&raw_time); printf("%s\n", ctime(&raw_time)); #endif printf("ROSS Revision: %s\n\n", ROSS_VERSION); } #endif tw_opt_add(kernel_options); tw_opt_add(tw_gvt_setup()); tw_opt_add(tw_clock_setup()); #ifdef USE_RIO tw_opt_add(io_opts); #endif // by now all options must be in tw_opt_parse(argc, argv); if(tw_ismaster() && NULL == (g_tw_csv = fopen("ross.csv", "a"))) { tw_error(TW_LOC, "Unable to open: ross.csv\n"); } tw_opt_print(); tw_net_start(); tw_gvt_start(); }
void tw_init(int *argc, char ***argv) { int i; #if HAVE_CTIME time_t raw_time; #endif // setup trace file and print header information */ desTraceFile = fopen("desTraceFile.json", "w+"); fprintf(desTraceFile, "{\n\"simulator_name\" : \"ROSS Revision: %s ", ROSS_VERSION); fprintf(desTraceFile, "(github version, forked on on June 21, 2014)\",\n"); fprintf(desTraceFile, "\"model_name\" : \""); des_print_model_name(); fprintf(desTraceFile, "\",\n"); // capture the current date/timestamp time_t current_time; time(¤t_time); char *ascii_time = ctime(¤t_time); fprintf(desTraceFile, "\"capture_date\" : \"%.*s\",\n", strlen(ascii_time)-1, ascii_time); tw_opt_add(tw_net_init(argc, argv)); // capture command line arguments fprintf(desTraceFile, "\"command_line_arguments\" : \""); // Print out the command-line so we know what we passed in if (tw_ismaster()) { for (i = 0; i < *argc; i++) { printf("%s ", (*argv)[i]); // record command line arguments in desTraceFile fprintf(desTraceFile, " %s ", (*argv)[i]); } printf("\n"); } // setup entry for capturing events exchanged in the simulation. fprintf(desTraceFile,"\",\n\"events\" : ["); separator = " "; // Print our revision if we have it #ifdef ROSS_VERSION if (tw_ismaster()) { #if HAVE_CTIME time(&raw_time); printf("%s\n", ctime(&raw_time)); #endif printf("ROSS Revision: %s\n\n", ROSS_VERSION); } #endif tw_opt_add(kernel_options); tw_opt_add(tw_gvt_setup()); tw_opt_add(tw_clock_setup()); // by now all options must be in tw_opt_parse(argc, argv); if(tw_ismaster() && NULL == (g_tw_csv = fopen("ross.csv", "a"))) tw_error(TW_LOC, "Unable to open: ross.csv\n"); tw_opt_print(); tw_net_start(); tw_gvt_start(); //tw_register_signals(); }