Cache DynamicProfileRuleS in the profileStore for reduced I/O

This commit is contained in:
Alberto Griggio
2017-03-04 14:16:26 +01:00
parent bc5a6fc7c3
commit dd4fd82582
4 changed files with 26 additions and 20 deletions

View File

@@ -229,19 +229,16 @@ bool storeDynamicProfileRules(const std::vector<DynamicProfileRule> &rules)
PartialProfile *loadDynamicProfile(const ImageMetaData *im)
{
PartialProfile *ret = new PartialProfile(true, true);
std::vector<DynamicProfileRule> rules;
if (loadDynamicProfileRules(rules)) {
for (auto &rule : rules) {
if (rule.matches(im)) {
printf("found matching profile %s\n",
rule.profilepath.c_str());
const PartialProfile *p =
profileStore.getProfile(rule.profilepath);
if (p != nullptr) {
p->applyTo(ret->pparams);
} else {
printf("ERROR loading matching profile\n");
}
for (auto &rule : profileStore.getDynamicProfileRules()) {
if (rule.matches(im)) {
printf("found matching profile %s\n",
rule.profilepath.c_str());
const PartialProfile *p =
profileStore.getProfile(rule.profilepath);
if (p != nullptr) {
p->applyTo(ret->pparams);
} else {
printf("ERROR loading matching profile\n");
}
}
}