LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: balbir@in.ibm.com, rdunlap@xenotime.net, jlan@sgi.com,
	linux-kernel@vger.kernel.org
Subject: Re: taskstats accounting info
Date: Mon, 19 Mar 2007 08:35:12 -0700	[thread overview]
Message-ID: <20070319083512.908fc695.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20070315110655.5a815f2e.akpm@linux-foundation.org>

On Thu, 15 Mar 2007 11:06:55 -0800 Andrew Morton wrote:

> > On Wed, 14 Mar 2007 17:48:32 +0530 Balbir Singh <balbir@in.ibm.com> wrote:
> > Randy.Dunlap wrote:
> > > Hi,
> > > 
> > > Documentation/accounting/delay-accounting.txt says that the
> > > getdelays program has a "-c cmd" argument, but that option
> > > does not seem to exist in Documentation/account/getdelays.c.
> > > 
> > > Do you have an updated version of getdelays.c?
> > > If not, please correct that documentation.
> > > 
> > 
> > Yes, I did, but then I changed my laptop. I should have it archived
> > at some place, I'll dig it out or correct the documentation.
> > 
> > > Is getdelays.c the best available example of a program
> > > using the taskstats netlink interface?
> > > 
> > 
> > It's the most portable example, since it does not depend on libnl.
> 
> err, what is libnl?

lib-netlink (as already answered, but I wrote this last week)

> If there exists some real userspace infrastructure which utilises
> taskstats, can we please get a referece to it into the kernel
> Documentation?  Perhaps in the TASKSTATS Kconfig entry, thanks.


Balbir, I was working with getdelays.c when I initially wrote
these questions.  Here is a small patch for it.  Hopefully you can
use it when you find the updated version of it.

~Randy

From: Randy Dunlap <randy.dunlap@oracle.com>

1.  add usage() function

2.  add unknown character in %c format (was only in %d, not useful):

./getdelays: invalid option -- h
Unknown option '?' (63)

instead of:

./getdelays: invalid option -- h
Unknown option 63

(or just remove that message)

3.  -v does not use an optarg, so remove ':' in getopt string after 'v';

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 getdelays.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

--- old/Documentation/accounting/getdelays.c
+++ new/Documentation/accounting/getdelays.c
@@ -72,6 +72,15 @@ struct msgtemplate {
 
 char cpumask[100+6*MAX_CPUS];
 
+static void usage(void)
+{
+	fprintf(stderr, "getdelays [-dilv] [-w logfile] [-r bufsize] [-m cpumask] [-t tgid] [-p pid]\n");
+	fprintf(stderr, "  -d: print delayacct stats\n");
+	fprintf(stderr, "  -i: print IO accounting\n");
+	fprintf(stderr, "  -l: listen forever\n");
+	fprintf(stderr, "  -v: debug on\n");
+}
+
 /*
  * Create a raw netlink socket and bind
  */
@@ -227,7 +236,7 @@ int main(int argc, char *argv[])
 	struct msgtemplate msg;
 
 	while (1) {
-		c = getopt(argc, argv, "diw:r:m:t:p:v:l");
+		c = getopt(argc, argv, "diw:r:m:t:p:vl");
 		if (c < 0)
 			break;
 
@@ -277,7 +286,8 @@ int main(int argc, char *argv[])
 			loop = 1;
 			break;
 		default:
-			printf("Unknown option %d\n", c);
+			printf("Unknown option '%c' (%d)\n", c, c);
+			usage();
 			exit(-1);
 		}
 	}

  parent reply	other threads:[~2007-03-19 15:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-14 12:12 Randy.Dunlap
2007-03-14 12:18 ` Balbir Singh
2007-03-15 19:06   ` Andrew Morton
2007-03-15 22:37     ` Balbir Singh
2007-03-19 15:35     ` Randy Dunlap [this message]
2007-03-21  3:59       ` Balbir Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070319083512.908fc695.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@in.ibm.com \
    --cc=jlan@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    --subject='Re: taskstats accounting info' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).