summaryrefslogtreecommitdiff
path: root/redfish-core/lib/systems.hpp
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2020-09-30 02:16:58 +0300
committerEd Tanous <ed@tanous.net>2020-10-15 18:52:46 +0300
commitb5a76932eab7d40487ffb305cd745ec155813c4e (patch)
tree193d0ba4e679be07880d661130930cd4adcb38b9 /redfish-core/lib/systems.hpp
parentc370fad0ae67480fac19a2fe6a08be3401f48ae7 (diff)
downloadbmcweb-b5a76932eab7d40487ffb305cd745ec155813c4e.tar.xz
Lots of performance improvements
(In the voice of the kid from sixth sense) I see string copies... Apparently there are a lot of places we make unnecessary copies. This fixes all of them. Not sure how to split this up into smaller patches, or if it even needs split up. It seems pretty easy to review to me, because basically every diff is identical. Change-Id: I22b4ae4f96f7e4082d2bc701098a04f7bed95369 Signed-off-by: Ed Tanous <ed@tanous.net> Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Diffstat (limited to 'redfish-core/lib/systems.hpp')
-rw-r--r--redfish-core/lib/systems.hpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 3f74ca52b8..9f304b0993 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -38,7 +38,7 @@ namespace redfish
*
* @return None.
*/
-inline void updateDimmProperties(std::shared_ptr<AsyncResp> aResp,
+inline void updateDimmProperties(const std::shared_ptr<AsyncResp>& aResp,
const std::variant<bool>& dimmState)
{
const bool* isDimmFunctional = std::get_if<bool>(&dimmState);
@@ -72,7 +72,7 @@ inline void updateDimmProperties(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-inline void modifyCpuPresenceState(std::shared_ptr<AsyncResp> aResp,
+inline void modifyCpuPresenceState(const std::shared_ptr<AsyncResp>& aResp,
const std::variant<bool>& cpuPresenceState)
{
const bool* isCpuPresent = std::get_if<bool>(&cpuPresenceState);
@@ -108,7 +108,7 @@ inline void modifyCpuPresenceState(std::shared_ptr<AsyncResp> aResp,
* @return None.
*/
inline void
- modifyCpuFunctionalState(std::shared_ptr<AsyncResp> aResp,
+ modifyCpuFunctionalState(const std::shared_ptr<AsyncResp>& aResp,
const std::variant<bool>& cpuFunctionalState)
{
const bool* isCpuFunctional = std::get_if<bool>(&cpuFunctionalState);
@@ -144,8 +144,9 @@ inline void
*
* @return None.
*/
-inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp,
- std::shared_ptr<HealthPopulate> systemHealth)
+inline void
+ getComputerSystem(const std::shared_ptr<AsyncResp>& aResp,
+ const std::shared_ptr<HealthPopulate>& systemHealth)
{
BMCWEB_LOG_DEBUG << "Get available system components.";
@@ -613,7 +614,7 @@ inline void getComputerSystem(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-inline void getHostState(std::shared_ptr<AsyncResp> aResp)
+inline void getHostState(const std::shared_ptr<AsyncResp>& aResp)
{
BMCWEB_LOG_DEBUG << "Get host information.";
crow::connections::systemBus->async_method_call(
@@ -729,7 +730,7 @@ inline std::string dbusToRfBootMode(const std::string& dbusMode)
*
* @return Integer error code.
*/
-inline int assignBootParameters(std::shared_ptr<AsyncResp> aResp,
+inline int assignBootParameters(const std::shared_ptr<AsyncResp>& aResp,
const std::string& rfSource,
std::string& bootSource, std::string& bootMode)
{
@@ -789,8 +790,8 @@ inline int assignBootParameters(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-inline void getBootMode(std::shared_ptr<AsyncResp> aResp,
- std::string bootDbusObj)
+inline void getBootMode(const std::shared_ptr<AsyncResp>& aResp,
+ const std::string& bootDbusObj)
{
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
@@ -904,7 +905,7 @@ inline void getBootSource(std::shared_ptr<AsyncResp> aResp, bool oneTimeEnabled)
*
* @return None.
*/
-inline void getBootProperties(std::shared_ptr<AsyncResp> aResp)
+inline void getBootProperties(const std::shared_ptr<AsyncResp>& aResp)
{
BMCWEB_LOG_DEBUG << "Get boot information.";
@@ -945,7 +946,7 @@ inline void getBootProperties(std::shared_ptr<AsyncResp> aResp)
*
* @return None.
*/
-inline void getLastResetTime(std::shared_ptr<AsyncResp> aResp)
+inline void getLastResetTime(const std::shared_ptr<AsyncResp>& aResp)
{
BMCWEB_LOG_DEBUG << "Getting System Last Reset Time";
@@ -988,7 +989,7 @@ inline void getLastResetTime(std::shared_ptr<AsyncResp> aResp)
*
* @return None.
*/
-inline void getAutomaticRetry(std::shared_ptr<AsyncResp> aResp)
+inline void getAutomaticRetry(const std::shared_ptr<AsyncResp>& aResp)
{
BMCWEB_LOG_DEBUG << "Get Automatic Retry policy";
@@ -1079,7 +1080,7 @@ inline void getAutomaticRetry(std::shared_ptr<AsyncResp> aResp)
*
* @return None.
*/
-inline void getPowerRestorePolicy(std::shared_ptr<AsyncResp> aResp)
+inline void getPowerRestorePolicy(const std::shared_ptr<AsyncResp>& aResp)
{
BMCWEB_LOG_DEBUG << "Get power restore policy";
@@ -1259,7 +1260,7 @@ inline void setBootModeOrSource(std::shared_ptr<AsyncResp> aResp,
*
* @return Integer error code.
*/
-inline void setBootSourceProperties(std::shared_ptr<AsyncResp> aResp,
+inline void setBootSourceProperties(const std::shared_ptr<AsyncResp>& aResp,
std::optional<std::string> bootSource,
std::optional<std::string> bootEnable)
{
@@ -1303,7 +1304,7 @@ inline void setBootSourceProperties(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-inline void setAutomaticRetry(std::shared_ptr<AsyncResp> aResp,
+inline void setAutomaticRetry(const std::shared_ptr<AsyncResp>& aResp,
const std::string&& automaticRetryConfig)
{
BMCWEB_LOG_DEBUG << "Set Automatic Retry.";
@@ -1352,7 +1353,7 @@ inline void setAutomaticRetry(std::shared_ptr<AsyncResp> aResp,
*
* @return None.
*/
-inline void setPowerRestorePolicy(std::shared_ptr<AsyncResp> aResp,
+inline void setPowerRestorePolicy(const std::shared_ptr<AsyncResp>& aResp,
std::optional<std::string> policy)
{
BMCWEB_LOG_DEBUG << "Set power restore policy.";
@@ -1532,7 +1533,7 @@ inline std::string rfToDbusWDTTimeOutAct(const std::string& rfAction)
*
* @return None.
*/
-inline void getHostWatchdogTimer(std::shared_ptr<AsyncResp> aResp)
+inline void getHostWatchdogTimer(const std::shared_ptr<AsyncResp>& aResp)
{
BMCWEB_LOG_DEBUG << "Get host watchodg";
crow::connections::systemBus->async_method_call(
@@ -1603,7 +1604,7 @@ inline void getHostWatchdogTimer(std::shared_ptr<AsyncResp> aResp)
*
* @return None.
*/
-inline void setWDTProperties(std::shared_ptr<AsyncResp> aResp,
+inline void setWDTProperties(const std::shared_ptr<AsyncResp>& aResp,
const std::optional<bool> wdtEnable,
const std::optional<std::string>& wdtTimeOutAction)
{
@@ -1959,7 +1960,7 @@ class Systems : public Node
health->populate();
getMainChassisId(asyncResp, [](const std::string& chassisId,
- std::shared_ptr<AsyncResp> aRsp) {
+ const std::shared_ptr<AsyncResp>& aRsp) {
aRsp->res.jsonValue["Links"]["Chassis"] = {
{{"@odata.id", "/redfish/v1/Chassis/" + chassisId}}};
});