summaryrefslogtreecommitdiffstats
path: root/dump_manager.hpp
diff options
context:
space:
mode:
authorJayanth Othayoth <ojayanth@in.ibm.com>2017-08-02 06:24:58 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-08-22 20:48:18 +0000
commitab7f920942ff0b6337b641b6f80ad6025e120220 (patch)
tree19cbfdcbbbb1a95f457c3af1be3dd110fa333cc2 /dump_manager.hpp
parent56a0bc8af04d120502710643b4a9cfa52054e6f6 (diff)
downloadphosphor-debug-collector-ab7f920942ff0b6337b641b6f80ad6025e120220.tar.gz
phosphor-debug-collector-ab7f920942ff0b6337b641b6f80ad6025e120220.zip
Cap the number of dumps
Calculate number of dumps allowed in a system based on individual dump Max size configured in the system. Algorithm: Setting Dump size to maximum size, if (dump entries + active dumps) is less than total allowed dump entries. Otherwise return error. Next patch will provide additional algorithm to cap the dump based on actual size of the dump files. Change-Id: Id8916a31d72f5c2f2f23eaf68062b829b7e4100c Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
Diffstat (limited to 'dump_manager.hpp')
-rw-r--r--dump_manager.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/dump_manager.hpp b/dump_manager.hpp
index 8318f37..9856f1e 100644
--- a/dump_manager.hpp
+++ b/dump_manager.hpp
@@ -64,6 +64,7 @@ class Manager : public CreateIface
bus(bus),
eventLoop(event.get()),
lastEntryId(0),
+ activeDumpCount(0),
dumpWatch(eventLoop,
IN_NONBLOCK,
IN_CLOSE_WRITE | IN_CREATE,
@@ -136,6 +137,14 @@ class Manager : public CreateIface
*/
void removeWatch(const fs::path& path);
+ /** @brief Calculate per dump allowed size based on number of
+ * existing dumps and total dump size. Returns
+ * allowed size for a dump in kilo bytes.
+ * @returns 0 indicates no space is available in dump location
+ * non zero value indicates size of one dump.
+ */
+ size_t getAllowedSize();
+
/** @brief sdbusplus DBus bus connection. */
sdbusplus::bus::bus& bus;
@@ -148,6 +157,9 @@ class Manager : public CreateIface
/** @brief Id of the last Dump entry */
uint32_t lastEntryId;
+ /** @brief active dump count */
+ uint32_t activeDumpCount;
+
/** @brief Dump main watch object */
Watch dumpWatch;
OpenPOWER on IntegriCloud