From 2c25baf4caa8a74db63f89cbebb052df5bf915d6 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 16 Aug 2018 08:28:33 -0400 Subject: [PATCH] Reduce calls to _monotonic_time iowaiter overhead can be significantly reduced by not calling monotonic_time() for every single one that is waiting. Change-Id: I7ee5cd78541d722f4a11898dcd4a3390b8220a95 --- pyghmi/ipmi/private/session.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index afbfc83f..9c647d82 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -124,8 +124,9 @@ def define_worker(): # deadline if they still have time waiting, or # if they have expired, wake them now to let them # process their timeout + rightnow = _monotonic_time() for idx, w in enumerate(list(directediowaiters[d])): - ltimeout = w[0] - _monotonic_time() + ltimeout = w[0] - rightnow if ltimeout < 0: w[1].set() # time is up, wake the caller del directediowaiters[d][idx]