Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: man/, /, man/include/
Date: Thu, 18 Jul 2019 18:36:14
Message-Id: 1563474859.94ca500baf225994b88f750262c0895553c70a8a.grobian@gentoo
1 commit: 94ca500baf225994b88f750262c0895553c70a8a
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jul 18 18:34:19 2019 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 18 18:34:19 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=94ca500b
7
8 qlop: enhance running time indicator
9
10 Fix elapsed time mode (-t) when using -r displaying the elapsed time
11 also as the ETA. When using -v, display what ETA is being used (average
12 or longest run).
13
14 Also, better document which flags can be combined with -r.
15
16 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
17
18 man/include/qlop.optdesc.yaml | 7 +++++--
19 man/qlop.1 | 7 +++++--
20 qlop.c | 47 +++++++++++++++++++++++++------------------
21 3 files changed, 37 insertions(+), 24 deletions(-)
22
23 diff --git a/man/include/qlop.optdesc.yaml b/man/include/qlop.optdesc.yaml
24 index 19f56db..463a19d 100644
25 --- a/man/include/qlop.optdesc.yaml
26 +++ b/man/include/qlop.optdesc.yaml
27 @@ -50,5 +50,8 @@ running: |
28 Print operations currently in progress. An ETA is calculated based
29 on the average for the operation. If the elapsed exceeds the
30 average, the ETA is calculated against the longest time observed for
31 - the operation. If the elapsed time exceeds this too, or no previous
32 - occurrences for the operation exist, \fIunknown\fR is printed.
33 + the operation. The \fB-v\fR flag will display which mode is
34 + currently used. If the elapsed time also exceeds the longest time
35 + observed, or no previous occurrences for the operation exist,
36 + \fIunknown\fR is printed. When combined with \fB-t\fR the
37 + elapsed time is also displayed.
38
39 diff --git a/man/qlop.1 b/man/qlop.1
40 index 10eaa27..909ebdc 100644
41 --- a/man/qlop.1
42 +++ b/man/qlop.1
43 @@ -72,8 +72,11 @@ Report time at which the operation finished (iso started).
44 Print operations currently in progress. An ETA is calculated based
45 on the average for the operation. If the elapsed exceeds the
46 average, the ETA is calculated against the longest time observed for
47 -the operation. If the elapsed time exceeds this too, or no previous
48 -occurrences for the operation exist, \fIunknown\fR is printed.
49 +the operation. The \fB-v\fR flag will display which mode is
50 +currently used. If the elapsed time also exceeds the longest time
51 +observed, or no previous occurrences for the operation exist,
52 +\fIunknown\fR is printed. When combined with \fB-t\fR the
53 +elapsed time is also displayed.
54 .TP
55 \fB\-d\fR \fI<arg>\fR, \fB\-\-date\fR \fI<arg>\fR
56 Limit the selection of packages to the date given, or to the range
57
58 diff --git a/qlop.c b/qlop.c
59 index e20c97b..fce0f69 100644
60 --- a/qlop.c
61 +++ b/qlop.c
62 @@ -773,14 +773,17 @@ static int do_emerge_log(
63 array_for_each(merge_matches, i, pkgw) {
64 size_t j;
65 time_t maxtime = 0;
66 + bool isMax = false;
67
68 elapsed = tstart - pkgw->tbegin;
69 pkg = NULL;
70 array_for_each(merge_averages, j, pkg) {
71 if (atom_compare(pkg->atom, pkgw->atom) == EQUAL) {
72 maxtime = pkg->time / pkg->cnt;
73 - if (elapsed >= maxtime)
74 + if (elapsed >= maxtime) {
75 maxtime = elapsed >= pkg->tbegin ? 0 : pkg->tbegin;
76 + isMax = true;
77 + }
78 break;
79 }
80 pkg = NULL;
81 @@ -797,52 +800,56 @@ static int do_emerge_log(
82 }
83
84 if (flags->do_time) {
85 - printf("%s >>> %s: %s...%s ETA: %s\n",
86 + printf("%s >>> %s: %s",
87 fmt_date(flags, pkgw->tbegin, 0),
88 atom_format(flags->fmt, pkgw->atom),
89 - fmt_elapsedtime(flags, elapsed),
90 - p == NULL ? "" : p,
91 - maxtime == 0 ? "unknown" :
92 - fmt_elapsedtime(flags, maxtime - elapsed));
93 + fmt_elapsedtime(flags, elapsed));
94 } else {
95 - printf("%s >>> %s...%s ETA: %s\n",
96 + printf("%s >>> %s",
97 fmt_date(flags, pkgw->tbegin, 0),
98 - atom_format(flags->fmt, pkgw->atom),
99 - p == NULL ? "" : p,
100 - maxtime == 0 ? "unknown" :
101 - fmt_elapsedtime(flags, maxtime - elapsed));
102 + atom_format(flags->fmt, pkgw->atom));
103 }
104 + printf("...%s ETA: %s%s\n",
105 + p == NULL ? "" : p,
106 + maxtime == 0 ? "unknown" :
107 + fmt_elapsedtime(flags, maxtime - elapsed),
108 + maxtime > 0 && verbose ?
109 + isMax ? " (longest run)" : " (average run)" : "");
110 }
111 array_for_each(unmerge_matches, i, pkgw) {
112 size_t j;
113 time_t maxtime = 0;
114 + bool isMax = false;
115
116 elapsed = tstart - pkgw->tbegin;
117 pkg = NULL;
118 array_for_each(unmerge_averages, j, pkg) {
119 if (atom_compare(pkg->atom, pkgw->atom) == EQUAL) {
120 maxtime = pkg->time / pkg->cnt;
121 - if (elapsed >= maxtime)
122 + if (elapsed >= maxtime) {
123 maxtime = elapsed >= pkg->tbegin ? 0 : pkg->tbegin;
124 + isMax = true;
125 + }
126 break;
127 }
128 pkg = NULL;
129 }
130
131 if (flags->do_time) {
132 - printf("%s <<< %s: %s... ETA: %s\n",
133 + printf("%s <<< %s: %s",
134 fmt_date(flags, pkgw->tbegin, 0),
135 atom_format(flags->fmt, pkgw->atom),
136 - fmt_elapsedtime(flags, elapsed),
137 - maxtime == 0 ? "unknown" :
138 - fmt_elapsedtime(flags, maxtime - elapsed));
139 + fmt_elapsedtime(flags, elapsed));
140 } else {
141 - printf("%s <<< %s... ETA: %s\n",
142 + printf("%s <<< %s",
143 fmt_date(flags, pkgw->tbegin, 0),
144 - atom_format(flags->fmt, pkgw->atom),
145 - maxtime == 0 ? "unknown" :
146 - fmt_elapsedtime(flags, maxtime - elapsed));
147 + atom_format(flags->fmt, pkgw->atom));
148 }
149 + printf("... ETA: %s%s\n",
150 + maxtime == 0 ? "unknown" :
151 + fmt_elapsedtime(flags, maxtime - elapsed),
152 + maxtime > 0 && verbose ?
153 + isMax ? " (longest run)" : " (average run)" : "");
154 }
155 } else if (flags->do_average) {
156 size_t total_merges = 0;