Scale down threads for collection at power on
In case where BMC reboots and VPD-Manager re-triggers the collection
process for the FRUs, number of threads has been restricted to 2 for
now (Just a lower value).
The thread count is configurable and can be updated as required.
This is required to scale down CPU utilization at power on.
Change-Id: I7dee6dabf073bc1f17ab4f9f672aa183b00e116a
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/vpd-manager/include/worker.hpp b/vpd-manager/include/worker.hpp
index ba88d33..ac1b3d8 100644
--- a/vpd-manager/include/worker.hpp
+++ b/vpd-manager/include/worker.hpp
@@ -42,11 +42,13 @@
* initialize the parsed JSON variable.
*
* @param[in] pathToConfigJSON - Path to the config JSON, if applicable.
+ * @param[in] i_maxThreadCount - Maximum thread while collecting FRUs VPD.
*
* Note: Throws std::exception in case of construction failure. Caller needs
* to handle to detect successful object creation.
*/
- Worker(std::string pathToConfigJson = std::string());
+ Worker(std::string pathToConfigJson = std::string(),
+ uint8_t i_maxThreadCount = constants::MAX_THREADS);
/**
* @brief Destructor
@@ -513,6 +515,8 @@
* Some FRUs, under some given scenarios should not be collected and
* skipped.
*
+ * @param[in] i_vpdFilePath - EEPROM path.
+ *
* @return True - if path is empty or should be skipped, false otherwise.
*/
bool skipPathForCollection(const std::string& i_vpdFilePath);
@@ -541,7 +545,6 @@
std::mutex m_mutex;
// Counting semaphore to limit the number of threads.
- std::counting_semaphore<constants::MAX_THREADS> m_semaphore{
- constants::MAX_THREADS};
+ std::counting_semaphore<constants::MAX_THREADS> m_semaphore;
};
} // namespace vpd