本文整理汇总了C++中Controller::build_raid方法的典型用法代码示例。如果您正苦于以下问题:C++ Controller::build_raid方法的具体用法?C++ Controller::build_raid怎么用?C++ Controller::build_raid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::build_raid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
return 0;
}
}
}
}
Controller* ctl;
std::vector<SSD*> ssd_list;
std::vector<DriveInfo*> drv_list;
CompEngine cmp_engine;
ssd_list.resize(drv_num);
drv_list.resize(drv_num);
// initialization
if( !cmp_engine.init_engine(trace_file.c_str()) )
ERR_AND_RTN;
if( mode == CTL_SIDE )
{ // controller side compression
for( uint32_t i = 0; i < drv_num; i++ ) {
ssd_list[i] = new SSD;
drv_list[i] = new DriveInfo;
if( !ssd_list[i]->simple_init( max_drv_bytes, ssd_op_ratio))
ERR_AND_RTN;
drv_list[i]->max_lba = ssd_list[i]->get_max_lba();
}
CompController* c_ctl = new CompController;
if( !c_ctl->build_raid(RAID5, drv_list) )
ERR_AND_RTN;
if( !c_ctl->init(&cmp_engine, 1 - 1/ctl_op_ratio, ctl_cmp_chunk) )
ERR_AND_RTN;
ctl = c_ctl;
} else
{ // ssd side compression
for( uint32_t i = 0; i < drv_num; i++ ) {
CompSSD* c_ssd = new CompSSD;
bool enable_virt = true;
uint32_t buffered_page_num = 4;
if( !c_ssd->setup_compression(enable_virt, &cmp_engine, A_CC_FTL, buffered_page_num ) )
ERR_AND_RTN;
if( !c_ssd->simple_init( max_drv_bytes, ssd_op_ratio ) )
ERR_AND_RTN;
ssd_list[i] = c_ssd;
drv_list[i] = new DriveInfo;
drv_list[i]->max_lba = ssd_list[i]->get_max_lba();
}
ctl = new Controller;
if( !ctl->build_raid(RAID5, drv_list) )
ERR_AND_RTN;
}
// sim start
time_t now = time(NULL);
struct tm *pnow = localtime(&now);
std::cout << "#start time: " << pnow->tm_hour << ":" << pnow->tm_min << ":" << pnow->tm_sec << std::endl;
// print settings
std::cout << "#settings, mode, dnum, drive_sect, drive_lba, cmp_ratio, ctl_opr, ctl_chunk, ssd_opr, ttl_io, comp_trace, skip_ssd" << std::endl;