[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-cd' - loleaflet/debug loleaflet/dist loleaflet/src wsd/Admin.cpp wsd/protocol.txt

Pranav Kant pranavk at collabora.co.uk
Tue Aug 29 18:56:36 UTC 2017


 loleaflet/debug/document/admin.html        |    2 +-
 loleaflet/dist/admin/admin.html            |    2 +-
 loleaflet/src/admin/AdminSocketOverview.js |    8 +++++---
 wsd/Admin.cpp                              |    4 ++--
 wsd/protocol.txt                           |    9 ++++++---
 5 files changed, 15 insertions(+), 10 deletions(-)

New commits:
commit 559c5b19aeb89633cf9aa6577c8b814412f0f928
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Tue Aug 29 11:31:36 2017 +0530

    admin protocol: 'total_mem' -> 'mem_consumed'
    
    total_mem can be confused with total system memory or total memory
    availabe to loolwsd process. Change the API to say what it actually
    returns.
    
    Change-Id: I55c246b8a1d0c5c52767520150e55616266a6d4f
    (cherry picked from commit 29db4b447fda62913e25d66d5f6079bcb6c67ad7)
    Reviewed-on: https://gerrit.libreoffice.org/41687
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/debug/document/admin.html b/loleaflet/debug/document/admin.html
index 891dab8a..546659f8 100644
--- a/loleaflet/debug/document/admin.html
+++ b/loleaflet/debug/document/admin.html
@@ -87,7 +87,7 @@
 	      <h4>Documents opened</h4>
 	    </div>
 	    <div class="col-xs-6 col-sm-3 placeholder">
-	      <div class="main-data" id="total_mem">0</div>
+	      <div class="main-data" id="mem_consumed">0</div>
 	      <h4>Memory consumed</h4>
 	    </div>
 	  </div>
diff --git a/loleaflet/dist/admin/admin.html b/loleaflet/dist/admin/admin.html
index 59e63507..04f6f465 100644
--- a/loleaflet/dist/admin/admin.html
+++ b/loleaflet/dist/admin/admin.html
@@ -73,7 +73,7 @@
 	      <h4><script>document.write(l10nstrings.strDocumentsOpened)</script></h4>
 	    </div>
 	    <div class="col-xs-6 col-sm-3 placeholder">
-	      <div class="main-data" id="total_mem">0</div>
+	      <div class="main-data" id="mem_consumed">0</div>
 	      <h4><script>document.write(l10nstrings.strMemoryConsumed)</script></h4>
 	    </div>
 	  </div>
diff --git a/loleaflet/src/admin/AdminSocketOverview.js b/loleaflet/src/admin/AdminSocketOverview.js
index b1070fcd..0b1d00b5 100644
--- a/loleaflet/src/admin/AdminSocketOverview.js
+++ b/loleaflet/src/admin/AdminSocketOverview.js
@@ -13,7 +13,7 @@ var AdminSocketOverview = AdminSocketBase.extend({
 	_docElapsedTimeIntervalId: 0,
 
 	_getBasicStats: function() {
-		this.socket.send('total_mem');
+		this.socket.send('mem_consumed');
 		this.socket.send('active_docs_count');
 		this.socket.send('active_users_count');
 	},
@@ -216,7 +216,7 @@ var AdminSocketOverview = AdminSocketBase.extend({
 			nTotalViews = parseInt($a.text());
 			$a.text(nTotalViews + 1);
 		}
-		else if (textMsg.startsWith('total_mem') ||
+		else if (textMsg.startsWith('mem_consumed') ||
 			textMsg.startsWith('active_docs_count') ||
 			textMsg.startsWith('active_users_count'))
 		{
@@ -224,7 +224,9 @@ var AdminSocketOverview = AdminSocketBase.extend({
 			var sCommand = textMsg[0];
 			var nData = parseInt(textMsg[1]);
 
-			if (sCommand === 'total_mem') {
+			if (sCommand === 'mem_consumed' ||
+			    sCommand === 'sent_bytes' ||
+			    sCommand === 'recv_bytes') {
 				nData = Util.humanizeMem(nData);
 			}
 			$(document.getElementById(sCommand)).text(nData);
diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index 53bbc924..d3131732 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -134,8 +134,8 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */,
             model.unsubscribe(_sessionId, tokens[i + 1]);
         }
     }
-    else if (tokens[0] == "total_mem")
-        sendTextFrame("total_mem " + std::to_string(_admin->getTotalMemoryUsage()));
+    else if (tokens[0] == "mem_consumed")
+        sendTextFrame("mem_consumed " + std::to_string(_admin->getTotalMemoryUsage()));
 
     else if (tokens[0] == "total_avail_mem")
         sendTextFrame("total_avail_mem " + std::to_string(_admin->getTotalAvailableMemory()));
diff --git a/wsd/protocol.txt b/wsd/protocol.txt
index d1de4ab3..3289fb73 100644
--- a/wsd/protocol.txt
+++ b/wsd/protocol.txt
@@ -600,9 +600,12 @@ documents <pid> <filename> <number of views> <memory consumed> <elapsed time> <i
 
     Each set document attributes is separated by a newline.
 
-total_mem <memory>
-
-    <memory> in kilobytes
+mem_consumed <memory>
+    Total memory being consumed by LibreOffice Online.
+total_avail_mem <memory>
+    Total memory available to whole LibreOffice Online. This takes into account
+    the memproportion setting, if set by the user, when calculating the amount
+    of memory available to the process.
 
 active_docs_count <count>
 


More information about the Libreoffice-commits mailing list