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

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

Open
akhan3 opened this issue Sep 23, 2019 · 0 comments
Open

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

akhan3 opened this issue Sep 23, 2019 · 0 comments

Comments

@akhan3
Copy link

akhan3 commented Sep 23, 2019

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.
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

No branches or pull requests

1 participant