Re: [PATCH] Documentation: fix getdelays.c example -l option and segv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In message <[email protected]> you wrote:
> Michael Neuling wrote:
> > Fix a couple of minor issues with the getdelays.c example code. 
> > 
> > Signed-off-by: Michael Neuling <[email protected]>
> > ---
> >  Documentation/accounting/getdelays.c |   21 +++++++++++----------
> >  1 file changed, 11 insertions(+), 10 deletions(-)
> > 
> > Index: linux-2.6-ozlabs/Documentation/accounting/getdelays.c
> > ===================================================================
> > --- linux-2.6-ozlabs.orig/Documentation/accounting/getdelays.c
> > +++ linux-2.6-ozlabs/Documentation/accounting/getdelays.c
> > @@ -196,7 +196,7 @@ void print_delayacct(struct taskstats *t
> >  	       "IO    %15s%15s\n"
> >  	       "      %15llu%15llu\n"
> >  	       "MEM   %15s%15s\n"
> > -	       "      %15llu%15llu\n"
> > +	       "      %15llu%15llu\n",
> 
> This change looks good!

Looks like it was randomly removed in b663a79c191508f27cd885224b592a878c0ba0f6.

> 
> >  	       "count", "real total", "virtual total", "delay total",
> >  	       t->cpu_count, t->cpu_run_real_total, t->cpu_run_virtual_total,
> >  	       t->cpu_delay_total,
> > @@ -335,17 +335,17 @@ int main(int argc, char *argv[])
> >  		}
> >  	}
> > 
> > -	if (tid) {
> > -		rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
> > -			      cmd_type, &tid, sizeof(__u32));
> > -		PRINTF("Sent pid/tgid, retval %d\n", rc);
> > -		if (rc < 0) {
> > -			fprintf(stderr, "error sending tid/tgid cmd\n");
> > -			goto done;
> > +	do {
> > +		if (tid) {
> > +			rc = send_cmd(nl_sd, id, mypid, TASKSTATS_CMD_GET,
> > +				      cmd_type, &tid, sizeof(__u32));
> > +			PRINTF("Sent pid/tgid, retval %d\n", rc);
> > +			if (rc < 0) {
> > +				fprintf(stderr, "error sending tid/tgid cmd\n")
;
> > +				goto done;
> > +			}
> >  		}
> > -	}
> > 
> > -	do {
> >  		int i;
> > 
> >  		rep_len = recv(nl_sd, &msg, sizeof(msg), 0);
> > @@ -430,6 +430,7 @@ int main(int argc, char *argv[])
> >  			}
> >  			na = (struct nlattr *) (GENLMSG_DATA(&msg) + len);
> >  		}
> > +		sleep(2);
> 
> Is this really required? a sleep() in the code. Why do we do multiple
> send_cmd()'s in the do loop? I'll test and get back.

I needed to send another command to receive more data.  Without the per
loop send_cmd, I never got any more stats. 

Should we receive more data without the additional send_cmd?  I've been
running with: 
  ./getdelays -d -p 1 -l

Mikey


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux