Skip to content

Conversation

@tklauser
Copy link
Contributor

@tklauser tklauser commented Jul 1, 2021

Two followups for #143:

    Restore CPU usage report format

    Commit 78435f89 changed the existing output format for the CPU usage
    from `cpu usage:` to `cpu usage (all):`.

    This might break existing scripts relying on this format. Revert that
    part of the change and only report the CPU usage for the given period
    with a suffix:

    cpu usage:      0.087%
    cpu usage (1s): 1.42%

and

    Allow to specify CPU usage period as duration string

    The current implementation assumes the given duration in seconds.
    Instead, also allow to specify a duration in the format as expected by
    `time.ParseDuration` and use that if found. If a plain integer is
    specified, it is still parsed as a duration in seconds.

Commit 78435f8 changed the existing output format for the CPU usage
from `cpu usage:` to `cpu usage (all):`.

This might break existing scripts relying on this format. Revert that
part of the change and only report the CPU usage for the given period
with a suffix:

cpu usage:	0.087%
cpu usage (1s):	1.42%
@tklauser tklauser force-pushed the pr/tklauser/cpu-usage-period-fix branch from 70595ae to 18faab0 Compare July 1, 2021 08:26
The current implementation assumes the given duration in seconds.
Instead, also allow to specify a duration in the format as expected by
`time.ParseDuration` and use that if found. If a plain integer is
specified, it is still parsed as a duration in seconds.
@tklauser tklauser force-pushed the pr/tklauser/cpu-usage-period-fix branch from 18faab0 to 0b58032 Compare July 1, 2021 08:27
@tklauser tklauser merged commit 8918f15 into master Jul 1, 2021
@tklauser tklauser deleted the pr/tklauser/cpu-usage-period-fix branch July 1, 2021 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant