Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process tree and skip rows #55

Merged
merged 29 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
de69f27
bench: Add basic Process::get_all benchmark
vincentdephily Oct 4, 2024
90f6177
proces: Refactor process parsing
vincentdephily Oct 4, 2024
a19a85c
proces: Refactor Proc formating
vincentdephily Oct 5, 2024
f467d53
table: Allow alignment of larger columns
vincentdephily Oct 7, 2024
2912147
predict: Display emerge proces tree instead of just initial proces
vincentdephily Oct 7, 2024
c983deb
predict: Make proces depth configurable, move proces width to predict…
vincentdephily Oct 8, 2024
c77cbac
cli: Use RangeInclusive for integer bounds
vincentdephily Oct 8, 2024
b2a9abe
proces: Refactor indent printing
vincentdephily Oct 10, 2024
542481d
proces: Refactor commandline formating
vincentdephily Oct 15, 2024
60ea6f4
proces: Output ordered by pid
vincentdephily Oct 15, 2024
4b76596
proces: Replace all control chars, not just \0
vincentdephily Oct 15, 2024
d398e6b
predict: Set default `--pdepth` to 3
vincentdephily Oct 15, 2024
9364b2c
proces: Colorize pid in table output
vincentdephily Oct 21, 2024
feb3026
qa: Move config structs, avoid a clone
vincentdephily Oct 22, 2024
3498fd2
proces: Display number of skipped processes
vincentdephily Oct 23, 2024
f24ac64
conf: Make display of skipped rows optional
vincentdephily Oct 23, 2024
ab14f88
proces: Add unittest, refactor
vincentdephily Oct 25, 2024
780cebb
predict: Make sure we don't display a redundant emerge root proces
vincentdephily Oct 25, 2024
bbca6b4
proces: Colorize 'skip' row
vincentdephily Oct 26, 2024
248e28f
proces: Fix parsing of empty argument
vincentdephily Oct 28, 2024
5c34d9e
test: Make proc_hierarchy work in CI
vincentdephily Oct 28, 2024
ba073ee
docs: Update changelog
vincentdephily Oct 28, 2024
baeb512
table: Refactor header handling
vincentdephily Oct 29, 2024
cda2217
table: Refactor header() to consume self
vincentdephily Oct 29, 2024
108c1eb
table: Show elipsis for rows before `--last`
vincentdephily Oct 29, 2024
8324d81
table: Add dedicated skiprow() fn, unify skip wording
vincentdephily Oct 30, 2024
026e047
log: Show skip row for `--first`
vincentdephily Oct 30, 2024
1481285
cli/toml: Rename `elipsis` to `showskip`
vincentdephily Oct 30, 2024
0f8c759
predict: Show skip row for `--first`
vincentdephily Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# unreleased

## New features

* `predict` now displays emerge proces tree instead of just top proces
- Bevahvior configurable with `--pdepth`, `--pwidth`
- Format is a bit nicer and more colorful
* Display a placeholder for skipped rows, configurable with `--showskip`

## Bug fixes

* Don't display child emerge processes as root ones
* Fix off by one upper bound for some cli args
* Allow alignment of wider columns

# 0.7.1 2024-09-30

Maintenance release.
Expand Down
28 changes: 17 additions & 11 deletions completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ _emlop() {

case "${cmd}" in
emlop)
opts="log predict stats accuracy -f -t -H -o -F -v -h -V --from --to --header --duration --date --utc --color --output --logfile --help --version"
opts="log predict stats accuracy -f -t -H -o -F -v -h -V --from --to --header --showskip --duration --date --utc --color --output --logfile --help --version"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -36,7 +36,7 @@ _emlop() {
--from|--to|-f|-t)
COMPREPLY=($(compgen -W "1h 1d 1w 1m 1h $(date -Is)" "${cur}"))
;;
--header|-H)
--header|-H|--showskip)
COMPREPLY=($(compgen -W "yes no" "${cur}"))
;;
--duration)
Expand Down Expand Up @@ -64,7 +64,7 @@ _emlop() {
return 0
;;
emlop__accuracy)
opts="[search]... -e -s -n -f -t -H -o -F -v -h --exact --show --last --avg --limit --from --to --header --duration --date --utc --color --output --logfile --help"
opts="[search]... -e -s -n -f -t -H -o -F -v -h --exact --show --last --avg --limit --from --to --header --showskip --duration --date --utc --color --output --logfile --help"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -73,7 +73,7 @@ _emlop() {
--from|--to|-f|-t)
COMPREPLY=($(compgen -W "1h 1d 1w 1m 1h $(date -Is)" "${cur}"))
;;
--header|-H)
--header|-H|--showskip)
COMPREPLY=($(compgen -W "yes no" "${cur}"))
;;
--duration)
Expand Down Expand Up @@ -117,7 +117,7 @@ _emlop() {
return 0
;;
emlop__log)
opts=" [search]... -N -n -s -e -f -t -H -o -F -v -h --starttime --first --last --show --exact --from --to --header --duration --date --utc --color --output --logfile --help"
opts=" [search]... -N -n -s -e -f -t -H -o -F -v -h --starttime --first --last --show --exact --from --to --header --showskip --duration --date --utc --color --output --logfile --help"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -126,8 +126,8 @@ _emlop() {
--from|--to|-f|-t)
COMPREPLY=($(compgen -W "1h 1d 1w 1m 1h $(date -Is)" "${cur}"))
;;
--header|-H)
COMPREPLY=($(compgen -W "yes no ${opts}" "${cur}"))
--header|-H|--showskip)
COMPREPLY=($(compgen -W "yes no" "${cur}"))
;;
--duration)
COMPREPLY=($(compgen -W "hms secs hmsfixed human" "${cur}"))
Expand Down Expand Up @@ -167,7 +167,7 @@ _emlop() {
return 0
;;
emlop__predict)
opts="-s -N -n -f -t -H -o -F -v -h --show --first --last --tmpdir --resume --unknown --avg --limit --from --to --header --duration --date --utc --color --output --logfile --help"
opts="-s -N -n -f -t -H -o -F -v -h --show --first --last --tmpdir --resume --unknown --avg --limit --from --to --header --showskip --duration --date --utc --color --output --pdepth --pwidth --logfile --help"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -176,7 +176,7 @@ _emlop() {
--from|--to|-f|-t)
COMPREPLY=($(compgen -W "1h 1d 1w 1m 1h $(date -Is)" "${cur}"))
;;
--header|-H)
--header|-H|--showskip)
COMPREPLY=($(compgen -W "yes no" "${cur}"))
;;
--duration)
Expand All @@ -191,6 +191,12 @@ _emlop() {
--color)
COMPREPLY=($(compgen -W "yes no auto" "${cur}"))
;;
--pwidth)
COMPREPLY=($(compgen -W "10 20 40 80 160" "${cur}"))
;;
--pdepth)
COMPREPLY=($(compgen -W "0 1 3 5 7 99" "${cur}"))
;;
--output|-o)
COMPREPLY=($(compgen -W "tab columns auto" "${cur}"))
;;
Expand Down Expand Up @@ -225,7 +231,7 @@ _emlop() {
return 0
;;
emlop__stats)
opts="[search]... -s -g -e -f -t -H -o -F -v -h --show --groupby --exact --avg --limit --from --to --header --duration --date --utc --color --output --logfile --help"
opts="[search]... -s -g -e -f -t -H -o -F -v -h --show --groupby --exact --avg --limit --from --to --header --showskip --duration --date --utc --color --output --logfile --help"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -234,7 +240,7 @@ _emlop() {
--from|--to|-f|-t)
COMPREPLY=($(compgen -W "1h 1d 1w 1m 1h $(date -Is)" "${cur}"))
;;
--header|-H)
--header|-H|--showskip)
COMPREPLY=($(compgen -W "yes no" "${cur}"))
;;
--duration)
Expand Down
3 changes: 3 additions & 0 deletions completion.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ complete -c emlop -f
complete -c emlop -s f -l from -d 'Only parse log entries after <date>' -x -a "{1y 'One year ago',1m 'One month ago',1w 'One week ago',1d 'One day ago',1h 'One hour ago',(date -Is) 'Exact date'}"
complete -c emlop -s t -l to -d 'Only parse log entries before <date>' -x -a "{1y 'One year ago',1m 'One month ago',1w 'One week ago',1d 'One day ago',1h 'One hour ago',(date -Is) 'Exact date'}"
complete -c emlop -s H -l header -d 'Show table header' -f -a "yes no"
complete -c emlop -l showskip -d 'Show skipped rows' -f -a "yes no"
complete -c emlop -l duration -d 'Output durations in different formats' -x -a "hms hmsfixed human secs"
complete -c emlop -l date -d 'Output dates in different formats' -x -a "ymd ymdhms ymdhmso rfc3339 rfc2822 compact unix"
complete -c emlop -l utc -d 'Parse/display dates in UTC instead of local time' -f -a "yes no"
Expand Down Expand Up @@ -34,6 +35,8 @@ complete -c emlop -n "__fish_seen_subcommand_from predict" -l resume -d 'Use mai
complete -c emlop -n "__fish_seen_subcommand_from predict" -l unknown -d 'Assume unkown packages take <secs> seconds to merge' -x -a "0 5 10 20 60"
complete -c emlop -n "__fish_seen_subcommand_from predict" -l avg -d 'Select function used to predict durations' -x -a "arith median weighted-arith weighted-median"
complete -c emlop -n "__fish_seen_subcommand_from predict" -l limit -d 'Use the last <num> merge times to predict durations' -x -a "1 5 20 999"
complete -c emlop -n "__fish_seen_subcommand_from predict" -l pwidth -d 'Maximum width of emerge proces comandline' -x -a "10 20 40 80 160"
complete -c emlop -n "__fish_seen_subcommand_from predict" -l pdepth -d 'Maximum depth of emerge proces tree' -x -a "0 1 3 5 7 99"

complete -c emlop -n "__fish_seen_subcommand_from stats" -s s -l show -d 'Show (p)ackages, (t)otals, (s)yncs, and/or (a)ll' -x -a "ptsa"
complete -c emlop -n "__fish_seen_subcommand_from stats" -s g -l groupby -d 'Group by (y)ear, (m)onth, (w)eek, (d)ay, (n)one' -x -a "year month week day none"
Expand Down
7 changes: 7 additions & 0 deletions completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ _emlop() {
'--to=[Only parse log entries before <date>]:date: ' \
'-H+[Show table header]' \
'--header=[Show table header]' \
'--showskip=[Show skipped rows]' \
'--duration=[Output durations in different formats]:format: ' \
'--date=[Output dates in different formats]:format: ' \
'--utc=[Parse/display dates in UTC instead of local time]' \
Expand Down Expand Up @@ -47,6 +48,7 @@ _emlop() {
'--to=[Only parse log entries before <date>]:date: ' \
'-H+[Show table header]' \
'--header=[Show table header]' \
'--showskip=[Show skipped rows]' \
'--duration=[Output durations in different formats]:format: ' \
'--date=[Output dates in different formats]:format: ' \
'--utc=[Parse/display dates in UTC instead of local time]' \
Expand Down Expand Up @@ -81,12 +83,15 @@ _emlop() {
'--to=[Only parse log entries before <date>]:date: ' \
'-H+[Show table header]' \
'--header=[Show table header]' \
'--showskip=[Show skipped rows]' \
'--duration=[Output durations in different formats]:format: ' \
'--date=[Output dates in different formats]:format: ' \
'--utc=[Parse/display dates in UTC instead of local time]' \
'--color=[Enable color (yes/no/auto)]' \
'-o+[Ouput format (columns/tab/auto)]:format: ' \
'--output=[Ouput format (columns/tab/auto)]:format: ' \
'--pwidth=[Maximum width of emerge proces comandline]'
'--pdepth=[Maximum depth of emerge proces tree]'
'-F+[Location of emerge log file]:file: ' \
'--logfile=[Location of emerge log file]:file: ' \
'*-v[Increase verbosity (can be given multiple times)]' \
Expand All @@ -107,6 +112,7 @@ _emlop() {
'--to=[Only parse log entries before <date>]:date: ' \
'-H+[Show table header]' \
'--header=[Show table header]' \
'--showskip=[Show skipped rows]' \
'--duration=[Output durations in different formats]:format: ' \
'--date=[Output dates in different formats]:format: ' \
'--utc=[Parse/display dates in UTC instead of local time]' \
Expand Down Expand Up @@ -136,6 +142,7 @@ _emlop() {
'--to=[Only parse log entries before <date>]:date: ' \
'-H+[Show table header]' \
'--header=[Show table header]' \
'--showskip=[Show skipped rows]' \
'--duration=[Output durations in different formats]:format: ' \
'--date=[Output dates in different formats]:format: ' \
'--utc=[Parse/display dates in UTC instead of local time]' \
Expand Down
3 changes: 3 additions & 0 deletions emlop.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# header = true
# color = "yes"
# output = "columns"
# showskip = true
[log]
# show = "mus"
# starttime = true
Expand All @@ -21,6 +22,8 @@
# limit = 20
# unknown = 300
# tmpdir = ["/foo", "/bar"]
# pwidth = 60
# pdepth = 3
[stats]
# show = "pts"
# avg = "arith"
Expand Down
Loading