コード例 #1
0
void DomainPowerControl_001::throwIfDynamicCapabilitiesAreWrong(const PowerControlDynamicCapsSet& capabilities)
{
    if (capabilities.isEmpty())
    {
        throw dptf_exception("Dynamic caps set is empty.  Impossible if we support power controls.");
    }

    auto controlTypes = capabilities.getControlTypes();
    for (auto controlType = controlTypes.begin(); controlType != controlTypes.end(); controlType++)
    {
        auto capability = capabilities.getCapability(*controlType);
        std::string controlTypeString = PowerControlType::ToString(capability.getPowerControlType());
        if (capability.getMaxPowerLimit() < capability.getMinPowerLimit())
        {
            std::string errorMessage = controlTypeString + " has bad power limit capabilities: max < min.";
            throw dptf_exception(errorMessage);
        }

        if (capability.getMaxTimeWindow() < capability.getMinTimeWindow())
        {
            std::string errorMessage = controlTypeString + " has bad time window capabilities: max < min.";
            throw dptf_exception(errorMessage);
        }

        if (capability.getMaxDutyCycle() < capability.getMinDutyCycle())
        {
            std::string errorMessage = controlTypeString + " has bad duty cycle capabilities: max < min.";
            throw dptf_exception(errorMessage);
        }
    }
}
コード例 #2
0
void PowerControlCapabilitiesArbitrator::updatePolicyRequest(
    const PowerControlDynamicCapsSet &capSet, UIntN policyIndex)
{
    auto controlTypes = capSet.getControlTypes();
    for (auto controlType = controlTypes.begin(); controlType != controlTypes.end(); controlType++)
    {
        auto capability = capSet.getCapability(*controlType);
        m_requestedMaxPowerLimit[policyIndex][*controlType] = capability.getMaxPowerLimit();
        m_requestedMinPowerLimit[policyIndex][*controlType] = capability.getMinPowerLimit();
        m_requestedPowerLimitStep[policyIndex][*controlType] = capability.getPowerStepSize();
        m_requestedMaxTimeWindow[policyIndex][*controlType] = capability.getMaxTimeWindow();
        m_requestedMinTimeWindow[policyIndex][*controlType] = capability.getMinTimeWindow();
    }
}
コード例 #3
0
void DomainPowerControl_001::setPowerControlDynamicCapsSet(UIntN participantIndex, UIntN domainIndex,
    PowerControlDynamicCapsSet capsSet)
{
    DptfBuffer buffer = capsSet.toPpccBinary();
    getParticipantServices()->primitiveExecuteSet(
        esif_primitive_type::SET_RAPL_POWER_CONTROL_CAPABILITIES, ESIF_DATA_BINARY,
        buffer.get(), buffer.size(), buffer.size(), domainIndex, Constants::Esif::NoPersistInstance);
    m_powerControlDynamicCaps.set(getDynamicCapabilities());
}
コード例 #4
0
PowerControlDynamicCapsSet DomainPowerControl_001::getAdjustedDynamicCapsBasedOnConfigTdpMaxLimit(
    const PowerControlDynamicCapsSet& capsSet)
{
    std::vector<PowerControlDynamicCaps> newCapsList;
    for (UIntN capsIndex = 0; capsIndex < capsSet.getCount(); capsIndex++)
    {
        Power maxPowerLimit(Power::createInvalid());
        if (capsSet[capsIndex].getPowerControlType() == PowerControlType::pl1)
        {
            maxPowerLimit = capsSet[capsIndex].getMaxPowerLimit();
        }
        else
        {
            maxPowerLimit = capsSet[capsIndex].getMaxPowerLimit();
        }
        newCapsList.push_back(PowerControlDynamicCaps(
                                  capsSet[capsIndex].getPowerControlType(), capsSet[capsIndex].getMinPowerLimit(), maxPowerLimit,
                                  capsSet[capsIndex].getPowerStepSize(), capsSet[capsIndex].getMinTimeWindow(),
                                  capsSet[capsIndex].getMaxTimeWindow(), capsSet[capsIndex].getMinDutyCycle(),
                                  capsSet[capsIndex].getMaxDutyCycle()));
    }
    return PowerControlDynamicCapsSet(newCapsList);
}