Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 658824 - app-portage/portage-utils: add world compile time to qlop
Summary: app-portage/portage-utils: add world compile time to qlop
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Fabian Groffen
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-23 13:16 UTC by rudregues
Modified: 2019-06-06 07:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rudregues 2018-06-23 13:16:10 UTC
I did a command to calculate the world compile time by listing all installed packages with qlist and using the average compile time of each of them provided by qlop. The output would be in HH:MM:SS format. I documented this in the forum (https://forums.gentoo.org/viewtopic-t-1078212.html) but not everyone reads the forum so I think it would be nice to have it officially.

The command is:
qlist -I | xargs qlop -t | awk '{secs += $2} END { printf("%dh:%dm:%ds\n", secs / 3600, (secs % 3600) / 60, secs % 60); }'

My suggestion of syntax would be qlop --world



Reproducible: Always
Comment 1 rudregues 2018-06-23 13:20:30 UTC
In the same forum thread, some people had huge calculated times. Probably this is caused by some packages having it's compile times calculated wrong by qlop -t or even the files that qlop uses for this are with wrong values. Anyway, I did some commands to solve this issue:

1) Calculating total sum excluding outliers defined by the user. I want everything bigger than 5400 seconds (1h30min) to be removed from calculation:
qlist -I | xargs qlop -t | awk '{ if ($2 < 5400) secs += $2} END { printf("%dh:%dm:%ds\n", secs / 3600, (secs % 3600) / 60, secs % 60); }'

2) Discovering the problematic build times (maybe report a bug?). I want to point out which packages build times are bigger than 5400 seconds (1h30min):
qlist -I | xargs qlop -t | awk '{ if ($2 > 5400) printf("%s  %dd:%dh:%dm:%ds\n", $1, $2 / 86400, ($2 % 86400) / 3600, ($2 % 3600) / 60, $2 % 60); }'
Comment 2 Fabian Groffen gentoo-dev 2018-07-04 06:24:17 UTC
qlop isn't perfect (and with the current portage log-format is never going to be), your script seems "trivial" enough though to be used as script (adding C-support for it would basically mimick that).
Comment 3 Fabian Groffen gentoo-dev 2019-01-31 12:13:02 UTC
the trickery needed for 161244 is likely allowing this kind of work to be done more easily as well
Comment 4 Larry the Git Cow gentoo-dev 2019-02-27 20:53:31 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c74a5abf3fd8db03adb531f95ecff5316d997ab3

commit c74a5abf3fd8db03adb531f95ecff5316d997ab3
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2019-02-27 20:41:45 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2019-02-27 20:50:21 +0000

    qlop: rewrite from scratch
    
    This new implementation achieves a few things:
    - unified code path for all modes of operation (thus consistent results)
    - more flexibility to implement new features
    - simplification of the codebase
    
    Short version of what this commit changes:
    - existing flags -t -g have been replaced with -a and -t
    - -c has been been replaced with -r and no longer uses proc processing
      code (thus works everywhere)
    - addition of an ETA for running emerges (subject to improvements)
    - allow reading a file of atoms (e.g. /var/lib/portage/world)
    - summary mode -c to compute grand total, e.g. to compute world compile
      time
    
    Bug: https://bugs.gentoo.org/161244
    Bug: https://bugs.gentoo.org/603024
    Bug: https://bugs.gentoo.org/636334
    Bug: https://bugs.gentoo.org/658824
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 man/include/qlop.desc         |   25 +-
 man/include/qlop.optdesc.yaml |   23 +-
 man/qlop.1                    |   66 +-
 qlop.c                        | 1479 +++++++++++++++++++++--------------------
 tests/qlop/dotest             |   20 +-
 tests/qlop/list01.good        |    4 +-
 tests/qlop/list02.good        |    6 +-
 tests/qlop/list03.good        |    8 +-
 tests/qlop/list04.good        |    2 +-
 tests/qlop/list05.good        |    2 +-
 tests/qlop/list06.good        |    4 +-
 tests/qlop/list07.good        |    4 +-
 tests/qlop/list08.good        |    4 +-
 tests/qlop/list09.good        |    6 +-
 14 files changed, 892 insertions(+), 761 deletions(-)
Comment 5 Fabian Groffen gentoo-dev 2019-02-27 21:02:14 UTC
(In reply to rudregues from comment #1)
> In the same forum thread, some people had huge calculated times. Probably
> this is caused by some packages having it's compile times calculated wrong
> by qlop -t or even the files that qlop uses for this are with wrong values.
> Anyway, I did some commands to solve this issue:
> 
> 1) Calculating total sum excluding outliers defined by the user. I want
> everything bigger than 5400 seconds (1h30min) to be removed from calculation:
> qlist -I | xargs qlop -t | awk '{ if ($2 < 5400) secs += $2} END {
> printf("%dh:%dm:%ds\n", secs / 3600, (secs % 3600) / 60, secs % 60); }'

./qlop -c
[snip]
dev-db/postgresql: 74 seconds average for 1 unmerge
app-eselect/eselect-postgresql: 3 seconds average for 1 unmerge
app-admin/pwgen: 5 seconds average for 2 unmerges
sync: 80 seconds average for 1 sync
total: 265109 seconds for 2086 merges, 74 unmerges, 1 sync

(can't do the exclusions, but to be honest, I find that a bit weird)

> 2) Discovering the problematic build times (maybe report a bug?). I want to
> point out which packages build times are bigger than 5400 seconds (1h30min):
> qlist -I | xargs qlop -t | awk '{ if ($2 > 5400) printf("%s 
> %dd:%dh:%dm:%ds\n", $1, $2 / 86400, ($2 % 86400) / 3600, ($2 % 3600) / 60,
> $2 % 60); }'

./qlop -mt
[snip]
2019-02-27T18:31:32 >>> dev-db/sqlite-3.27.1: 115 seconds
2019-02-27T18:33:27 >>> dev-python/pyopenssl-19.0.0: 42 seconds
2019-02-27T18:34:09 >>> dev-libs/libpcre-8.43: 89 seconds
2019-02-27T18:35:38 >>> net-dns/bind-tools-9.12.3_p4: 279 seconds
2019-02-27T18:40:17 >>> dev-vcs/git-2.21.0: 166 seconds

should be easy enough to grep from here to find your offenders
Comment 6 Fabian Groffen gentoo-dev 2019-06-06 07:32:47 UTC
this is available onwards from 0.80_pre*