aboutsummaryrefslogtreecommitdiffstats
path: root/lib/_emerge/depgraph.py
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-01-05 16:26:41 +0100
committerSam James <sam@gentoo.org>2023-01-10 03:28:46 +0000
commit7b47c30537c58c6c9a25b18959c58de85067634d (patch)
treeb6e7048017e4819ac4179b1ad50ffb8526372b88 /lib/_emerge/depgraph.py
parentemerge: depgraph: Correctly detect installation from path for binpkgs (diff)
downloadgentoo-portage-7b47c30537c58c6c9a25b18959c58de85067634d.tar.xz
gentoo-portage-7b47c30537c58c6c9a25b18959c58de85067634d.zip
depgraph: Print dependency resolution time
Print the wall clock time it took emerge to calculate the dependency graph if spinner is used (i.e. we're in verbose mode). Requested-by: Maciej Barć <xgqt@gentoo.org> Signed-off-by: Michał Górny <mgorny@gentoo.org> Closes: https://github.com/gentoo/portage/pull/972 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'lib/_emerge/depgraph.py')
-rw-r--r--lib/_emerge/depgraph.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 4d7a96a2d28e..15dcfbc840c0 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -6,6 +6,7 @@ import functools
import logging
import stat
import textwrap
+import time
import warnings
import collections
from collections import deque, OrderedDict
@@ -11522,6 +11523,7 @@ def _spinner_start(spinner, myopts):
if show_spinner:
portage.writemsg_stdout("Calculating dependencies ")
+ spinner.start_time = time.time()
def _spinner_stop(spinner):
@@ -11535,6 +11537,10 @@ def _spinner_stop(spinner):
portage.writemsg_stdout("... done!\n")
+ stop_time = time.time()
+ time_fmt = f"{stop_time - spinner.start_time:.2f}"
+ portage.writemsg_stdout(f"Dependency resolution took {darkgreen(time_fmt)} s.\n\n")
+
def backtrack_depgraph(settings, trees, myopts, myparams, myaction, myfiles, spinner):
"""