本文整理汇总了C++中ConfigDataInstance::schedule方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigDataInstance::schedule方法的具体用法?C++ ConfigDataInstance::schedule怎么用?C++ ConfigDataInstance::schedule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigDataInstance
的用法示例。
在下文中一共展示了ConfigDataInstance::schedule方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recordQueryPerformance
void Config::recordQueryPerformance(const std::string& name,
size_t delay,
size_t size,
const Row& r0,
const Row& r1) {
// Grab a lock on the schedule structure and check the name.
ConfigDataInstance config;
if (config.schedule().count(name) == 0) {
// Unknown query schedule name.
return;
}
// Grab access to the non-const schedule item.
auto& query = getInstance().data_.schedule.at(name);
auto diff = strtol(r1.at("user_time").c_str(), nullptr, 10) -
strtol(r0.at("user_time").c_str(), nullptr, 10);
query.user_time += diff;
diff = strtol(r1.at("system_time").c_str(), nullptr, 10) -
strtol(r0.at("system_time").c_str(), nullptr, 10);
query.system_time += diff;
diff = strtol(r1.at("resident_size").c_str(), nullptr, 10) -
strtol(r0.at("resident_size").c_str(), nullptr, 10);
// Memory is stored as an average of BSS changes between query executions.
query.memory =
(query.memory * query.executions + diff) / (query.executions + 1);
query.wall_time += delay;
query.output_size += size;
query.executions += 1;
}
示例2: start
void SchedulerRunner::start() {
time_t t = std::time(nullptr);
struct tm* local = std::localtime(&t);
unsigned long int i = local->tm_sec;
for (; (timeout_ == 0) || (i <= timeout_); ++i) {
{
ConfigDataInstance config;
for (const auto& query : config.schedule()) {
if (i % query.second.splayed_interval == 0) {
launchQuery(query.first, query.second);
}
}
}
// Put the thread into an interruptible sleep without a config instance.
osquery::interruptableSleep(interval_ * 1000);
}
}
示例3: recordQueryPerformance
void Config::recordQueryPerformance(const std::string& name,
size_t delay,
size_t size,
const Row& r0,
const Row& r1) {
// Grab a lock on the schedule structure and check the name.
ConfigDataInstance config;
if (config.schedule().count(name) == 0) {
// Unknown query schedule name.
return;
}
// Grab access to the non-const schedule item.
auto& query = getInstance().data_.schedule.at(name);
auto diff = AS_LITERAL(BIGINT_LITERAL, r1.at("user_time")) -
AS_LITERAL(BIGINT_LITERAL, r0.at("user_time"));
if (diff > 0) {
query.user_time += diff;
}
diff = AS_LITERAL(BIGINT_LITERAL, r1.at("system_time")) -
AS_LITERAL(BIGINT_LITERAL, r0.at("system_time"));
if (diff > 0) {
query.system_time += diff;
}
diff = AS_LITERAL(BIGINT_LITERAL, r1.at("resident_size")) -
AS_LITERAL(BIGINT_LITERAL, r0.at("resident_size"));
if (diff > 0) {
// Memory is stored as an average of RSS changes between query executions.
query.average_memory = (query.average_memory * query.executions) + diff;
query.average_memory = (query.average_memory / (query.executions + 1));
}
query.wall_time += delay;
query.output_size += size;
query.executions += 1;
}
示例4:
TEST_F(ConfigTests, test_queries_execute) {
ConfigDataInstance config;
EXPECT_EQ(config.schedule().size(), 3);
}