public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage-utils:master commit in: man/, /, man/include/
Date: Thu, 18 Jul 2019 18:36:10 +0000 (UTC)	[thread overview]
Message-ID: <1563474859.94ca500baf225994b88f750262c0895553c70a8a.grobian@gentoo> (raw)

commit:     94ca500baf225994b88f750262c0895553c70a8a
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 18 18:34:19 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> 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 <grobian <AT> 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<arg>\fR, \fB\-\-date\fR \fI<arg>\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;


             reply	other threads:[~2019-07-18 18:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18 18:36 Fabian Groffen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-01-30 14:14 [gentoo-commits] proj/portage-utils:master commit in: man/, /, man/include/ Fabian Groffen
2019-12-27 19:16 Fabian Groffen
2019-06-09  9:53 Fabian Groffen
2019-05-17 14:35 Fabian Groffen
2019-05-13 13:39 Fabian Groffen
2019-04-28  7:58 Fabian Groffen
2019-03-29 16:35 Fabian Groffen
2019-03-07 18:20 Fabian Groffen

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=1563474859.94ca500baf225994b88f750262c0895553c70a8a.grobian@gentoo \
    --to=grobian@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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