本文整理汇总了C++中properties_t::getProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ properties_t::getProperty方法的具体用法?C++ properties_t::getProperty怎么用?C++ properties_t::getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类properties_t
的用法示例。
在下文中一共展示了properties_t::getProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char* argv[])
{
properties.parse_args(argc, argv);
stldb::timer_configuration config;
config.enabled_percent = properties.getProperty("timing_percent", 0.0);
config.report_interval_seconds = properties.getProperty("report_freq", 60);
config.reset_after_print = properties.getProperty("report_reset", true);
stldb::timer::configure( config );
stldb::tracing::set_trace_level(stldb::fine_e);
const int thread_count = properties.getProperty("threads", 4);
const int loopsize = properties.getProperty("loopsize", 100);
const int ops_per_txn = properties.getProperty("ops_per_txn", 10);
g_db_dir = properties.getProperty<std::string>("rootdir", std::string("."));
g_checkpoint_dir = g_db_dir + "/checkpoint";
g_log_dir = g_db_dir + "/log";
g_num_db = properties.getProperty("databases", 4);
g_maps_per_db = properties.getProperty("maps_per_db", 4);
g_max_key = properties.getProperty("max_key", 10000);
g_avg_val_length = properties.getProperty("avg_val_length", 1000);
g_max_wait = boost::posix_time::millisec(properties.getProperty("max_wait", 10000));
g_checkpoint_interval = boost::posix_time::millisec(properties.getProperty("checkpoint_interval", 0));
g_invalidation_interval = boost::posix_time::millisec(properties.getProperty("invalidation_interval", 0));
// The loop that the running threads will execute
test_loop loop(loopsize);
CRUD_transaction main_op(ops_per_txn);
loop.add( &main_op, 100 );
// Start the threads which are going to run operations:
boost::thread **workers = new boost::thread *[thread_count];
for (int i=0; i<thread_count; i++) {
workers[i] = new boost::thread( loop );
}
// start a thread which does periodic checkpointing
boost::thread *checkpointor = NULL, *invalidator = NULL;
if ( g_checkpoint_interval.seconds() > 0 ) {
checkpointor = new boost::thread( checkpoint_operation(g_checkpoint_interval.seconds()) );
}
if ( g_invalidation_interval.seconds() > 0 ) {
// start a thread which does periodic invalidation, forcing recovery to be done
invalidator = new boost::thread( set_invalid_operation(g_invalidation_interval.seconds()) );
}
// Support the option of writing to an indicator file once all databses have been opened,
// confirming to watching processes/scripts that database open/recovery has finished.
std::string indicator_filename = properties.getProperty<std::string>("indicator_filename", std::string());
if (!indicator_filename.empty()) {
for (int i=0; i<g_num_db; i++) {
shared_lock<boost::shared_mutex> lock;
getDatabase(i, lock);
}
std::ofstream indf(indicator_filename.c_str());
}
// now await their completion
for (int i=0; i<thread_count; i++) {
workers[i]->join();
delete workers[i];
}
// close the databases
for (int i=0; i<g_num_db; i++) {
closeDatabase(i);
}
// final print timing stats (if requested)
if (config.enabled_percent > 0.0)
stldb::time_tracked::print(std::cout, true);
return 0;
}