Re: [hackers] [ubase][PATCH] Add vmstat
On Tue, 5 Nov 2019 12:03:04 -0800
Michael Forney <mforney_AT_mforney.org> wrote:
> On 2019-11-05, Mattias Andrée <maandree_AT_kth.se> wrote:
> > On Sat, 2 Nov 2019 12:33:58 -0700
> > Michael Forney <mforney_AT_mforney.org> wrote:
> >
> >> I've never used vmstat before, but this looks pretty good overall and
> >> seems to work well.
> >>
> >> On 2019-10-05, Mattias Andrée <maandree_AT_kth.se> wrote:
> >> > + goto beginning;
> >> > + for (; argc && (argc < 2 || i < count); i++) {
> >>
> >> Why not just set count = 1 when argc < 2?
> >
> > Because that would stop the loop after 1 iteration.
> > If argc == 1, the loop should be infinite.
>
> Oh, right.
>
> > An alternative that would work is:
> >
> > for (;;) {
> > load_vm(&vm[i & 1]);
> > print_vm(&vm[i & 1], &vm[~i & 1], active_mem, timestamp, one_header ? !i :
> > (i % 50 == 0));
> > i++;
> > if (!argc || (argc == 2 && i == count))
> > break;
> > clock_nanosleep(CLOCK_MONOTONIC, 0, &delay, NULL);
> > }
>
> FWIW, I like this approach.
I will make a new version with that approach then.
Received on Tue Nov 05 2019 - 21:25:49 CET
This archive was generated by hypermail 2.3.0
: Tue Nov 05 2019 - 21:36:27 CET