* [PATCH 0/2] Completion for 'perf kvm'
@ 2013-12-11 10:34 Ramkumar Ramachandra
2013-12-11 10:34 ` [PATCH 1/2] perf completion: complete " Ramkumar Ramachandra
2013-12-11 10:34 ` [PATCH 2/2] perf tools: ignore files generated by " Ramkumar Ramachandra
0 siblings, 2 replies; 19+ messages in thread
From: Ramkumar Ramachandra @ 2013-12-11 10:34 UTC (permalink / raw)
To: LKML; +Cc: Arnaldo Carvalho de Melo
Hi,
These are based on tip/master.
Thanks.
Ramkumar Ramachandra (2):
perf completion: complete 'perf kvm'
perf tools: ignore files generated by 'perf kvm'
tools/perf/.gitignore | 2 ++
tools/perf/perf-completion.sh | 4 ++++
2 files changed, 6 insertions(+)
--
1.8.5.rc0.5.g70ebc73.dirty
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/2] perf completion: complete 'perf kvm'
2013-12-11 10:34 [PATCH 0/2] Completion for 'perf kvm' Ramkumar Ramachandra
@ 2013-12-11 10:34 ` Ramkumar Ramachandra
2013-12-11 19:50 ` Arnaldo Carvalho de Melo
2013-12-16 15:27 ` [tip:perf/core] perf completion: Complete 'perf kvm' tip-bot for Ramkumar Ramachandra
2013-12-11 10:34 ` [PATCH 2/2] perf tools: ignore files generated by " Ramkumar Ramachandra
1 sibling, 2 replies; 19+ messages in thread
From: Ramkumar Ramachandra @ 2013-12-11 10:34 UTC (permalink / raw)
To: LKML; +Cc: Arnaldo Carvalho de Melo
Currently, there is no way to enumerate the subcommands under 'perf
kvm', so hardcode them.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
tools/perf/perf-completion.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 4949488..496e2ab 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -121,6 +121,10 @@ __perf_main ()
elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
__perfcomp_colon "$evts" "$cur"
+ # List subcommands for 'perf kvm'
+ elif [[ $prev == "kvm" ]]; then
+ subcmds="top record report diff buildid-list stat"
+ __perfcomp_colon "$subcmds" "$cur"
# List long option names
elif [[ $cur == --* ]]; then
subcmd=${words[1]}
--
1.8.5.rc0.5.g70ebc73.dirty
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 1/2] perf completion: complete 'perf kvm'
2013-12-11 10:34 ` [PATCH 1/2] perf completion: complete " Ramkumar Ramachandra
@ 2013-12-11 19:50 ` Arnaldo Carvalho de Melo
2013-12-11 19:56 ` David Ahern
2013-12-16 15:27 ` [tip:perf/core] perf completion: Complete 'perf kvm' tip-bot for Ramkumar Ramachandra
1 sibling, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-11 19:50 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: LKML
Em Wed, Dec 11, 2013 at 04:04:15PM +0530, Ramkumar Ramachandra escreveu:
> Currently, there is no way to enumerate the subcommands under 'perf
> kvm', so hardcode them.
[acme@ssdandy linux]$ perf kvm -h 2>&1 | grep usage
usage: perf kvm [<options>] {top|record|report|diff|buildid-list|stat}
Can't you use this somehow?
I'm applying it tho as it is better than the current situation.
- Arnaldo
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
> tools/perf/perf-completion.sh | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
> index 4949488..496e2ab 100644
> --- a/tools/perf/perf-completion.sh
> +++ b/tools/perf/perf-completion.sh
> @@ -121,6 +121,10 @@ __perf_main ()
> elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
> evts=$($cmd list --raw-dump)
> __perfcomp_colon "$evts" "$cur"
> + # List subcommands for 'perf kvm'
> + elif [[ $prev == "kvm" ]]; then
> + subcmds="top record report diff buildid-list stat"
> + __perfcomp_colon "$subcmds" "$cur"
> # List long option names
> elif [[ $cur == --* ]]; then
> subcmd=${words[1]}
> --
> 1.8.5.rc0.5.g70ebc73.dirty
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 1/2] perf completion: complete 'perf kvm'
2013-12-11 19:50 ` Arnaldo Carvalho de Melo
@ 2013-12-11 19:56 ` David Ahern
2013-12-12 9:09 ` Ramkumar Ramachandra
0 siblings, 1 reply; 19+ messages in thread
From: David Ahern @ 2013-12-11 19:56 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ramkumar Ramachandra; +Cc: LKML
On 12/11/13, 12:50 PM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Dec 11, 2013 at 04:04:15PM +0530, Ramkumar Ramachandra escreveu:
>> Currently, there is no way to enumerate the subcommands under 'perf
>> kvm', so hardcode them.
>
> [acme@ssdandy linux]$ perf kvm -h 2>&1 | grep usage
> usage: perf kvm [<options>] {top|record|report|diff|buildid-list|stat}
>
> Can't you use this somehow?
>
> I'm applying it tho as it is better than the current situation.
I don't like the command list being embedded in the completion script.
It will get outdated quickly.
David
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 1/2] perf completion: complete 'perf kvm'
2013-12-11 19:56 ` David Ahern
@ 2013-12-12 9:09 ` Ramkumar Ramachandra
2013-12-12 16:53 ` David Ahern
0 siblings, 1 reply; 19+ messages in thread
From: Ramkumar Ramachandra @ 2013-12-12 9:09 UTC (permalink / raw)
To: David Ahern; +Cc: Arnaldo Carvalho de Melo, LKML
David Ahern wrote:
> I don't like the command list being embedded in the completion script. It
> will get outdated quickly.
I could introduce a
$ perf kvm --list-cmds
but that would mean a
printf("record report stat ..")
in builtin-kvm.c, because the commands aren't in any sort of array.
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 1/2] perf completion: complete 'perf kvm'
2013-12-12 9:09 ` Ramkumar Ramachandra
@ 2013-12-12 16:53 ` David Ahern
2013-12-12 17:26 ` [PATCH] perf kvm: introduce --list-cmds for use by scripts Ramkumar Ramachandra
0 siblings, 1 reply; 19+ messages in thread
From: David Ahern @ 2013-12-12 16:53 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: Arnaldo Carvalho de Melo, LKML
On 12/12/13, 2:09 AM, Ramkumar Ramachandra wrote:
> David Ahern wrote:
>> I don't like the command list being embedded in the completion script. It
>> will get outdated quickly.
>
> I could introduce a
>
> $ perf kvm --list-cmds
>
> but that would mean a
>
> printf("record report stat ..")
>
> in builtin-kvm.c, because the commands aren't in any sort of array.
>
That would work -- perhaps a #define or string near
const char * const kvm_usage[] = {
"perf kvm [<options>] {top|record|report|diff|buildid-list|stat}",
NULL
};
Building kvm_usage from the string would better - only 1 place listing
the commands.
David
^ permalink raw reply [flat|nested] 19+ messages in thread* [PATCH] perf kvm: introduce --list-cmds for use by scripts
2013-12-12 16:53 ` David Ahern
@ 2013-12-12 17:26 ` Ramkumar Ramachandra
2013-12-13 4:32 ` David Ahern
2013-12-16 13:16 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 19+ messages in thread
From: Ramkumar Ramachandra @ 2013-12-12 17:26 UTC (permalink / raw)
To: LKML; +Cc: David Ahern, Arnaldo Carvalho de Melo
Introduce
$ perf kvm --list-cmds
to dump a raw list of commands for use by the completion script. While
at it, refactor kvm_usage so that there's only one copy of the command
listing.
Cc: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
David Ahern wrote:
> That would work -- perhaps a #define or string near
>
> const char * const kvm_usage[] = {
> "perf kvm [<options>] {top|record|report|diff|buildid-list|stat}",
> NULL
> };
>
> Building kvm_usage from the string would better - only 1 place listing the
> commands.
Something like this, perhaps? It's not too pretty though: do you have
suggestions to prettify it?
tools/perf/builtin-kvm.c | 25 +++++++++++++++++++++----
tools/perf/perf-completion.sh | 2 +-
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index c6fa3cb..ce44a9b 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1672,6 +1672,7 @@ __cmd_buildid_list(const char *file_name, int argc, const char **argv)
int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
{
const char *file_name = NULL;
+ bool list_cmds = false;
const struct option kvm_options[] = {
OPT_STRING('i', "input", &file_name, "file",
"Input file name"),
@@ -1692,20 +1693,36 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
"file", "file saving guest os /proc/modules"),
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show counter open errors, etc)"),
+ OPT_BOOLEAN(0, "list-cmds", &list_cmds,
+ "list commands raw for use by scripts"),
OPT_END()
};
+ const char *const commands[] = { "top", "record", "report", "diff",
+ "buildid-list", "stat", NULL };
+ char kvm_usage_str[80];
+ const char *kvm_usage[] = { NULL, NULL };
- const char * const kvm_usage[] = {
- "perf kvm [<options>] {top|record|report|diff|buildid-list|stat}",
- NULL
- };
+ sprintf(kvm_usage_str, "%s", "perf kvm [<options>] {");
+ for (int i = 0; commands[i]; i++) {
+ if (i)
+ strcat(kvm_usage_str, "|");
+ strcat(kvm_usage_str, commands[i]);
+ }
+ strcat(kvm_usage_str, "}");
+
+ kvm_usage[0] = kvm_usage_str;
perf_host = 0;
perf_guest = 1;
argc = parse_options(argc, argv, kvm_options, kvm_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
+ if (list_cmds) {
+ for (int i = 0; commands[i]; i++)
+ printf("%s ", commands[i]);
+ return 0;
+ }
if (!argc)
usage_with_options(kvm_usage, kvm_options);
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 496e2ab..d8bfa43 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -123,7 +123,7 @@ __perf_main ()
__perfcomp_colon "$evts" "$cur"
# List subcommands for 'perf kvm'
elif [[ $prev == "kvm" ]]; then
- subcmds="top record report diff buildid-list stat"
+ subcmds=$($cmd kvm --list-cmds)
__perfcomp_colon "$subcmds" "$cur"
# List long option names
elif [[ $cur == --* ]]; then
--
1.8.5.1.113.g8cb5bef.dirty
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH] perf kvm: introduce --list-cmds for use by scripts
2013-12-12 17:26 ` [PATCH] perf kvm: introduce --list-cmds for use by scripts Ramkumar Ramachandra
@ 2013-12-13 4:32 ` David Ahern
2013-12-16 13:16 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 19+ messages in thread
From: David Ahern @ 2013-12-13 4:32 UTC (permalink / raw)
To: Ramkumar Ramachandra, LKML; +Cc: Arnaldo Carvalho de Melo
On 12/12/13, 10:26 AM, Ramkumar Ramachandra wrote:
> Introduce
>
> $ perf kvm --list-cmds
>
> to dump a raw list of commands for use by the completion script. While
> at it, refactor kvm_usage so that there's only one copy of the command
> listing.
>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
> David Ahern wrote:
> > That would work -- perhaps a #define or string near
> >
> > const char * const kvm_usage[] = {
> > "perf kvm [<options>] {top|record|report|diff|buildid-list|stat}",
> > NULL
> > };
> >
> > Building kvm_usage from the string would better - only 1 place listing the
> > commands.
>
> Something like this, perhaps? It's not too pretty though: do you have
> suggestions to prettify it?
>
> tools/perf/builtin-kvm.c | 25 +++++++++++++++++++++----
> tools/perf/perf-completion.sh | 2 +-
> 2 files changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
> index c6fa3cb..ce44a9b 100644
> --- a/tools/perf/builtin-kvm.c
> +++ b/tools/perf/builtin-kvm.c
> @@ -1672,6 +1672,7 @@ __cmd_buildid_list(const char *file_name, int argc, const char **argv)
> int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
> {
> const char *file_name = NULL;
> + bool list_cmds = false;
> const struct option kvm_options[] = {
> OPT_STRING('i', "input", &file_name, "file",
> "Input file name"),
> @@ -1692,20 +1693,36 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
> "file", "file saving guest os /proc/modules"),
> OPT_INCR('v', "verbose", &verbose,
> "be more verbose (show counter open errors, etc)"),
> + OPT_BOOLEAN(0, "list-cmds", &list_cmds,
> + "list commands raw for use by scripts"),
> OPT_END()
> };
>
> + const char *const commands[] = { "top", "record", "report", "diff",
> + "buildid-list", "stat", NULL };
Building it is kind of ugly looking.
Arnaldo: what about this:
#define KVM_CMDS "top record report diff buildid-list stat"
> + char kvm_usage_str[80];
> + const char *kvm_usage[] = { NULL, NULL };
>
> - const char * const kvm_usage[] = {
> - "perf kvm [<options>] {top|record|report|diff|buildid-list|stat}",
> - NULL
const char * const kvm_usage[] = {
"perf kvm [<options>] <command>, command = " KVM_CMDS,
NULL
I would even be fine with not touching kvm_usage and having the KVM_CMDS
macro right above it -- changing one causes the other to show up in a diff.
David
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] perf kvm: introduce --list-cmds for use by scripts
2013-12-12 17:26 ` [PATCH] perf kvm: introduce --list-cmds for use by scripts Ramkumar Ramachandra
2013-12-13 4:32 ` David Ahern
@ 2013-12-16 13:16 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-16 13:16 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: LKML, David Ahern
Em Thu, Dec 12, 2013 at 10:56:51PM +0530, Ramkumar Ramachandra escreveu:
> Introduce
>
> $ perf kvm --list-cmds
>
> to dump a raw list of commands for use by the completion script. While
> at it, refactor kvm_usage so that there's only one copy of the command
> listing.
>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
> David Ahern wrote:
> > That would work -- perhaps a #define or string near
> >
> > const char * const kvm_usage[] = {
> > "perf kvm [<options>] {top|record|report|diff|buildid-list|stat}",
> > NULL
> > };
> >
> > Building kvm_usage from the string would better - only 1 place listing the
> > commands.
>
> Something like this, perhaps? It's not too pretty though: do you have
> suggestions to prettify it?
Yes:
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.
- Arnaldo
> tools/perf/builtin-kvm.c | 25 +++++++++++++++++++++----
> tools/perf/perf-completion.sh | 2 +-
> 2 files changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
> index c6fa3cb..ce44a9b 100644
> --- a/tools/perf/builtin-kvm.c
> +++ b/tools/perf/builtin-kvm.c
> @@ -1672,6 +1672,7 @@ __cmd_buildid_list(const char *file_name, int argc, const char **argv)
> int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
> {
> const char *file_name = NULL;
> + bool list_cmds = false;
> const struct option kvm_options[] = {
> OPT_STRING('i', "input", &file_name, "file",
> "Input file name"),
> @@ -1692,20 +1693,36 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
> "file", "file saving guest os /proc/modules"),
> OPT_INCR('v', "verbose", &verbose,
> "be more verbose (show counter open errors, etc)"),
> + OPT_BOOLEAN(0, "list-cmds", &list_cmds,
> + "list commands raw for use by scripts"),
> OPT_END()
> };
>
> + const char *const commands[] = { "top", "record", "report", "diff",
> + "buildid-list", "stat", NULL };
> + char kvm_usage_str[80];
> + const char *kvm_usage[] = { NULL, NULL };
>
> - const char * const kvm_usage[] = {
> - "perf kvm [<options>] {top|record|report|diff|buildid-list|stat}",
> - NULL
> - };
> + sprintf(kvm_usage_str, "%s", "perf kvm [<options>] {");
> + for (int i = 0; commands[i]; i++) {
> + if (i)
> + strcat(kvm_usage_str, "|");
> + strcat(kvm_usage_str, commands[i]);
> + }
> + strcat(kvm_usage_str, "}");
> +
> + kvm_usage[0] = kvm_usage_str;
>
> perf_host = 0;
> perf_guest = 1;
>
> argc = parse_options(argc, argv, kvm_options, kvm_usage,
> PARSE_OPT_STOP_AT_NON_OPTION);
> + if (list_cmds) {
> + for (int i = 0; commands[i]; i++)
> + printf("%s ", commands[i]);
> + return 0;
> + }
> if (!argc)
> usage_with_options(kvm_usage, kvm_options);
>
> diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
> index 496e2ab..d8bfa43 100644
> --- a/tools/perf/perf-completion.sh
> +++ b/tools/perf/perf-completion.sh
> @@ -123,7 +123,7 @@ __perf_main ()
> __perfcomp_colon "$evts" "$cur"
> # List subcommands for 'perf kvm'
> elif [[ $prev == "kvm" ]]; then
> - subcmds="top record report diff buildid-list stat"
> + subcmds=$($cmd kvm --list-cmds)
> __perfcomp_colon "$subcmds" "$cur"
> # List long option names
> elif [[ $cur == --* ]]; then
> --
> 1.8.5.1.113.g8cb5bef.dirty
^ permalink raw reply [flat|nested] 19+ messages in thread
* [tip:perf/core] perf completion: Complete 'perf kvm'
2013-12-11 10:34 ` [PATCH 1/2] perf completion: complete " Ramkumar Ramachandra
2013-12-11 19:50 ` Arnaldo Carvalho de Melo
@ 2013-12-16 15:27 ` tip-bot for Ramkumar Ramachandra
1 sibling, 0 replies; 19+ messages in thread
From: tip-bot for Ramkumar Ramachandra @ 2013-12-16 15:27 UTC (permalink / raw)
To: linux-tip-commits; +Cc: acme, linux-kernel, hpa, mingo, artagnon, tglx
Commit-ID: 8f2f5ada719560954174da30ce0a67261c616e39
Gitweb: http://git.kernel.org/tip/8f2f5ada719560954174da30ce0a67261c616e39
Author: Ramkumar Ramachandra <artagnon@gmail.com>
AuthorDate: Wed, 11 Dec 2013 16:04:15 +0530
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 13 Dec 2013 10:30:21 -0300
perf completion: Complete 'perf kvm'
Currently, there is no way to enumerate the subcommands under 'perf
kvm', so hardcode them.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Link: http://lkml.kernel.org/r/1386758056-24618-2-git-send-email-artagnon@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/perf-completion.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 4949488..496e2ab 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -121,6 +121,10 @@ __perf_main ()
elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
__perfcomp_colon "$evts" "$cur"
+ # List subcommands for 'perf kvm'
+ elif [[ $prev == "kvm" ]]; then
+ subcmds="top record report diff buildid-list stat"
+ __perfcomp_colon "$subcmds" "$cur"
# List long option names
elif [[ $cur == --* ]]; then
subcmd=${words[1]}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/2] perf tools: ignore files generated by 'perf kvm'
2013-12-11 10:34 [PATCH 0/2] Completion for 'perf kvm' Ramkumar Ramachandra
2013-12-11 10:34 ` [PATCH 1/2] perf completion: complete " Ramkumar Ramachandra
@ 2013-12-11 10:34 ` Ramkumar Ramachandra
2013-12-11 20:01 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 19+ messages in thread
From: Ramkumar Ramachandra @ 2013-12-11 10:34 UTC (permalink / raw)
To: LKML; +Cc: Arnaldo Carvalho de Melo
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
tools/perf/.gitignore | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 782d86e..28264a9 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -13,6 +13,8 @@ perf*.html
common-cmds.h
perf.data
perf.data.old
+perf.data.guest
+perf.data.guest.old
output.svg
perf-archive
tags
--
1.8.5.rc0.5.g70ebc73.dirty
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 2/2] perf tools: ignore files generated by 'perf kvm'
2013-12-11 10:34 ` [PATCH 2/2] perf tools: ignore files generated by " Ramkumar Ramachandra
@ 2013-12-11 20:01 ` Arnaldo Carvalho de Melo
2013-12-12 9:05 ` [PATCH v2] " Ramkumar Ramachandra
0 siblings, 1 reply; 19+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-11 20:01 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: LKML
Em Wed, Dec 11, 2013 at 04:04:16PM +0530, Ramkumar Ramachandra escreveu:
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
> tools/perf/.gitignore | 2 ++
> 1 file changed, 2 insertions(+)
Some more are missing, from 'perf kvm --help':
Default('') -> perf.data.guest
--host -> perf.data.kvm
--guest -> perf.data.guest
--host --guest -> perf.data.kvm
--host --no-guest -> perf.data.host
Can you respin, please?
- Arnaldo
> diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
> index 782d86e..28264a9 100644
> --- a/tools/perf/.gitignore
> +++ b/tools/perf/.gitignore
> @@ -13,6 +13,8 @@ perf*.html
> common-cmds.h
> perf.data
> perf.data.old
> +perf.data.guest
> +perf.data.guest.old
> output.svg
> perf-archive
> tags
> --
> 1.8.5.rc0.5.g70ebc73.dirty
^ permalink raw reply [flat|nested] 19+ messages in thread* [PATCH v2] perf tools: ignore files generated by 'perf kvm'
2013-12-11 20:01 ` Arnaldo Carvalho de Melo
@ 2013-12-12 9:05 ` Ramkumar Ramachandra
0 siblings, 0 replies; 19+ messages in thread
From: Ramkumar Ramachandra @ 2013-12-12 9:05 UTC (permalink / raw)
To: LKML; +Cc: Arnaldo Carvalho de Melo
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
Include .kvm[.old], .host[.old] files, as suggested by Arnaldo.
tools/perf/.gitignore | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 782d86e..9fea0d9 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -13,6 +13,12 @@ perf*.html
common-cmds.h
perf.data
perf.data.old
+perf.data.guest
+perf.data.guest.old
+perf.data.kvm
+perf.data.kvm.old
+perf.data.host
+perf.data.host.old
output.svg
perf-archive
tags
--
1.8.5.1.113.g8cb5bef.dirty
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH] perf kvm: introduce --list-cmds for use by scripts
@ 2014-03-04 1:26 Ramkumar Ramachandra
2014-03-05 1:00 ` David Ahern
2014-03-05 9:51 ` Jiri Olsa
0 siblings, 2 replies; 19+ messages in thread
From: Ramkumar Ramachandra @ 2014-03-04 1:26 UTC (permalink / raw)
To: LKML; +Cc: David Ahern, Arnaldo Carvalho de Melo
Introduce
$ perf kvm --list-cmds
to dump a raw list of commands for use by the completion script. In
order to do this, introduce parse_options_subcommand() for handling
subcommands as a special case in the parse-options machinery.
Cc: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
Does this example justify the creation of parse_options_subcommand()?
Initializing the usagestr to { NULL, NULL } and passing it to
parse_options_subcommand() isn't intuitive -- what can we do about
that?
tools/perf/builtin-kvm.c | 12 +++++-------
tools/perf/perf-completion.sh | 2 +-
tools/perf/util/parse-options.c | 37 +++++++++++++++++++++++++++++++++----
tools/perf/util/parse-options.h | 8 +++++++-
4 files changed, 46 insertions(+), 13 deletions(-)
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index a735051..21c164b 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1691,17 +1691,15 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_END()
};
-
- const char * const kvm_usage[] = {
- "perf kvm [<options>] {top|record|report|diff|buildid-list|stat}",
- NULL
- };
+ const char *const kvm_subcommands[] = { "top", "record", "report", "diff",
+ "buildid-list", "stat", NULL };
+ const char *kvm_usage[] = { NULL, NULL };
perf_host = 0;
perf_guest = 1;
- argc = parse_options(argc, argv, kvm_options, kvm_usage,
- PARSE_OPT_STOP_AT_NON_OPTION);
+ argc = parse_options_subcommand(argc, argv, kvm_options, kvm_subcommands, kvm_usage,
+ PARSE_OPT_STOP_AT_NON_OPTION);
if (!argc)
usage_with_options(kvm_usage, kvm_options);
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 496e2ab..ae3a576 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -123,7 +123,7 @@ __perf_main ()
__perfcomp_colon "$evts" "$cur"
# List subcommands for 'perf kvm'
elif [[ $prev == "kvm" ]]; then
- subcmds="top record report diff buildid-list stat"
+ subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon "$subcmds" "$cur"
# List long option names
elif [[ $cur == --* ]]; then
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
index d22e3f8..bf48092 100644
--- a/tools/perf/util/parse-options.c
+++ b/tools/perf/util/parse-options.c
@@ -407,7 +407,9 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
if (internal_help && !strcmp(arg + 2, "help"))
return usage_with_options_internal(usagestr, options, 0);
if (!strcmp(arg + 2, "list-opts"))
- return PARSE_OPT_LIST;
+ return PARSE_OPT_LIST_OPTS;
+ if (!strcmp(arg + 2, "list-cmds"))
+ return PARSE_OPT_LIST_SUBCMDS;
switch (parse_long_opt(ctx, arg + 2, options)) {
case -1:
return parse_options_usage(usagestr, options, arg + 2, 0);
@@ -433,25 +435,45 @@ int parse_options_end(struct parse_opt_ctx_t *ctx)
return ctx->cpidx + ctx->argc;
}
-int parse_options(int argc, const char **argv, const struct option *options,
- const char * const usagestr[], int flags)
+int parse_options_subcommand(int argc, const char **argv, const struct option *options,
+ const char *const subcommands[], const char *usagestr[], int flags)
{
struct parse_opt_ctx_t ctx;
perf_header__set_cmdline(argc, argv);
+ /* build usage string if it's not provided */
+ if (subcommands && !usagestr[0]) {
+ struct strbuf buf = STRBUF_INIT;
+
+ strbuf_addf(&buf, "perf %s [<options>] {", argv[0]);
+ for (int i = 0; subcommands[i]; i++) {
+ if (i)
+ strbuf_addstr(&buf, "|");
+ strbuf_addstr(&buf, subcommands[i]);
+ }
+ strbuf_addstr(&buf, "}");
+
+ usagestr[0] = strdup(buf.buf);
+ strbuf_release(&buf);
+ }
+
parse_options_start(&ctx, argc, argv, flags);
switch (parse_options_step(&ctx, options, usagestr)) {
case PARSE_OPT_HELP:
exit(129);
case PARSE_OPT_DONE:
break;
- case PARSE_OPT_LIST:
+ case PARSE_OPT_LIST_OPTS:
while (options->type != OPTION_END) {
printf("--%s ", options->long_name);
options++;
}
exit(130);
+ case PARSE_OPT_LIST_SUBCMDS:
+ for (int i = 0; subcommands[i]; i++)
+ printf("%s ", subcommands[i]);
+ exit(130);
default: /* PARSE_OPT_UNKNOWN */
if (ctx.argv[0][1] == '-') {
error("unknown option `%s'", ctx.argv[0] + 2);
@@ -464,6 +486,13 @@ int parse_options(int argc, const char **argv, const struct option *options,
return parse_options_end(&ctx);
}
+int parse_options(int argc, const char **argv, const struct option *options,
+ const char * const usagestr[], int flags)
+{
+ return parse_options_subcommand(argc, argv, options, NULL,
+ (const char **) usagestr, flags);
+}
+
#define USAGE_OPTS_WIDTH 24
#define USAGE_GAP 2
diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h
index cbf0149..d8dac8a 100644
--- a/tools/perf/util/parse-options.h
+++ b/tools/perf/util/parse-options.h
@@ -140,6 +140,11 @@ extern int parse_options(int argc, const char **argv,
const struct option *options,
const char * const usagestr[], int flags);
+extern int parse_options_subcommand(int argc, const char **argv,
+ const struct option *options,
+ const char *const subcommands[],
+ const char *usagestr[], int flags);
+
extern NORETURN void usage_with_options(const char * const *usagestr,
const struct option *options);
@@ -148,7 +153,8 @@ extern NORETURN void usage_with_options(const char * const *usagestr,
enum {
PARSE_OPT_HELP = -1,
PARSE_OPT_DONE,
- PARSE_OPT_LIST,
+ PARSE_OPT_LIST_OPTS,
+ PARSE_OPT_LIST_SUBCMDS,
PARSE_OPT_UNKNOWN,
};
--
1.9.rc0.1.g9d22d25
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH] perf kvm: introduce --list-cmds for use by scripts
2014-03-04 1:26 [PATCH] perf kvm: introduce --list-cmds for use by scripts Ramkumar Ramachandra
@ 2014-03-05 1:00 ` David Ahern
2014-03-05 9:51 ` Jiri Olsa
1 sibling, 0 replies; 19+ messages in thread
From: David Ahern @ 2014-03-05 1:00 UTC (permalink / raw)
To: Ramkumar Ramachandra, LKML; +Cc: Arnaldo Carvalho de Melo, Jiri Olsa
On 3/3/14, 6:26 PM, Ramkumar Ramachandra wrote:
> Introduce
>
> $ perf kvm --list-cmds
>
> to dump a raw list of commands for use by the completion script. In
> order to do this, introduce parse_options_subcommand() for handling
> subcommands as a special case in the parse-options machinery.
>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Looks ok to me. Jiri?
David
> ---
> Does this example justify the creation of parse_options_subcommand()?
> Initializing the usagestr to { NULL, NULL } and passing it to
> parse_options_subcommand() isn't intuitive -- what can we do about
> that?
>
> tools/perf/builtin-kvm.c | 12 +++++-------
> tools/perf/perf-completion.sh | 2 +-
> tools/perf/util/parse-options.c | 37 +++++++++++++++++++++++++++++++++----
> tools/perf/util/parse-options.h | 8 +++++++-
> 4 files changed, 46 insertions(+), 13 deletions(-)
>
> diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
> index a735051..21c164b 100644
> --- a/tools/perf/builtin-kvm.c
> +++ b/tools/perf/builtin-kvm.c
> @@ -1691,17 +1691,15 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
> OPT_END()
> };
>
> -
> - const char * const kvm_usage[] = {
> - "perf kvm [<options>] {top|record|report|diff|buildid-list|stat}",
> - NULL
> - };
> + const char *const kvm_subcommands[] = { "top", "record", "report", "diff",
> + "buildid-list", "stat", NULL };
> + const char *kvm_usage[] = { NULL, NULL };
>
> perf_host = 0;
> perf_guest = 1;
>
> - argc = parse_options(argc, argv, kvm_options, kvm_usage,
> - PARSE_OPT_STOP_AT_NON_OPTION);
> + argc = parse_options_subcommand(argc, argv, kvm_options, kvm_subcommands, kvm_usage,
> + PARSE_OPT_STOP_AT_NON_OPTION);
> if (!argc)
> usage_with_options(kvm_usage, kvm_options);
>
> diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
> index 496e2ab..ae3a576 100644
> --- a/tools/perf/perf-completion.sh
> +++ b/tools/perf/perf-completion.sh
> @@ -123,7 +123,7 @@ __perf_main ()
> __perfcomp_colon "$evts" "$cur"
> # List subcommands for 'perf kvm'
> elif [[ $prev == "kvm" ]]; then
> - subcmds="top record report diff buildid-list stat"
> + subcmds=$($cmd $prev --list-cmds)
> __perfcomp_colon "$subcmds" "$cur"
> # List long option names
> elif [[ $cur == --* ]]; then
> diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
> index d22e3f8..bf48092 100644
> --- a/tools/perf/util/parse-options.c
> +++ b/tools/perf/util/parse-options.c
> @@ -407,7 +407,9 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
> if (internal_help && !strcmp(arg + 2, "help"))
> return usage_with_options_internal(usagestr, options, 0);
> if (!strcmp(arg + 2, "list-opts"))
> - return PARSE_OPT_LIST;
> + return PARSE_OPT_LIST_OPTS;
> + if (!strcmp(arg + 2, "list-cmds"))
> + return PARSE_OPT_LIST_SUBCMDS;
> switch (parse_long_opt(ctx, arg + 2, options)) {
> case -1:
> return parse_options_usage(usagestr, options, arg + 2, 0);
> @@ -433,25 +435,45 @@ int parse_options_end(struct parse_opt_ctx_t *ctx)
> return ctx->cpidx + ctx->argc;
> }
>
> -int parse_options(int argc, const char **argv, const struct option *options,
> - const char * const usagestr[], int flags)
> +int parse_options_subcommand(int argc, const char **argv, const struct option *options,
> + const char *const subcommands[], const char *usagestr[], int flags)
> {
> struct parse_opt_ctx_t ctx;
>
> perf_header__set_cmdline(argc, argv);
>
> + /* build usage string if it's not provided */
> + if (subcommands && !usagestr[0]) {
> + struct strbuf buf = STRBUF_INIT;
> +
> + strbuf_addf(&buf, "perf %s [<options>] {", argv[0]);
> + for (int i = 0; subcommands[i]; i++) {
> + if (i)
> + strbuf_addstr(&buf, "|");
> + strbuf_addstr(&buf, subcommands[i]);
> + }
> + strbuf_addstr(&buf, "}");
> +
> + usagestr[0] = strdup(buf.buf);
> + strbuf_release(&buf);
> + }
> +
> parse_options_start(&ctx, argc, argv, flags);
> switch (parse_options_step(&ctx, options, usagestr)) {
> case PARSE_OPT_HELP:
> exit(129);
> case PARSE_OPT_DONE:
> break;
> - case PARSE_OPT_LIST:
> + case PARSE_OPT_LIST_OPTS:
> while (options->type != OPTION_END) {
> printf("--%s ", options->long_name);
> options++;
> }
> exit(130);
> + case PARSE_OPT_LIST_SUBCMDS:
> + for (int i = 0; subcommands[i]; i++)
> + printf("%s ", subcommands[i]);
> + exit(130);
> default: /* PARSE_OPT_UNKNOWN */
> if (ctx.argv[0][1] == '-') {
> error("unknown option `%s'", ctx.argv[0] + 2);
> @@ -464,6 +486,13 @@ int parse_options(int argc, const char **argv, const struct option *options,
> return parse_options_end(&ctx);
> }
>
> +int parse_options(int argc, const char **argv, const struct option *options,
> + const char * const usagestr[], int flags)
> +{
> + return parse_options_subcommand(argc, argv, options, NULL,
> + (const char **) usagestr, flags);
> +}
> +
> #define USAGE_OPTS_WIDTH 24
> #define USAGE_GAP 2
>
> diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h
> index cbf0149..d8dac8a 100644
> --- a/tools/perf/util/parse-options.h
> +++ b/tools/perf/util/parse-options.h
> @@ -140,6 +140,11 @@ extern int parse_options(int argc, const char **argv,
> const struct option *options,
> const char * const usagestr[], int flags);
>
> +extern int parse_options_subcommand(int argc, const char **argv,
> + const struct option *options,
> + const char *const subcommands[],
> + const char *usagestr[], int flags);
> +
> extern NORETURN void usage_with_options(const char * const *usagestr,
> const struct option *options);
>
> @@ -148,7 +153,8 @@ extern NORETURN void usage_with_options(const char * const *usagestr,
> enum {
> PARSE_OPT_HELP = -1,
> PARSE_OPT_DONE,
> - PARSE_OPT_LIST,
> + PARSE_OPT_LIST_OPTS,
> + PARSE_OPT_LIST_SUBCMDS,
> PARSE_OPT_UNKNOWN,
> };
>
>
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] perf kvm: introduce --list-cmds for use by scripts
2014-03-04 1:26 [PATCH] perf kvm: introduce --list-cmds for use by scripts Ramkumar Ramachandra
2014-03-05 1:00 ` David Ahern
@ 2014-03-05 9:51 ` Jiri Olsa
2014-03-05 16:25 ` Ramkumar Ramachandra
1 sibling, 1 reply; 19+ messages in thread
From: Jiri Olsa @ 2014-03-05 9:51 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: LKML, David Ahern, Arnaldo Carvalho de Melo
On Mon, Mar 03, 2014 at 08:26:36PM -0500, Ramkumar Ramachandra wrote:
> Introduce
>
> $ perf kvm --list-cmds
>
> to dump a raw list of commands for use by the completion script. In
> order to do this, introduce parse_options_subcommand() for handling
> subcommands as a special case in the parse-options machinery.
so this doesn't change the behaviour at all, right?
SNIP
>
> - argc = parse_options(argc, argv, kvm_options, kvm_usage,
> - PARSE_OPT_STOP_AT_NON_OPTION);
> + argc = parse_options_subcommand(argc, argv, kvm_options, kvm_subcommands, kvm_usage,
> + PARSE_OPT_STOP_AT_NON_OPTION);
> if (!argc)
> usage_with_options(kvm_usage, kvm_options);
>
> diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
> index 496e2ab..ae3a576 100644
> --- a/tools/perf/perf-completion.sh
> +++ b/tools/perf/perf-completion.sh
> @@ -123,7 +123,7 @@ __perf_main ()
> __perfcomp_colon "$evts" "$cur"
> # List subcommands for 'perf kvm'
> elif [[ $prev == "kvm" ]]; then
> - subcmds="top record report diff buildid-list stat"
> + subcmds=$($cmd $prev --list-cmds)
Do we want some generic approach here.. if we're
adding generic --list-cmds option anyway.. hm?
SNIP
> -int parse_options(int argc, const char **argv, const struct option *options,
> - const char * const usagestr[], int flags)
> +int parse_options_subcommand(int argc, const char **argv, const struct option *options,
> + const char *const subcommands[], const char *usagestr[], int flags)
> {
> struct parse_opt_ctx_t ctx;
>
> perf_header__set_cmdline(argc, argv);
>
> + /* build usage string if it's not provided */
> + if (subcommands && !usagestr[0]) {
> + struct strbuf buf = STRBUF_INIT;
> +
> + strbuf_addf(&buf, "perf %s [<options>] {", argv[0]);
> + for (int i = 0; subcommands[i]; i++) {
> + if (i)
> + strbuf_addstr(&buf, "|");
> + strbuf_addstr(&buf, subcommands[i]);
> + }
> + strbuf_addstr(&buf, "}");
> +
> + usagestr[0] = strdup(buf.buf);
> + strbuf_release(&buf);
> + }
is above code ever used now?
jirka
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] perf kvm: introduce --list-cmds for use by scripts
2014-03-05 9:51 ` Jiri Olsa
@ 2014-03-05 16:25 ` Ramkumar Ramachandra
2014-03-13 15:52 ` Ramkumar Ramachandra
0 siblings, 1 reply; 19+ messages in thread
From: Ramkumar Ramachandra @ 2014-03-05 16:25 UTC (permalink / raw)
To: Jiri Olsa; +Cc: LKML, David Ahern, Arnaldo Carvalho de Melo
Jiri Olsa wrote:
> On Mon, Mar 03, 2014 at 08:26:36PM -0500, Ramkumar Ramachandra wrote:
>> Introduce
>>
>> $ perf kvm --list-cmds
>>
>> to dump a raw list of commands for use by the completion script. In
>> order to do this, introduce parse_options_subcommand() for handling
>> subcommands as a special case in the parse-options machinery.
>
> so this doesn't change the behaviour at all, right?
It just introduces --list-cmds; no, it doesn't change behavior otherwise.
>>
>> - argc = parse_options(argc, argv, kvm_options, kvm_usage,
>> - PARSE_OPT_STOP_AT_NON_OPTION);
>> + argc = parse_options_subcommand(argc, argv, kvm_options, kvm_subcommands, kvm_usage,
>> + PARSE_OPT_STOP_AT_NON_OPTION);
>> if (!argc)
>> usage_with_options(kvm_usage, kvm_options);
>>
>> diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
>> index 496e2ab..ae3a576 100644
>> --- a/tools/perf/perf-completion.sh
>> +++ b/tools/perf/perf-completion.sh
>> @@ -123,7 +123,7 @@ __perf_main ()
>> __perfcomp_colon "$evts" "$cur"
>> # List subcommands for 'perf kvm'
>> elif [[ $prev == "kvm" ]]; then
>> - subcmds="top record report diff buildid-list stat"
>> + subcmds=$($cmd $prev --list-cmds)
>
> Do we want some generic approach here.. if we're
> adding generic --list-cmds option anyway.. hm?
Currently, we're using $cmd $prev --list-cmds instead of hard-coding a
list for 'perf kvm'. Once I submit future patches to convert other
commands to use parse_options_subcommand(), we can use the same line
for completions.
Or did you mean something else when you said generic approach?
>> -int parse_options(int argc, const char **argv, const struct option *options,
>> - const char * const usagestr[], int flags)
>> +int parse_options_subcommand(int argc, const char **argv, const struct option *options,
>> + const char *const subcommands[], const char *usagestr[], int flags)
>> {
>> struct parse_opt_ctx_t ctx;
>>
>> perf_header__set_cmdline(argc, argv);
>>
>> + /* build usage string if it's not provided */
>> + if (subcommands && !usagestr[0]) {
>> + struct strbuf buf = STRBUF_INIT;
>> +
>> + strbuf_addf(&buf, "perf %s [<options>] {", argv[0]);
>> + for (int i = 0; subcommands[i]; i++) {
>> + if (i)
>> + strbuf_addstr(&buf, "|");
>> + strbuf_addstr(&buf, subcommands[i]);
>> + }
>> + strbuf_addstr(&buf, "}");
>> +
>> + usagestr[0] = strdup(buf.buf);
>> + strbuf_release(&buf);
>> + }
>
> is above code ever used now?
Yeah; note that kvm_usage is initialized to { NULL, NULL } and passed
-- this code fills in the usage string then.
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH] perf kvm: introduce --list-cmds for use by scripts
2014-03-05 16:25 ` Ramkumar Ramachandra
@ 2014-03-13 15:52 ` Ramkumar Ramachandra
2014-03-14 13:01 ` Jiri Olsa
0 siblings, 1 reply; 19+ messages in thread
From: Ramkumar Ramachandra @ 2014-03-13 15:52 UTC (permalink / raw)
To: Jiri Olsa; +Cc: LKML, David Ahern, Arnaldo Carvalho de Melo
Ramkumar Ramachandra wrote:
> Jiri Olsa wrote:
>> On Mon, Mar 03, 2014 at 08:26:36PM -0500, Ramkumar Ramachandra wrote:
>>> Introduce
>>>
>>> $ perf kvm --list-cmds
>>>
>>> to dump a raw list of commands for use by the completion script. In
>>> order to do this, introduce parse_options_subcommand() for handling
>>> subcommands as a special case in the parse-options machinery.
Jiri? How do we proceed with this?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] perf kvm: introduce --list-cmds for use by scripts
2014-03-13 15:52 ` Ramkumar Ramachandra
@ 2014-03-14 13:01 ` Jiri Olsa
0 siblings, 0 replies; 19+ messages in thread
From: Jiri Olsa @ 2014-03-14 13:01 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: LKML, David Ahern, Arnaldo Carvalho de Melo
On Thu, Mar 13, 2014 at 11:52:12AM -0400, Ramkumar Ramachandra wrote:
> Ramkumar Ramachandra wrote:
> > Jiri Olsa wrote:
> >> On Mon, Mar 03, 2014 at 08:26:36PM -0500, Ramkumar Ramachandra wrote:
> >>> Introduce
> >>>
> >>> $ perf kvm --list-cmds
> >>>
> >>> to dump a raw list of commands for use by the completion script. In
> >>> order to do this, introduce parse_options_subcommand() for handling
> >>> subcommands as a special case in the parse-options machinery.
>
> Jiri? How do we proceed with this?
I think Arnaldo will process it eventually ;-)
I dont have any objections..
jirka
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2014-03-14 13:01 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-11 10:34 [PATCH 0/2] Completion for 'perf kvm' Ramkumar Ramachandra
2013-12-11 10:34 ` [PATCH 1/2] perf completion: complete " Ramkumar Ramachandra
2013-12-11 19:50 ` Arnaldo Carvalho de Melo
2013-12-11 19:56 ` David Ahern
2013-12-12 9:09 ` Ramkumar Ramachandra
2013-12-12 16:53 ` David Ahern
2013-12-12 17:26 ` [PATCH] perf kvm: introduce --list-cmds for use by scripts Ramkumar Ramachandra
2013-12-13 4:32 ` David Ahern
2013-12-16 13:16 ` Arnaldo Carvalho de Melo
2013-12-16 15:27 ` [tip:perf/core] perf completion: Complete 'perf kvm' tip-bot for Ramkumar Ramachandra
2013-12-11 10:34 ` [PATCH 2/2] perf tools: ignore files generated by " Ramkumar Ramachandra
2013-12-11 20:01 ` Arnaldo Carvalho de Melo
2013-12-12 9:05 ` [PATCH v2] " Ramkumar Ramachandra
-- strict thread matches above, loose matches on Subject: below --
2014-03-04 1:26 [PATCH] perf kvm: introduce --list-cmds for use by scripts Ramkumar Ramachandra
2014-03-05 1:00 ` David Ahern
2014-03-05 9:51 ` Jiri Olsa
2014-03-05 16:25 ` Ramkumar Ramachandra
2014-03-13 15:52 ` Ramkumar Ramachandra
2014-03-14 13:01 ` Jiri Olsa
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).