diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-07-07 17:12:19 +0530 |
---|---|---|
committer | Pranav Kant <pranavk@collabora.co.uk> | 2017-07-07 21:14:53 +0530 |
commit | fde57adbbf9ab2fba80c6b8e0d877c797b55bea5 (patch) | |
tree | a96aa46333227e8dda9c0c06cc17150c4f509a51 /wsd/AdminModel.hpp | |
parent | Lets do away with this (diff) | |
download | online-fde57adbbf9ab2fba80c6b8e0d877c797b55bea5.tar.gz online-fde57adbbf9ab2fba80c6b8e0d877c797b55bea5.zip |
Introduce hard mode when we are OOM
Start killing documents when memory usage goes above threshold.
Also make it possible to close documents from admin instance.
In DocumentBroker::closeDocument, just set the _stop flag and wake
up the polling thread which will terminate the children, instead of
manually terminating the children.
Change-Id: Ie70e05b3fb6ea816a87b6dcfaed92cdddb94aa90
Diffstat (limited to 'wsd/AdminModel.hpp')
-rw-r--r-- | wsd/AdminModel.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/wsd/AdminModel.hpp b/wsd/AdminModel.hpp index b217c2bea4..d56bdb7040 100644 --- a/wsd/AdminModel.hpp +++ b/wsd/AdminModel.hpp @@ -54,6 +54,22 @@ struct DocProcSettings size_t LimitFileSizeMb; }; +/// Containing basic information about document +struct DocBasicInfo +{ + std::string _docKey; + std::time_t _idleTime; + bool _saved; + int _mem; + + DocBasicInfo(const std::string& docKey, std::time_t idleTime, bool saved, int mem) + : _docKey(docKey), + _idleTime(idleTime), + _saved(saved), + _mem(mem) + { } +}; + /// A document in Admin controller. class Document { @@ -73,6 +89,8 @@ public: { } + const std::string getDocKey() const { return _docKey; } + Poco::Process::PID getPid() const { return _pid; } std::string getFilename() const { return _filename; } @@ -247,6 +265,9 @@ public: uint64_t getSentBytesTotal() { return _sentBytesTotal; } uint64_t getRecvBytesTotal() { return _recvBytesTotal; } + /// Document basic info list sorted by most idle time + std::list<DocBasicInfo> getDocumentsSortedByIdle() const; + private: std::string getMemStats(); |