void WIPolicyOperatingSystemPlatformTypeChanged::execute(void) { writeWorkItemStartingInfoMessage(); auto policyManager = getPolicyManager(); auto policyIndexes = policyManager->getPolicyIndexes(); for (auto i = policyIndexes.begin(); i != policyIndexes.end(); ++i) { try { getDptfManager()->getEventCache()->platformType.set(m_platformType); Policy* policy = policyManager->getPolicyPtr(*i); policy->executePolicyOperatingSystemPlatformTypeChanged(m_platformType); } catch (policy_index_invalid& ex) { // do nothing. No item in the policy list at this index. } catch (std::exception& ex) { writeWorkItemErrorMessagePolicy(ex, "Policy::executePolicyOperatingSystemPlatformTypeChanged", *i); } } }
void PolicyServicesMessageLogging::writeMessageDebug(const DptfMessage& message) { throwIfNotWorkItemThread(); ManagerMessage updatedMessage = ManagerMessage(getDptfManager(), message); updatedMessage.setPolicyIndex(getPolicyIndex()); getEsifServices()->writeMessageDebug(updatedMessage); }
void WIPolicyCreateAll::execute(void) { writeWorkItemStartingInfoMessage(); try { EsifFileEnumerator fileEnumerator(m_policyDirectoryPath, "DptfPolicy*" ESIF_LIB_EXT); std::string policyFileName = fileEnumerator.getFirstFile(); while (policyFileName.length() > 0) { try { std::string policyFilePath = m_policyDirectoryPath + policyFileName; if (getDptfManager()->isDptfPolicyLoadNameOnly()) { policyFilePath.erase(0, m_policyDirectoryPath.length()); } getDptfManager()->getPolicyManager()->createPolicy(policyFilePath); } catch (std::exception& ex) { writeWorkItemWarningMessage(ex, "PolicyManager::createPolicy", "Policy File Name", policyFileName); } catch (...) { dptf_exception ex("Unknown exception type caught when attempting to create a policy."); writeWorkItemWarningMessage(ex, "PolicyManager::createPolicy", "Policy File Name", policyFileName); } policyFileName = fileEnumerator.getNextFile(); } } catch (std::exception& ex) { writeWorkItemErrorMessage(ex, "PolicyManager::createAllPolicies"); } catch (...) { dptf_exception ex("Unknown exception type caught when attempting to create all policies."); writeWorkItemErrorMessage(ex, "PolicyManager::createAllPolicies"); } }
void PolicyServicesDomainTemperature::setTemperatureThresholds(UIntN participantIndex, UIntN domainIndex, const TemperatureThresholds& temperatureThresholds) { throwIfNotWorkItemThread(); #ifdef ONLY_LOG_TEMPERATURE_THRESHOLDS // Added to help debug issue with missing temperature threshold events ManagerMessage message = ManagerMessage(getDptfManager(), FLF, "Policy is calling PolicyServicesDomainTemperature::setTemperatureThresholds()."); message.addMessage("Aux0", temperatureThresholds.getAux0()); message.addMessage("Aux1", temperatureThresholds.getAux1()); message.setParticipantAndDomainIndex(participantIndex, domainIndex); message.setPolicyIndex(getPolicyIndex()); getDptfManager()->getEsifServices()->writeMessageDebug(message, MessageCategory::TemperatureThresholds); #endif getParticipantManager()->getParticipantPtr(participantIndex)->setTemperatureThresholds( domainIndex, getPolicyIndex(), temperatureThresholds); }
void WIDptfGetStatus::execute(void) { WriteWorkItemStartingInfoMessage(); try { getDptfManager()->getDptfStatus()->getStatus(m_command, m_appStatusIn, m_appStatusOut, m_returnCode); } catch (std::exception ex) { WriteWorkItemErrorMessage_Function("DptfStatus::getStatus"); } }
void WIPolicyCreate::execute(void) { WriteWorkItemStartingInfoMessage(); try { getDptfManager()->getPolicyManager()->createPolicy(m_policyFileName); } catch (std::exception ex) { WriteWorkItemErrorMessage_Function_MessageKey_MessageValue("PolicyManager::createPolicy", "Policy File Name", m_policyFileName); } }
void WIPolicyReload::execute(void) { writeWorkItemStartingInfoMessage(); // Iterate through the list of policies and unbind all participant and domains from them DptfManagerInterface* dptfManager = getDptfManager(); auto policyManager = getPolicyManager(); auto participantIndexList = getParticipantManager()->getParticipantIndexes(); // Unbind every participant and domain from every policy for (auto participantIndex = participantIndexList.begin(); participantIndex != participantIndexList.end(); ++participantIndex) { dptfManager->unbindDomainsFromPolicies(*participantIndex); dptfManager->unbindParticipantFromPolicies(*participantIndex); } // No try-catch here because destroyAllPolicies' calling tree catches all exceptions. policyManager->destroyAllPolicies(); try { policyManager->reloadAllPolicies(dptfManager->getDptfPolicyDirectoryPath()); } catch (dptf_exception ex) { writeWorkItemErrorMessage(ex, "policyManager::reloadAllPolicies"); } // Bind every participant and domain to every policy for (auto participantIndex = participantIndexList.begin(); participantIndex != participantIndexList.end(); ++participantIndex) { dptfManager->bindParticipantToPolicies(*participantIndex); dptfManager->bindDomainsToPolicies(*participantIndex); } }