diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-12 12:52:30 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-12 12:52:30 +0100 |
commit | f2c8aa6676ebedc34b2cd5089ce6f13c16db1277 (patch) | |
tree | bc728f22666ee367d1c6c085a6cf65570881636c /libbb | |
parent | cb23d93c6845df3f2733a32caa4194e60ef871a7 (diff) | |
download | busybox-w32-f2c8aa6676ebedc34b2cd5089ce6f13c16db1277.tar.gz busybox-w32-f2c8aa6676ebedc34b2cd5089ce6f13c16db1277.tar.bz2 busybox-w32-f2c8aa6676ebedc34b2cd5089ce6f13c16db1277.zip |
libbb: introduce and use monotonic_ms
function old new delta
monotonic_ms - 60 +60
process_stdin 433 443 +10
display_speed 85 90 +5
nmeter_main 672 674 +2
builtin_type 114 116 +2
bb__parsespent 117 119 +2
ifplugd_main 1110 1109 -1
acpid_main 441 440 -1
chat_main 1361 1359 -2
doCommands 2458 2449 -9
arpping 466 450 -16
run_command 268 234 -34
readcmd 1072 1034 -38
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/7 up/down: 81/-101) Total: -20 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/time.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libbb/time.c b/libbb/time.c index 82a0fa1fa..45ae6f3a7 100644 --- a/libbb/time.c +++ b/libbb/time.c | |||
@@ -175,6 +175,12 @@ unsigned long long FAST_FUNC monotonic_us(void) | |||
175 | get_mono(&ts); | 175 | get_mono(&ts); |
176 | return ts.tv_sec * 1000000ULL + ts.tv_nsec/1000; | 176 | return ts.tv_sec * 1000000ULL + ts.tv_nsec/1000; |
177 | } | 177 | } |
178 | unsigned long long FAST_FUNC monotonic_ms(void) | ||
179 | { | ||
180 | struct timespec ts; | ||
181 | get_mono(&ts); | ||
182 | return ts.tv_sec * 1000ULL + ts.tv_nsec/1000000; | ||
183 | } | ||
178 | unsigned FAST_FUNC monotonic_sec(void) | 184 | unsigned FAST_FUNC monotonic_sec(void) |
179 | { | 185 | { |
180 | struct timespec ts; | 186 | struct timespec ts; |
@@ -196,6 +202,12 @@ unsigned long long FAST_FUNC monotonic_us(void) | |||
196 | gettimeofday(&tv, NULL); | 202 | gettimeofday(&tv, NULL); |
197 | return tv.tv_sec * 1000000ULL + tv.tv_usec; | 203 | return tv.tv_sec * 1000000ULL + tv.tv_usec; |
198 | } | 204 | } |
205 | unsigned long long FAST_FUNC monotonic_ms(void) | ||
206 | { | ||
207 | struct timeval tv; | ||
208 | gettimeofday(&tv, NULL); | ||
209 | return tv.tv_sec * 1000ULL + tv.tv_usec / 1000; | ||
210 | } | ||
199 | unsigned FAST_FUNC monotonic_sec(void) | 211 | unsigned FAST_FUNC monotonic_sec(void) |
200 | { | 212 | { |
201 | return time(NULL); | 213 | return time(NULL); |