Skip to content

stdbuf and mawk cause an extremely long delay in CPU usage updates #16

@akhan3

Description

@akhan3

On a system, where mawk is the default awk instead of gawk (for example, Raspbian Stretch), the following will fail to give any output until all the samples are produced. For default settings, this will cause a delay of 60x10 seconds between CPU usage updates.

vmstat -n "$refresh_interval" "$samples_count" \
| stdbuf -o0 awk 'NR>2 {print 100-$(NF-2)}'

I propose two solutions:

  • Replace awk with /usr/bin/gawk everywhere in the code and list gawk as a dependency.
  • Adapt the code so that stdbuf and mawk can produce streaming output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions