From 4865bf296757d0041c98d713abf61cbf497fca95 Mon Sep 17 00:00:00 2001 From: ??? Date: Thu, 14 May 2009 22:08:38 -0500 Subject: [PATCH] [PATCH] physical memory size computing error There are two minor bugs on physical memory size computing: (1) fromunits() returns wrong value for "2001844kB", which consists of more than one digits. (2) memory()['memtotal'] is in kB. If "--realmem" is not provided at CLI, totalmem() returns number in MB and the "firmware/hardware" amount will be minus. totalmem() needs to always return value in kB. Here is how to test this patch: (1) Do "smem -w" , the "firmware/hardware" amount should not be minus. (2) Do "smem -w -R 2001844kB" (change 2001844kB per your PC, note to keep it in kB unit) , the "firmware/hardware" amount should not be minus. Here's a patch to fix these issues. --- smem | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smem b/smem index f15891c..4d4f2e1 100755 --- a/smem +++ b/smem @@ -77,7 +77,7 @@ def totalmem(): _totalmem = fromunits(options.realmem) else: _totalmem = memory()['memtotal'] - return _totalmem / 1024 + return _totalmem _kernelsize = 0 def kernelsize():