diff options
author | 2019-07-18 20:34:19 +0200 | |
---|---|---|
committer | 2019-07-18 20:34:19 +0200 | |
commit | 94ca500baf225994b88f750262c0895553c70a8a (patch) | |
tree | 62e6650307035c08fcd91dec90767f2602d5abed /qlop.c | |
parent | applets: properly disable qtegrity when requested (diff) | |
download | portage-utils-94ca500baf225994b88f750262c0895553c70a8a.tar.gz portage-utils-94ca500baf225994b88f750262c0895553c70a8a.tar.bz2 portage-utils-94ca500baf225994b88f750262c0895553c70a8a.zip |
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@gentoo.org>
Diffstat (limited to 'qlop.c')
-rw-r--r-- | qlop.c | 47 |
1 files changed, 27 insertions, 20 deletions
@@ -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; |