aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2021-12-09 14:46:39 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2022-01-13 07:56:00 +0000
commit4003cdd81b8776cb451395ffa53423ad52328bc9 (patch)
tree54f11d4462c6e6814c32891d74584aa5918655ca
parente3ef89ba96730180f55b9fc6af4c29e1482b9ac6 (diff)
downloadsrc-4003cdd81b8776cb451395ffa53423ad52328bc9.tar.gz
src-4003cdd81b8776cb451395ffa53423ad52328bc9.zip
loader: ip: Do not call getsecs so much
getsecs is very costly, reuse the values we got before. Fetching a ~30MB kernel with the tftp command use to take ~26 seconds and now it's ~18 seconds. Reviewed by: imp, tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33408 (cherry picked from commit c5f24f5e0db24c8e33e6278a4fbb7e68364ca18d)
-rw-r--r--stand/libsa/net.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/stand/libsa/net.c b/stand/libsa/net.c
index 3142616a5bf0..e04a370e466e 100644
--- a/stand/libsa/net.c
+++ b/stand/libsa/net.c
@@ -101,10 +101,9 @@ sendrecv(struct iodesc *d,
tmo = MINTMO;
tlast = 0;
tleft = 0;
- tref = getsecs();
- t = getsecs();
+ tref = t = getsecs();
for (;;) {
- if (MAXWAIT > 0 && (getsecs() - tref) >= MAXWAIT) {
+ if (MAXWAIT > 0 && (t - tref) >= MAXWAIT) {
errno = ETIMEDOUT;
return -1;
}