From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH, applied] fedabipkgdiff: Add timing data in debug logs
Date: Fri, 07 Apr 2023 20:13:00 +0200 [thread overview]
Message-ID: <87y1n3k1cj.fsf@redhat.com> (raw)
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
reply other threads:[~2023-04-07 18:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y1n3k1cj.fsf@redhat.com \
--to=dodji@redhat.com \
--cc=libabigail@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).