ErrorStack TpccLoadTask::run(thread::Thread* context) { context_ = context; engine_ = context->get_engine(); xct_manager_ = engine_->get_xct_manager(); load_threads_ = engine_->get_options().thread_.get_total_thread_count(); thread_ordinal_ = context->get_thread_global_ordinal(); ASSERT_ND(thread_ordinal_ < load_threads_); rnd_.set_current_seed(thread_ordinal_); LOG(INFO) << "Load Thread-" << thread_ordinal_ << " start"; debugging::StopWatch watch; CHECK_ERROR(load_customers()); watch.stop(); LOG(INFO) << "Load-Thread-" << thread_ordinal_ << " done in " << watch.elapsed_sec() << "sec"; return kRetOk; }
bool load_instance(Data* data_p, std::string const& file_p) { LOG(INFO) << "Loading Instance inside the data structure : " << file_p; // VLOG(2) << "Found cookies in DEBUG"; VLOG(1) << "Openning the file"; std::ifstream file_stream_l(file_p); // get length of file: file_stream_l.seekg (0, file_stream_l.end); int length = file_stream_l.tellg(); file_stream_l.seekg (0, file_stream_l.beg); VLOG(1) << "The length of file is : " << length; VLOG(1) << "Reading the file"; char * buffer = new char [length]; file_stream_l.read (buffer,length); if (file_stream_l) VLOG(1) << "All characters read successfully."; else LOG(FATAL) << "Error : only " << file_stream_l.gcount() << " could be read"; file_stream_l.close(); VLOG(1) << "Parsing the file"; rapidxml::xml_document<> doc; // character type defaults to char doc.parse<0>(buffer); // 0 means default parse flags VLOG(1) << "Extracting Data"; rapidxml::xml_node<> *root = doc.first_node(); // Node IRP_R_C_I /** Extraction of the tree ! */ // Unit rapidxml::xml_node<> *child_l = root->first_node(); check_name(child_l,"unit"); data_p->unit(std::stoi(child_l->value())); VLOG(1) << "Unit = " << data_p->unit(); // Horizon child_l = child_l->next_sibling(); check_name(child_l,"horizon"); data_p->horizon(std::stoi(child_l->value())); VLOG(1) << "Horizon = " << data_p->horizon(); // Time Matrices child_l = child_l->next_sibling(); check_name(child_l,"timeMatrices"); int size_time_matrices = load_time_matrices(data_p, child_l); VLOG(1) << "Time Matrix loaded of size = " << size_time_matrices; // Drivers child_l = child_l->next_sibling(); check_name(child_l,"drivers"); int num_drivers = load_drivers(data_p, child_l); VLOG(1) << "Vector of driverd loaded of size = " << num_drivers; // Trailers child_l = child_l->next_sibling(); check_name(child_l,"trailers"); int num_trailers = load_trailers(data_p, child_l); VLOG(1) << "Vector of trailers loaded of size = " << num_trailers; // Bases child_l = child_l->next_sibling(); check_name(child_l,"bases"); data_p->bases_index(std::stoi(child_l->first_node()->value())); VLOG(1) << "bases = " << data_p->bases_index(); // Sources child_l = child_l->next_sibling(); check_name(child_l,"sources"); int num_sources = load_sources(data_p, child_l); VLOG(1) << "Vector of sources loaded of size = " << num_sources; // Customers child_l = child_l->next_sibling(); check_name(child_l,"customers"); int num_customers = load_customers(data_p, child_l); VLOG(1) << "Vector of customers loaded of size = " << num_customers; // Time Matrices child_l = child_l->next_sibling(); check_name(child_l,"distMatrices"); int size_dist_matrices = load_dist_matrices(data_p, child_l); VLOG(1) << "Dist Matrix loaded of size = " << size_dist_matrices; // Clearing memory space delete[] buffer; return true; }
ErrorStack TpccLoadTask::load_tables() { CHECK_ERROR(load_customers()); CHECK_ERROR(load_orders_data()); return kRetOk; }