diff options
Diffstat (limited to 'powercap.cpp')
-rw-r--r-- | powercap.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/powercap.cpp b/powercap.cpp index 2ecad0c..7e8c0db 100644 --- a/powercap.cpp +++ b/powercap.cpp @@ -54,6 +54,19 @@ std::string PowerCap::getService(std::string path, return mapperResponse.begin()->first; } +uint32_t PowerCap::getOccInput(uint32_t pcap, bool pcapEnabled) +{ + if (!pcapEnabled) + { + // Pcap disabled, return 0 to indicate disabled + return 0; + } + + // If pcap is not disabled then just return the pcap with the derating + // factor applied. + return( (static_cast<uint64_t>(pcap) * PS_DERATING_FACTOR) /100); +} + uint32_t PowerCap::getPcap() { auto settingService = getService(PCAP_PATH,PCAP_INTERFACE); @@ -144,7 +157,9 @@ void PowerCap::pcapChanged(sdbusplus::message::message& msg) entry("PCAP_ENABLED=%u",pcapEnabled)); // Determine desired action to write to occ - // TODO + auto occInput = getOccInput(pcap, pcapEnabled); + log<level::DEBUG>("Writing new power cap setting to OCC", + entry("OCC_PCAP_VAL=%u",occInput)); // Write action to occ // TODO |