aboutsummaryrefslogtreecommitdiff
path: root/miscutils/time.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-12-14 18:49:23 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-12-14 18:54:30 +0100
commitc7b858ff8d2e8b2d785f74b2d319bc9c839f4faa (patch)
tree9ad109d5999444dfb3a281678b6b63d2570a76cd /miscutils/time.c
parentfd3c512f88d43e6633bd3c3110cfa0bb321adaa8 (diff)
downloadbusybox-c7b858ff8d2e8b2d785f74b2d319bc9c839f4faa.tar.gz
libbb: add and use infrastructure for fixed page size optimization
function old new delta procps_scan 1121 1118 -3 getpagesize 6 - -6 rpm_main 1037 1027 -10 rpm2cpio_main 120 110 -10 ptok 38 21 -17 time_main 1282 1261 -21 mkswap_main 317 278 -39 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/6 up/down: 0/-106) Total: -106 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils/time.c')
-rw-r--r--miscutils/time.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/miscutils/time.c b/miscutils/time.c
index d15d363f3..0006c59d8 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -111,6 +111,10 @@ static void printargv(char *const *argv)
This is funky since the pagesize could be less than 1K.
Note: Some machines express getrusage statistics in terms of K,
others in terms of pages. */
+#ifdef BB_ARCH_FIXED_PAGESIZE
+# define pagesize BB_ARCH_FIXED_PAGESIZE
+# define ptok(pagesize, pages) ptok(pages)
+#endif
static unsigned long ptok(const unsigned pagesize, const unsigned long pages)
{
unsigned long tmp;
@@ -124,6 +128,7 @@ static unsigned long ptok(const unsigned pagesize, const unsigned long pages)
tmp = pages * pagesize; /* Larger first, */
return tmp / 1024; /* then smaller. */
}
+#undef pagesize
/* summarize: Report on the system use of a command.
@@ -177,7 +182,7 @@ static void summarize(const char *fmt, char **command, resource_t *resp)
{
unsigned vv_ms; /* Elapsed virtual (CPU) milliseconds */
unsigned cpu_ticks; /* Same, in "CPU ticks" */
- unsigned pagesize = getpagesize();
+ unsigned pagesize = bb_getpagesize();
/* Impossible: we do not use WUNTRACED flag in wait()...
if (WIFSTOPPED(resp->waitstatus))