* [PATCH, applied] fedabipkgdiff: Add timing data in debug logs
@ 2023-04-07 18:13 Dodji Seketeli
0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2023-04-07 18:13 UTC (permalink / raw)
To: libabigail
Hello,
This patch adds elapsed timing data to the debug logs emitted by the
"log_call" decorator.
* tools/fedabipkgdiff (log_call): Log the time taken by the
decorated function.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
tools/fedabipkgdiff | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/fedabipkgdiff b/tools/fedabipkgdiff
index 86bf0048..960b15a6 100755
--- a/tools/fedabipkgdiff
+++ b/tools/fedabipkgdiff
@@ -30,6 +30,9 @@ import xdg.BaseDirectory
import rpm
import koji
+from timeit import default_timer as timer
+from datetime import timedelta
+
# @file
#
# You might have known that abipkgdiff is a command line tool to compare two
@@ -261,8 +264,12 @@ def log_call(func):
func.__name__,
args if args else '',
kwargs if kwargs else '')
+ start = timer()
result = func(*args, **kwargs)
- logger.debug('Result from %s: %s', func.__name__, result)
+ end = timer();
+ elapsed_type = timedelta(seconds=end-start)
+ logger.debug('Result from %s: %s, in: %s',
+ func.__name__, result, elapsed_type)
return result
return proxy
--
2.39.2
--
Dodji
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-07 18:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-07 18:13 [PATCH, applied] fedabipkgdiff: Add timing data in debug logs Dodji Seketeli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).