本文整理汇总了C++中Options::IncreaseParallelism方法的典型用法代码示例。如果您正苦于以下问题:C++ Options::IncreaseParallelism方法的具体用法?C++ Options::IncreaseParallelism怎么用?C++ Options::IncreaseParallelism使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::IncreaseParallelism方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool snpDeviceImpl::init(uint16 cellSize, uint32 cellsPerPU, uint32 numberOfPU)
{
// setup device settings
m_cellSize = cellSize;
m_cellsPerPU = cellsPerPU;
m_numberOfPU = numberOfPU;
s_iCellIndex = kCellNotFound;
// initialize database
Options options;
// Optimize RocksDB. This is the easiest way to get RocksDB to perform well
options.IncreaseParallelism();
options.OptimizeLevelStyleCompaction();
// create the DB if it's not already present
options.create_if_missing = true;
// initialize database
Status dbStatus = DB::Open(options, kDatabasePath + std::to_string(m_cellSize), &s_database);
if (dbStatus.ok())
{
// fillup database with default values
rocksdb::WriteBatch initBatch; Status dbStatus;
std::vector<uint32> defaultVector;
for(uint16 index = 0; index < m_cellSize; index++)
{
defaultVector.push_back(0);
}
std::string defaultValue = bitfield2string(defaultVector);
for (uint32 index = 0; index < getCellsPerPU() * getNumberOfPU(); index++)
{
std::string key = std::to_string(index);
std::string value;
dbStatus = s_database->Get(rocksdb::ReadOptions(), key, &value);
if (!dbStatus.ok() || string2bitfield(value).size() < m_cellSize)
{
initBatch.Put(key, defaultValue);
}
}
dbStatus = s_database->Write(rocksdb::WriteOptions(), &initBatch);
}
return dbStatus.ok();
}
示例2: main
int main(int argc, char** argv) {
srand (time(NULL));
if(argc != 3){
cout<<"invalid parameter!!"<<endl;
return 0;
}
string key, val;
int type = atoi(argv[1]);
int counter = 0;
if(type == 3){
key = argv[2];
}
else{
counter = atoi(argv[2]);
}
cout<<"type:"<<type<<endl;
cout<<"counter:"<<counter<<endl;
DB* db;
Options options;
// Optimize RocksDB. This is the easiest way to get RocksDB to perform well
options.IncreaseParallelism();
options.OptimizeLevelStyleCompaction();
// create the DB if it's not already present
options.create_if_missing = true;
// open DB
Status s = DB::Open(options, kDBPath, &db);
assert(s.ok());
if(type == 3){
s = db->Get(ReadOptions(), key, &val);
cout<<"ret:"<<val<<endl;
}
else if(type == 1){
time_t now = time(NULL);
for(int i = 0; i < counter ; i++){
key = "key_" + boost::lexical_cast<string>(i);
val = "val_" + boost::lexical_cast<string>(i)+"_" +boost::lexical_cast<string>(now);
s = db->Put(WriteOptions(), key, val);
}
}
else if(type == 2){
int k;
for(int i = 0; i < counter ; i++){
k = rand() % counter;
key = "key_" + boost::lexical_cast<string>(k);
s = db->Get(ReadOptions(), key, &val);
}
cout<<key<<":"<<val<<endl;
}
delete db;
return 0;
}