Skip to content

Node.js based forum software built for the modern web

add memory usage to info page

Barış Soner Uşaklı9664033b7326
diff --git a/public/language/en-GB/admin/development/info.json b/public/language/en-GB/admin/development/info.json
index 24bf179655..0a4ae6fe2c 100644
--- a/public/language/en-GB/admin/development/info.json
+++ b/public/language/en-GB/admin/development/info.json
@@ -6,6 +6,7 @@
"nodejs": "nodejs",
"online": "online",
"git": "git",
+ "memory": "memory",
"load": "load",
"uptime": "uptime",
diff --git a/src/controllers/admin/info.js b/src/controllers/admin/info.js
index 734d151a3d..92572840b9 100644
--- a/src/controllers/admin/info.js
+++ b/src/controllers/admin/info.js
@@ -9,7 +9,7 @@ var exec = require('child_process').exec;
var pubsub = require('../../pubsub');
var rooms = require('../../socket.io/admin/rooms');
-var infoController = {};
+var infoController = module.exports;
var info = {};
@@ -76,21 +76,25 @@ function getNodeInfo(callback) {
},
};
- async.parallel({
- stats: function (next) {
- rooms.getLocalStats(next);
+ data.process.memoryUsage.humanReadable = (data.process.memoryUsage.rss / (1024 * 1024)).toFixed(2);
+
+ async.waterfall([
+ function (next) {
+ async.parallel({
+ stats: function (next) {
+ rooms.getLocalStats(next);
+ },
+ gitInfo: function (next) {
+ getGitInfo(next);
+ },
+ }, next);
},
- gitInfo: function (next) {
- getGitInfo(next);
+ function (results, next) {
+ data.git = results.gitInfo;
+ data.stats = results.stats;
+ next(null, data);
},
- }, function (err, results) {
- if (err) {
- return callback(err);
- }
- data.git = results.gitInfo;
- data.stats = results.stats;
- callback(null, data);
- });
+ ], callback);
}
function getGitInfo(callback) {
@@ -111,5 +115,3 @@ function getGitInfo(callback) {
},
}, callback);
}
-
-module.exports = infoController;
diff --git a/src/views/admin/development/info.tpl b/src/views/admin/development/info.tpl
index f594e7a499..d995233f17 100644
--- a/src/views/admin/development/info.tpl
+++ b/src/views/admin/development/info.tpl
@@ -15,6 +15,7 @@
<td>[[admin/development/info:nodejs]]</td>
<td>[[admin/development/info:online]]</td>
<td>[[admin/development/info:git]]</td>
+ <td>[[admin/development/info:memory]]</td>
<td>[[admin/development/info:load]]</td>
<td>[[admin/development/info:uptime]]</td>
</tr>
@@ -31,6 +32,7 @@
<span title="[[admin/development/info:sockets]]">{info.stats.socketCount}</span>
</td>
<td>{info.git.branch}@<a href="https://github.com/NodeBB/NodeBB/commit/{info.git.hash}" target="_blank">{info.git.hash}</a></td>
+ <td>{info.process.memoryUsage.humanReadable} mb</td>
<td>{info.os.load}</td>
<td>{info.process.uptime}</td>
</tr>