As a COTS solution in the ATX ecosystem, Blackbird doesn't have dedicated PSU...

As a COTS solution in the ATX ecosystem, Blackbird doesn't have dedicated PSU power monitoring capabilities Report CPU power consumption in BMC Web GUI instead of total system power consumption
parent 7a774524
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 7643a4e..df0e7cf 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -1488,22 +1488,42 @@ window.angular && (function(angular) {
});
return $q.all(promises);
},
- getPowerConsumption: function() {
+ getCPUPowerConsumption: function() {
return $http({
method: 'GET',
url: DataService.getHost() +
- '/xyz/openbmc_project/sensors/power/total_power',
+ '/xyz/openbmc_project/sensors/power/p0_power',
withCredentials: true
})
.then(
function(response) {
var json = JSON.stringify(response.data);
var content = JSON.parse(json);
+ var first_cpu_data = content.data;
- return getScaledValue(
- content.data.Value, content.data.Scale) +
- ' ' +
- Constants.POWER_CONSUMPTION_TEXT[content.data.Unit];
+ return $http({
+ method: 'GET',
+ url: DataService.getHost() +
+ '/xyz/openbmc_project/sensors/power/p1_power',
+ withCredentials: true
+ })
+ .then(
+ function(response) {
+ var json = JSON.stringify(response.data);
+ var content = JSON.parse(json);
+ var second_cpu_value = content.data.Value;
+
+ return getScaledValue(
+ first_cpu_data.Value + second_cpu_value, first_cpu_data.Scale) +
+ ' ' +
+ Constants.POWER_CONSUMPTION_TEXT[first_cpu_data.Unit];
+ },
+ function(error) {
+ return getScaledValue(
+ first_cpu_data.Value, first_cpu_data.Scale) +
+ ' ' +
+ Constants.POWER_CONSUMPTION_TEXT[first_cpu_data.Unit];
+ });
},
function(error) {
if ('Not Found' == error.statusText) {
diff --git a/app/overview/controllers/system-overview-controller.html b/app/overview/controllers/system-overview-controller.html
index 629e0ab..03644c6 100644
--- a/app/overview/controllers/system-overview-controller.html
+++ b/app/overview/controllers/system-overview-controller.html
@@ -83,8 +83,8 @@
<ul class="overview__metadata-wrapper">
<li class="overview__metadata-block">
<dl>
- <dt class="content-label">Power Consumption</dt>
- <dd class="courier-bold">{{power_consumption}}</dd>
+ <dt class="content-label">CPU Power Consumption</dt>
+ <dd class="courier-bold">{{cpu_power_consumption}}</dd>
</dl>
</li>
<li class="overview__metadata-block">
diff --git a/app/overview/controllers/system-overview-controller.js b/app/overview/controllers/system-overview-controller.js
index 0b7d2f0..b466b6a 100644
--- a/app/overview/controllers/system-overview-controller.js
+++ b/app/overview/controllers/system-overview-controller.js
@@ -19,7 +19,7 @@ window.angular && (function(angular) {
$scope.bmc_firmware = '';
$scope.bmc_time = '';
$scope.server_firmware = '';
- $scope.power_consumption = '';
+ $scope.cpu_power_consumption = '';
$scope.power_cap = '';
$scope.bmc_ip_addresses = [];
$scope.loading = false;
@@ -77,9 +77,9 @@ window.angular && (function(angular) {
console.log(JSON.stringify(error));
});
- var getPowerConsumptionPromise = APIUtils.getPowerConsumption().then(
+ var getCPUPowerConsumptionPromise = APIUtils.getCPUPowerConsumption().then(
function(data) {
- $scope.power_consumption = data;
+ $scope.cpu_power_consumption = data;
},
function(error) {
console.log(JSON.stringify(error));
@@ -114,7 +114,7 @@ window.angular && (function(angular) {
getLEDStatePromise,
getBMCTimePromise,
getServerInfoPromise,
- getPowerConsumptionPromise,
+ getCPUPowerConsumptionPromise,
getPowerCapPromise,
getNetworkInfoPromise,
];
diff --git a/app/server-control/controllers/power-usage-controller.html b/app/server-control/controllers/power-usage-controller.html
index 62ca3da..273cf9b 100644
--- a/app/server-control/controllers/power-usage-controller.html
+++ b/app/server-control/controllers/power-usage-controller.html
@@ -11,8 +11,8 @@
<fieldset>
<ul class="power-usage__metadata-wrapper">
<li class="power-usage__metadata-block">
- <p class="content-label">Power Consumption</p>
- <p class="courier-bold">{{power_consumption}}</p>
+ <p class="content-label">CPU Power Consumption</p>
+ <p class="courier-bold">{{cpu_power_consumption}}</p>
</li>
<li class="power-usage__metadata-block">
<div class="toggle inline">
diff --git a/app/server-control/controllers/power-usage-controller.js b/app/server-control/controllers/power-usage-controller.js
index 9398259..bb2bf0d 100644
--- a/app/server-control/controllers/power-usage-controller.js
+++ b/app/server-control/controllers/power-usage-controller.js
@@ -12,7 +12,7 @@ window.angular && (function(angular) {
angular.module('app.serverControl').controller('powerUsageController', [
'$scope', '$window', 'APIUtils', '$route', '$q', 'toastService',
function($scope, $window, APIUtils, $route, $q, toastService) {
- $scope.power_consumption = '';
+ $scope.cpu_power_consumption = '';
$scope.power_cap = {};
$scope.loading = false;
loadPowerData();
@@ -28,16 +28,16 @@ window.angular && (function(angular) {
console.log(JSON.stringify(error));
});
- var getPowerConsumptionPromise = APIUtils.getPowerConsumption().then(
+ var getCPUPowerConsumptionPromise = APIUtils.getCPUPowerConsumption().then(
function(data) {
- $scope.power_consumption = data;
+ $scope.cpu_power_consumption = data;
},
function(error) {
console.log(JSON.stringify(error));
});
var promises = [
- getPowerConsumptionPromise,
+ getCPUPowerConsumptionPromise,
getPowerCapPromise,
];
FILESEXTRAPATHS_prepend := "${THISDIR}/phosphor-webui:"
SRC_URI += "file://login-page-name.patch"
SRC_URI += "file://login-page-name.patch \
file://cpu-power-reporting.patch \
"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment