当前位置: 首页>>代码示例>>C++>>正文


C++ Power::toString方法代码示例

本文整理汇总了C++中Power::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ Power::toString方法的具体用法?C++ Power::toString怎么用?C++ Power::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Power的用法示例。


在下文中一共展示了Power::toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: commitSetting

Bool PowerControlKnob::commitSetting()
{
	try
	{
		if (m_powerControl->supportsPowerControls())
		{
			// find lowest power limit in request
			Power lowestPowerLimit = snapToCapabilitiesBounds(findLowestPowerLimitRequest());

			// set new power status
			Power currentPowerLimit = m_powerControl->getPowerLimitPL1();
			if (currentPowerLimit != lowestPowerLimit)
			{
				stringstream messageBefore;
				messageBefore << "Attempting to change power limit to " << lowestPowerLimit.toString() << ".";
				getPolicyServices().messageLogging->writeMessageDebug(
					PolicyMessage(FLF, messageBefore.str(), getParticipantIndex(), getDomainIndex()));
				m_powerControl->setPowerLimitPL1(lowestPowerLimit);

				stringstream messageAfter;
				messageAfter << "Changed power limit to " << lowestPowerLimit.toString() << ".";
				getPolicyServices().messageLogging->writeMessageDebug(
					PolicyMessage(FLF, messageAfter.str(), getParticipantIndex(), getDomainIndex()));
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
	catch (std::exception& ex)
	{
		getPolicyServices().messageLogging->writeMessageDebug(
			PolicyMessage(FLF, ex.what(), getParticipantIndex(), getDomainIndex()));
		throw ex;
	}
}
开发者ID:01org,项目名称:dptf,代码行数:42,代码来源:PowerControlKnob.cpp

示例2:

std::shared_ptr<XmlNode> PowerControlKnob::getXml() const
{
	auto knobStatus = XmlNode::createWrapperElement("power_control_status");
	if (m_powerControl->supportsPowerControls())
	{
		auto pl1Capabilities = m_powerControl->getCapabilities().getCapability(PowerControlType::PL1);
		knobStatus->addChild(pl1Capabilities.getXml());
		Power currentPowerLimit = m_powerControl->getPowerLimitPL1();
		auto powerControl = XmlNode::createDataElement("power_limit", currentPowerLimit.toString());
		knobStatus->addChild(powerControl);
	}
	return knobStatus;
}
开发者ID:01org,项目名称:dptf,代码行数:13,代码来源:PowerControlKnob.cpp

示例3: limit

void PowerControlKnob::limit(UIntN target)
{
	if (canLimit(target))
	{
		try
		{
			getPolicyServices().messageLogging->writeMessageDebug(PolicyMessage(
				FLF, "Calculating request to limit power controls.", getParticipantIndex(), getDomainIndex()));

			const auto& pl1Capabilities = m_powerControl->getCapabilities().getCapability(PowerControlType::PL1);
			Power minimumPowerLimit = pl1Capabilities.getMinPowerLimit();
			Power stepSize = pl1Capabilities.getPowerStepSize();

			Power nextPowerLimit(pl1Capabilities.getMaxPowerLimit());
			Power targetRequest = getTargetRequest(target);
			if (targetRequest >= pl1Capabilities.getMaxPowerLimit())
			{
				// limit one step from current power
				Power currentPower = m_powerControl->getAveragePower();
				getPolicyServices().messageLogging->writeMessageDebug(PolicyMessage(
					FLF, "Current power is " + currentPower.toString() + ".", getParticipantIndex(), getDomainIndex()));
				nextPowerLimit = calculateNextLowerPowerLimit(currentPower, minimumPowerLimit, stepSize, targetRequest);
			}
			else
			{
				// limit one step size down
				nextPowerLimit = std::max((int)targetRequest - (int)stepSize, (int)minimumPowerLimit);
			}
			m_requests[target] = nextPowerLimit;

			stringstream message;
			message << "Requesting to limit power to " << nextPowerLimit.toString() << ".";
			getPolicyServices().messageLogging->writeMessageDebug(
				PolicyMessage(FLF, message.str(), getParticipantIndex(), getDomainIndex()));
		}
		catch (std::exception& ex)
		{
			getPolicyServices().messageLogging->writeMessageDebug(
				PolicyMessage(FLF, ex.what(), getParticipantIndex(), getDomainIndex()));
			throw ex;
		}
	}
}
开发者ID:01org,项目名称:dptf,代码行数:43,代码来源:PowerControlKnob.cpp


注:本文中的Power::toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。