mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: David Ahern <dsahern@gmail.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 0/5] perf tools: get --list-cmds for subcommands
Date: Thu,  2 Jan 2014 16:28:45 +0530	[thread overview]
Message-ID: <1388660330-16781-1-git-send-email-artagnon@gmail.com> (raw)

Hi Arnaldo et al,

In <20131216131628.GA2368@infradead.org>, Arnaldo Carvalho de Melo wrote:
> Don't do all those things open coded, introduce functions to print,
> concat, etc.
>
> The best thing tho, since we have all those sub sub commands in things
> like 'perf kvm', 'perf bench', etc, we could have some
> parse_options_subcmd, and make the parse options machinery aware of
> this, so that it could receive an array of subcmds and when asked for
> --list-cmds, would print that sublist, etc, i.e. make sub cmds a first
> class citizen.
>
> So I'd suggest that you first introduce functions for doing the concat
> to pass to the current infrastructure, so that we have what your patch
> provides, but prettified, then, as follow on patches, you could work on
> making the options parsing machinery aware of sub cmds.
>
> Ah, and try not using fixed sized arrays, or at least verify that space
> is available, i.e. never use strcat, use strncat, better, take a look at
> tools/perf/util/strbuf.h, I guess you can use it to build the string for
> you in a safe way and expanding the buffer as needed, etc.

Okay, so here's a first cut. util.c/ util.h might not have been the
best place to put the functions, but I couldn't think of a better
place at the moment. The series isn't ideal, but I think it's getting
close.

Thoughts?

Cc: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>

Ramkumar Ramachandra (5):
  perf kvm: introduce --list-cmds for use by scripts
  perf kmem: introduce --list-cmds
  perf lock: introduce --list-cmds
  perf mem: introduce --list-cmds
  perf sched: introduce --list-cmds

 tools/perf/builtin-kmem.c     | 15 +++++++++++----
 tools/perf/builtin-kvm.c      | 16 +++++++++++-----
 tools/perf/builtin-lock.c     | 14 ++++++++++----
 tools/perf/builtin-mem.c      | 15 ++++++++++-----
 tools/perf/builtin-sched.c    | 15 +++++++++++----
 tools/perf/perf-completion.sh |  6 +++---
 tools/perf/util/util.c        | 24 ++++++++++++++++++++++++
 tools/perf/util/util.h        |  4 ++++
 8 files changed, 84 insertions(+), 25 deletions(-)

-- 
1.8.5.2.227.g53f3478


             reply	other threads:[~2014-01-02 10:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-02 10:58 Ramkumar Ramachandra [this message]
2014-01-02 10:58 ` [PATCH 1/5] perf kvm: introduce --list-cmds for use by scripts Ramkumar Ramachandra
2014-01-02 10:58 ` [PATCH 2/5] perf kmem: introduce --list-cmds Ramkumar Ramachandra
2014-01-02 10:58 ` [PATCH 3/5] perf lock: " Ramkumar Ramachandra
2014-01-02 10:58 ` [PATCH 4/5] perf mem: " Ramkumar Ramachandra
2014-01-02 10:58 ` [PATCH 5/5] perf sched: " Ramkumar Ramachandra
2014-01-09 10:50 ` [PATCH 0/5] perf tools: get --list-cmds for subcommands Ramkumar Ramachandra

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=1388660330-16781-1-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®