本文整理汇总了C++中OperatingSystem::set_progress_meter_granularity方法的典型用法代码示例。如果您正苦于以下问题:C++ OperatingSystem::set_progress_meter_granularity方法的具体用法?C++ OperatingSystem::set_progress_meter_granularity怎么用?C++ OperatingSystem::set_progress_meter_granularity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperatingSystem
的用法示例。
在下文中一共展示了OperatingSystem::set_progress_meter_granularity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calibrate_and_save
// currently, this method checks if there if a file already exists, and if so, assumes it is valid.
// ideally, a check should be made to ensure the saved SSD state matches with the state of the current global parameters
void Experiment::calibrate_and_save(Workload_Definition* workload, string name, int num_IOs, bool force) {
//string file_name = base_folder + "calibrated_state.txt";
string file_name = base_folder + name;
std::ifstream ifile(file_name.c_str());
if (ifile && !force) {
return; // file exists
}
StatisticsGatherer::set_record_statistics(false);
//StatisticsGatherer::get_global_instance()->init();
Thread::set_record_internal_statistics(false);
VisualTracer::init();
//Free_Space_Meter::init();
//Free_Space_Per_LUN_Meter::init();
printf("Creating calibrated SSD state.\n");
OperatingSystem* os = new OperatingSystem();
os->set_num_writes_to_stop_after(num_IOs);
vector<Thread*> init_threads = workload->generate_instance();
os->set_threads(init_threads);
os->set_progress_meter_granularity(1000);
os->run();
os->get_ssd()->execute_all_remaining_events();
save_state(os, file_name);
//StatisticsGatherer::get_global_instance()->print();
//Free_Space_Meter::print();
//Free_Space_Per_LUN_Meter::print();
delete os;
}
示例2: run_single_point
void Experiment::run_single_point(string name) {
string data_folder = base_folder + name + "/";
mkdir(data_folder.c_str(), 0755);
StatisticsGatherer::set_record_statistics(true);
Thread::set_record_internal_statistics(true);
Experiment_Result global_result(name, data_folder, "Global/", "");
Individual_Threads_Statistics::init();
global_result.start_experiment();
Free_Space_Meter::init();
Free_Space_Per_LUN_Meter::init();
if (generate_trace_file) {
VisualTracer::init(data_folder);
} else {
VisualTracer::init();
}
write_config_file(data_folder);
Queue_Length_Statistics::init();
OperatingSystem* os = calibration_file.empty() ? new OperatingSystem() : load_state(calibration_file);
os->set_progress_meter_granularity(20);
if (workload != NULL) {
vector<Thread*> experiment_threads = workload->generate_instance();
os->set_threads(experiment_threads);
}
os->set_num_writes_to_stop_after(io_limit);
os->run();
StatisticsGatherer::get_global_instance()->print();
StatisticsGatherer::get_global_instance()->print_mapping_info();
//StatisticsGatherer::get_global_instance()->print_gc_info();
Utilization_Meter::print();
//Individual_Threads_Statistics::print();
//Queue_Length_Statistics::print_distribution();
//Queue_Length_Statistics::print_avg();
Free_Space_Meter::print();
Free_Space_Per_LUN_Meter::print();
global_result.collect_stats(0, StatisticsGatherer::get_global_instance());
write_results_file(data_folder);
if (!alternate_location_for_results_file.compare("") == 0) {
printf("writing results in %s\n", alternate_location_for_results_file.c_str());
write_results_file(alternate_location_for_results_file);
}
global_result.end_experiment();
vector<Experiment_Result> result;
result.push_back(global_result);
results.push_back(result);
delete os;
}