void ruby_load_caches(char* name) { if (name == NULL) { cout << "Error: ruby_load_caches requires a file name" << endl; return; } cout << "Reading cache contents from '" << name << "'..."; int read = Tracer::playbackTrace(name); cout << "done. (" << read << " cache lines read)" << endl; ruby_clear_stats(); }
//************************************************************************** set_error_t ruby_session_set( void *id, conf_object_t *obj, attr_value_t *val, attr_value_t *idx ) { const char *command = (const char *) id; // Add new ruby commands to this function if (!strcmp(command, "dump-stats" ) ) { char* filename = (char*) val->u.string; if(strcmp(filename, "")){ ruby_dump_stats(filename); } else { ruby_dump_stats(NULL); } return Sim_Set_Ok; } else if (!strcmp(command, "dump-short-stats" ) ) { char* filename = (char*) val->u.string; if(strcmp(filename, "")){ ruby_dump_short_stats(filename); } else { ruby_dump_short_stats(NULL); } return Sim_Set_Ok; } else if (!strcmp(command, "periodic-stats-file" ) ) { char* filename = (char*) val->u.string; ruby_set_periodic_stats_file(filename); return Sim_Set_Ok; } else if (!strcmp(command, "periodic-stats-interval" ) ) { int interval = val->u.integer; ruby_set_periodic_stats_interval(interval); return Sim_Set_Ok; } else if (!strcmp(command, "clear-stats" ) ) { ruby_clear_stats(); return Sim_Set_Ok; } else if (!strcmp(command, "debug-verb" ) ) { char* new_verbosity = (char*) val->u.string; ruby_change_debug_verbosity(new_verbosity); return Sim_Set_Ok; } else if (!strcmp(command, "debug-filter" ) ) { char* new_debug_filter = (char*) val->u.string; ruby_change_debug_filter(new_debug_filter); return Sim_Set_Ok; } else if (!strcmp(command, "debug-output-file" ) ) { char* new_filename = (char*) val->u.string; ruby_set_debug_output_file(new_filename); return Sim_Set_Ok; } else if (!strcmp(command, "debug-start-time" ) ) { char* new_start_time = (char*) val->u.string; ruby_set_debug_start_time(new_start_time); return Sim_Set_Ok; } else if (!strcmp(command, "load-caches" ) ) { char* filename = (char*) val->u.string; ruby_load_caches(filename); return Sim_Set_Ok; } else if (!strcmp(command, "save-caches" ) ) { char* filename = (char*) val->u.string; ruby_save_caches(filename); return Sim_Set_Ok; } else if (!strcmp(command, "dump-cache" ) ) { int cpuNumber = val->u.integer; ruby_dump_cache(cpuNumber); return Sim_Set_Ok; } else if (!strcmp(command, "dump-cache-data" ) ) { int cpuNumber = val->u.list.vector[0].u.integer; char *filename = (char*) val->u.list.vector[1].u.string; ruby_dump_cache_data( cpuNumber, filename ); return Sim_Set_Ok; } else if (!strcmp(command, "tracer-output-file" ) ) { char* new_filename = (char*) val->u.string; ruby_set_tracer_output_file(new_filename); return Sim_Set_Ok; } else if (!strcmp(command, "xact-visualizer-file" ) ) { char* new_filename = (char*) val->u.string; ruby_xact_visualizer_file(new_filename); return Sim_Set_Ok; } else if (!strcmp(command, "print-temp" ) ) { ruby_print_temp(); return Sim_Set_Ok; }else if (!strcmp(command, "reset-temp" ) ) { ruby_reset_temp(); return Sim_Set_Ok; } else if (!strcmp(command, "print-reuse" ) ) { ruby_print_reuse(); return Sim_Set_Ok; } else if (!strcmp(command, "reset-reuse" ) ) { ruby_reset_reuse(); return Sim_Set_Ok; } fprintf( stderr, "error: unrecognized command: %s\n", command ); return Sim_Set_Illegal_Value; }