[PATCH] time: fix max resident set size unit

Natanael Copa ncopa at alpinelinux.org
Wed Dec 20 11:23:31 UTC 2023


The ru_maxrss is already in Kbytes and not pages.

function                                             old     new   delta
time_main                                           1195    1190      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5)               Total: -5 bytes
   text	   data	    bss	    dec	    hex	filename
 828010	  14268	   2008	 844286	  ce1fe	busybox_old
 828005	  14268	   2008	 844281	  ce1f9	busybox_unstripped

fixes: https://bugs.busybox.net/show_bug.cgi?id=15751
---

Good catch!

Thanks!

 miscutils/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/miscutils/time.c b/miscutils/time.c
index 5a8fa4c0b..b90b582b0 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -281,7 +281,7 @@ static void summarize(const char *fmt, char **command, resource_t *resp)
 					 ptok(pagesize, (UL) resp->ru.ru_ixrss)) / cpu_ticks);
 				break;
 			case 'M':	/* Maximum resident set size.  */
-				printf("%lu", ptok(pagesize, (UL) resp->ru.ru_maxrss));
+				printf("%lu", (UL) resp->ru.ru_maxrss);
 				break;
 			case 'O':	/* Outputs.  */
 				printf("%lu", resp->ru.ru_oublock);
-- 
2.43.0



More information about the busybox mailing list