From 216e366696688fd0da7a3f94e2f0838a7004bb01 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Fri, 7 Apr 2023 14:44:32 +0200 Subject: [PATCH] fedabipkgdiff: Add timing data in debug logs 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 --- 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.34.1