From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2D7C3138334 for ; Thu, 18 Jul 2019 18:36:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6C7DEE081B; Thu, 18 Jul 2019 18:36:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1EC4FE081B for ; Thu, 18 Jul 2019 18:36:13 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 053D0347FFC for ; Thu, 18 Jul 2019 18:36:12 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9F8C1627 for ; Thu, 18 Jul 2019 18:36:10 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1563474859.94ca500baf225994b88f750262c0895553c70a8a.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: man/, /, man/include/ X-VCS-Repository: proj/portage-utils X-VCS-Files: man/include/qlop.optdesc.yaml man/qlop.1 qlop.c X-VCS-Directories: man/ / man/include/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 94ca500baf225994b88f750262c0895553c70a8a X-VCS-Branch: master Date: Thu, 18 Jul 2019 18:36:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 5781c3b6-5a2a-45bb-8c70-a3392dd08c3b X-Archives-Hash: 647fea7911a3f69c4c136eccc0e9b4c8 commit: 94ca500baf225994b88f750262c0895553c70a8a Author: Fabian Groffen gentoo org> AuthorDate: Thu Jul 18 18:34:19 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Thu Jul 18 18:34:19 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=94ca500b qlop: enhance running time indicator Fix elapsed time mode (-t) when using -r displaying the elapsed time also as the ETA. When using -v, display what ETA is being used (average or longest run). Also, better document which flags can be combined with -r. Signed-off-by: Fabian Groffen gentoo.org> man/include/qlop.optdesc.yaml | 7 +++++-- man/qlop.1 | 7 +++++-- qlop.c | 47 +++++++++++++++++++++++++------------------ 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/man/include/qlop.optdesc.yaml b/man/include/qlop.optdesc.yaml index 19f56db..463a19d 100644 --- a/man/include/qlop.optdesc.yaml +++ b/man/include/qlop.optdesc.yaml @@ -50,5 +50,8 @@ running: | Print operations currently in progress. An ETA is calculated based on the average for the operation. If the elapsed exceeds the average, the ETA is calculated against the longest time observed for - the operation. If the elapsed time exceeds this too, or no previous - occurrences for the operation exist, \fIunknown\fR is printed. + the operation. The \fB-v\fR flag will display which mode is + currently used. If the elapsed time also exceeds the longest time + observed, or no previous occurrences for the operation exist, + \fIunknown\fR is printed. When combined with \fB-t\fR the + elapsed time is also displayed. diff --git a/man/qlop.1 b/man/qlop.1 index 10eaa27..909ebdc 100644 --- a/man/qlop.1 +++ b/man/qlop.1 @@ -72,8 +72,11 @@ Report time at which the operation finished (iso started). Print operations currently in progress. An ETA is calculated based on the average for the operation. If the elapsed exceeds the average, the ETA is calculated against the longest time observed for -the operation. If the elapsed time exceeds this too, or no previous -occurrences for the operation exist, \fIunknown\fR is printed. +the operation. The \fB-v\fR flag will display which mode is +currently used. If the elapsed time also exceeds the longest time +observed, or no previous occurrences for the operation exist, +\fIunknown\fR is printed. When combined with \fB-t\fR the +elapsed time is also displayed. .TP \fB\-d\fR \fI\fR, \fB\-\-date\fR \fI\fR Limit the selection of packages to the date given, or to the range diff --git a/qlop.c b/qlop.c index e20c97b..fce0f69 100644 --- a/qlop.c +++ b/qlop.c @@ -773,14 +773,17 @@ static int do_emerge_log( array_for_each(merge_matches, i, pkgw) { size_t j; time_t maxtime = 0; + bool isMax = false; elapsed = tstart - pkgw->tbegin; pkg = NULL; array_for_each(merge_averages, j, pkg) { if (atom_compare(pkg->atom, pkgw->atom) == EQUAL) { maxtime = pkg->time / pkg->cnt; - if (elapsed >= maxtime) + if (elapsed >= maxtime) { maxtime = elapsed >= pkg->tbegin ? 0 : pkg->tbegin; + isMax = true; + } break; } pkg = NULL; @@ -797,52 +800,56 @@ static int do_emerge_log( } if (flags->do_time) { - printf("%s >>> %s: %s...%s ETA: %s\n", + printf("%s >>> %s: %s", fmt_date(flags, pkgw->tbegin, 0), atom_format(flags->fmt, pkgw->atom), - fmt_elapsedtime(flags, elapsed), - p == NULL ? "" : p, - maxtime == 0 ? "unknown" : - fmt_elapsedtime(flags, maxtime - elapsed)); + fmt_elapsedtime(flags, elapsed)); } else { - printf("%s >>> %s...%s ETA: %s\n", + printf("%s >>> %s", fmt_date(flags, pkgw->tbegin, 0), - atom_format(flags->fmt, pkgw->atom), - p == NULL ? "" : p, - maxtime == 0 ? "unknown" : - fmt_elapsedtime(flags, maxtime - elapsed)); + atom_format(flags->fmt, pkgw->atom)); } + printf("...%s ETA: %s%s\n", + p == NULL ? "" : p, + maxtime == 0 ? "unknown" : + fmt_elapsedtime(flags, maxtime - elapsed), + maxtime > 0 && verbose ? + isMax ? " (longest run)" : " (average run)" : ""); } array_for_each(unmerge_matches, i, pkgw) { size_t j; time_t maxtime = 0; + bool isMax = false; elapsed = tstart - pkgw->tbegin; pkg = NULL; array_for_each(unmerge_averages, j, pkg) { if (atom_compare(pkg->atom, pkgw->atom) == EQUAL) { maxtime = pkg->time / pkg->cnt; - if (elapsed >= maxtime) + if (elapsed >= maxtime) { maxtime = elapsed >= pkg->tbegin ? 0 : pkg->tbegin; + isMax = true; + } break; } pkg = NULL; } if (flags->do_time) { - printf("%s <<< %s: %s... ETA: %s\n", + printf("%s <<< %s: %s", fmt_date(flags, pkgw->tbegin, 0), atom_format(flags->fmt, pkgw->atom), - fmt_elapsedtime(flags, elapsed), - maxtime == 0 ? "unknown" : - fmt_elapsedtime(flags, maxtime - elapsed)); + fmt_elapsedtime(flags, elapsed)); } else { - printf("%s <<< %s... ETA: %s\n", + printf("%s <<< %s", fmt_date(flags, pkgw->tbegin, 0), - atom_format(flags->fmt, pkgw->atom), - maxtime == 0 ? "unknown" : - fmt_elapsedtime(flags, maxtime - elapsed)); + atom_format(flags->fmt, pkgw->atom)); } + printf("... ETA: %s%s\n", + maxtime == 0 ? "unknown" : + fmt_elapsedtime(flags, maxtime - elapsed), + maxtime > 0 && verbose ? + isMax ? " (longest run)" : " (average run)" : ""); } } else if (flags->do_average) { size_t total_merges = 0;