diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-14 18:49:23 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-14 18:54:30 +0100 |
commit | c7b858ff8d2e8b2d785f74b2d319bc9c839f4faa (patch) | |
tree | 9ad109d5999444dfb3a281678b6b63d2570a76cd /libbb | |
parent | fd3c512f88d43e6633bd3c3110cfa0bb321adaa8 (diff) | |
download | busybox-w32-c7b858ff8d2e8b2d785f74b2d319bc9c839f4faa.tar.gz busybox-w32-c7b858ff8d2e8b2d785f74b2d319bc9c839f4faa.tar.bz2 busybox-w32-c7b858ff8d2e8b2d785f74b2d319bc9c839f4faa.zip |
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 'libbb')
-rw-r--r-- | libbb/procps.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libbb/procps.c b/libbb/procps.c index 4cc3cb2a1..975e0d4dc 100644 --- a/libbb/procps.c +++ b/libbb/procps.c | |||
@@ -94,15 +94,15 @@ static int read_to_buf(const char *filename, void *buf) | |||
94 | 94 | ||
95 | static procps_status_t* FAST_FUNC alloc_procps_scan(void) | 95 | static procps_status_t* FAST_FUNC alloc_procps_scan(void) |
96 | { | 96 | { |
97 | unsigned n = getpagesize(); | ||
98 | procps_status_t* sp = xzalloc(sizeof(procps_status_t)); | 97 | procps_status_t* sp = xzalloc(sizeof(procps_status_t)); |
99 | sp->dir = xopendir("/proc"); | 98 | unsigned n = bb_getpagesize(); |
100 | while (1) { | 99 | while (1) { |
101 | n >>= 1; | 100 | n >>= 1; |
102 | if (!n) break; | 101 | if (!n) break; |
103 | sp->shift_pages_to_bytes++; | 102 | sp->shift_pages_to_bytes++; |
104 | } | 103 | } |
105 | sp->shift_pages_to_kb = sp->shift_pages_to_bytes - 10; | 104 | sp->shift_pages_to_kb = sp->shift_pages_to_bytes - 10; |
105 | sp->dir = xopendir("/proc"); | ||
106 | return sp; | 106 | return sp; |
107 | } | 107 | } |
108 | 108 | ||