Diff

mod_statistics/stats.lib.lua @ 1081:3e2c4f424797

mod_statistics: Remove expensive and non-portable /proc-based memory stats
author Matthew Wild <mwild1@gmail.com>
date Sat, 15 Jun 2013 22:07:35 +0100
parent 1080:3af947e2e6d4
child 2209:2733cb8c82a9
line wrap: on
line diff
--- a/mod_statistics/stats.lib.lua	Sat Jun 15 21:17:09 2013 +0100
+++ b/mod_statistics/stats.lib.lua	Sat Jun 15 22:07:35 2013 +0100
@@ -108,35 +108,6 @@
 	}
 end
 
-local pagesize = 4096;
-stats.memory_total = {
-	get = function ()
-		local statm, err = io.open"/proc/self/statm";
-		if statm then
-			local total = statm:read"*n";
-			statm:close();
-			return total * pagesize;
-		else
-			module:log("debug", err);
-		end
-	end;
-	tostring = human;
-};
-stats.memory_rss = {
-	get = function ()
-		local statm, err = io.open"/proc/self/statm";
-		if statm then
-			statm:read"*n"; -- Total size, ignore
-			local rss = statm:read"*n";
-			statm:close();
-			return rss * pagesize;
-		else
-			module:log("debug", err);
-		end
-	end;
-	tostring = human;
-};
-
 local add_statistics_filter; -- forward decl
 if prosody and prosody.arg then -- ensures we aren't in prosodyctl
 	setmetatable(active_sessions, {