[tip:perf/core] perf sched: Introduce --list-cmds for use by scripts

2014-04-17 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a83edb2dfc5989fbadc594109c933bae528a2809
Gitweb: http://git.kernel.org/tip/a83edb2dfc5989fbadc594109c933bae528a2809
Author: Ramkumar Ramachandra 
AuthorDate: Fri, 14 Mar 2014 23:17:54 -0400
Committer:  Jiri Olsa 
CommitDate: Wed, 16 Apr 2014 17:16:05 +0200

perf sched: Introduce --list-cmds for use by scripts

Signed-off-by: Ramkumar Ramachandra 
Acked-by: David Ahern 
Cc: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1394853474-31019-5-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Jiri Olsa 
---
 tools/perf/builtin-sched.c| 10 ++
 tools/perf/perf-completion.sh |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 9ac0a49..d3fb0ed 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1713,8 +1713,10 @@ int cmd_sched(int argc, const char **argv, const char 
*prefix __maybe_unused)
"perf sched replay []",
NULL
};
-   const char * const sched_usage[] = {
-   "perf sched [] {record|latency|map|replay|script}",
+   const char *const sched_subcommands[] = { "record", "latency", "map",
+ "replay", "script", NULL };
+   const char *sched_usage[] = {
+   NULL,
NULL
};
struct trace_sched_handler lat_ops  = {
@@ -1736,8 +1738,8 @@ int cmd_sched(int argc, const char **argv, const char 
*prefix __maybe_unused)
for (i = 0; i < ARRAY_SIZE(sched.curr_pid); i++)
sched.curr_pid[i] = -1;
 
-   argc = parse_options(argc, argv, sched_options, sched_usage,
-PARSE_OPT_STOP_AT_NON_OPTION);
+   argc = parse_options_subcommand(argc, argv, sched_options, 
sched_subcommands,
+   sched_usage, 
PARSE_OPT_STOP_AT_NON_OPTION);
if (!argc)
usage_with_options(sched_usage, sched_options);
 
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index ecedab6..3356984 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -122,7 +122,7 @@ __perf_main ()
evts=$($cmd list --raw-dump)
__perfcomp_colon "$evts" "$cur"
# List subcommands for perf commands
-   elif [[ $prev == @(kvm|kmem|mem|lock) ]]; then
+   elif [[ $prev == @(kvm|kmem|mem|lock|sched) ]]; then
subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon "$subcmds" "$cur"
# List long option names
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf mem: Introduce --list-cmds for use by scripts

2014-04-17 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  8d2a2a1d885d36e978c4619a3db8791f9768dd6a
Gitweb: http://git.kernel.org/tip/8d2a2a1d885d36e978c4619a3db8791f9768dd6a
Author: Ramkumar Ramachandra 
AuthorDate: Fri, 14 Mar 2014 23:17:52 -0400
Committer:  Jiri Olsa 
CommitDate: Wed, 16 Apr 2014 17:16:04 +0200

perf mem: Introduce --list-cmds for use by scripts

Signed-off-by: Ramkumar Ramachandra 
Acked-by: David Ahern 
Cc: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1394853474-31019-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Jiri Olsa 
---
 tools/perf/builtin-mem.c  | 15 ---
 tools/perf/perf-completion.sh |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 2e3ade69..4a1a6c9 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -21,11 +21,6 @@ struct perf_mem {
DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
 };
 
-static const char * const mem_usage[] = {
-   "perf mem [] {record  |report}",
-   NULL
-};
-
 static int __cmd_record(int argc, const char **argv)
 {
int rec_argc, i = 0, j;
@@ -220,9 +215,15 @@ int cmd_mem(int argc, const char **argv, const char 
*prefix __maybe_unused)
   " between columns '.' is reserved."),
OPT_END()
};
+   const char *const mem_subcommands[] = { "record", "report", NULL };
+   const char *mem_usage[] = {
+   NULL,
+   NULL
+   };
+
 
-   argc = parse_options(argc, argv, mem_options, mem_usage,
-PARSE_OPT_STOP_AT_NON_OPTION);
+   argc = parse_options_subcommand(argc, argv, mem_options, 
mem_subcommands,
+   mem_usage, 
PARSE_OPT_STOP_AT_NON_OPTION);
 
if (!argc || !(strncmp(argv[0], "rec", 3) || mem_operation))
usage_with_options(mem_usage, mem_options);
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 0ef59dd..f44c04b 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -122,7 +122,7 @@ __perf_main ()
evts=$($cmd list --raw-dump)
__perfcomp_colon "$evts" "$cur"
# List subcommands for perf commands
-   elif [[ $prev == @(kvm|kmem) ]]; then
+   elif [[ $prev == @(kvm|kmem|mem) ]]; then
subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon "$subcmds" "$cur"
# List long option names
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf kmem: Introduce --list-cmds for use by scripts

2014-04-17 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  3bca23543b910a84d3c58a819663e0a4fad72bb6
Gitweb: http://git.kernel.org/tip/3bca23543b910a84d3c58a819663e0a4fad72bb6
Author: Ramkumar Ramachandra 
AuthorDate: Fri, 14 Mar 2014 23:17:51 -0400
Committer:  Jiri Olsa 
CommitDate: Wed, 16 Apr 2014 17:16:04 +0200

perf kmem: Introduce --list-cmds for use by scripts

Signed-off-by: Ramkumar Ramachandra 
Acked-by: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1394853474-31019-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Jiri Olsa 
---
 tools/perf/builtin-kmem.c | 8 +---
 tools/perf/perf-completion.sh | 4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 929462a..bd91de0 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -756,11 +756,13 @@ int cmd_kmem(int argc, const char **argv, const char 
*prefix __maybe_unused)
OPT_BOOLEAN(0, "raw-ip", _ip, "show raw ip instead of symbol"),
OPT_END()
};
-   const char * const kmem_usage[] = {
-   "perf kmem [] {record|stat}",
+   const char *const kmem_subcommands[] = { "record", "stat", NULL };
+   const char *kmem_usage[] = {
+   NULL,
NULL
};
-   argc = parse_options(argc, argv, kmem_options, kmem_usage, 0);
+   argc = parse_options_subcommand(argc, argv, kmem_options,
+   kmem_subcommands, kmem_usage, 0);
 
if (!argc)
usage_with_options(kmem_usage, kmem_options);
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index ae3a576..0ef59dd 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -121,8 +121,8 @@ __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
+   # List subcommands for perf commands
+   elif [[ $prev == @(kvm|kmem) ]]; then
subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon "$subcmds" "$cur"
# List long option names
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf lock: Introduce --list-cmds for use by scripts

2014-04-17 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a2368c3199eba493d72c6d0e5b804f908a09706c
Gitweb: http://git.kernel.org/tip/a2368c3199eba493d72c6d0e5b804f908a09706c
Author: Ramkumar Ramachandra 
AuthorDate: Fri, 14 Mar 2014 23:17:53 -0400
Committer:  Jiri Olsa 
CommitDate: Wed, 16 Apr 2014 17:16:04 +0200

perf lock: Introduce --list-cmds for use by scripts

Signed-off-by: Ramkumar Ramachandra 
Acked-by: David Ahern 
Cc: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1394853474-31019-4-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Jiri Olsa 
---
 tools/perf/builtin-lock.c | 10 ++
 tools/perf/perf-completion.sh |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index c852c7a..6148afc 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -961,8 +961,10 @@ int cmd_lock(int argc, const char **argv, const char 
*prefix __maybe_unused)
"perf lock info []",
NULL
};
-   const char * const lock_usage[] = {
-   "perf lock [] {record|report|script|info}",
+   const char *const lock_subcommands[] = { "record", "report", "script",
+"info", NULL };
+   const char *lock_usage[] = {
+   NULL,
NULL
};
const char * const report_usage[] = {
@@ -976,8 +978,8 @@ int cmd_lock(int argc, const char **argv, const char 
*prefix __maybe_unused)
for (i = 0; i < LOCKHASH_SIZE; i++)
INIT_LIST_HEAD(lockhash_table + i);
 
-   argc = parse_options(argc, argv, lock_options, lock_usage,
-PARSE_OPT_STOP_AT_NON_OPTION);
+   argc = parse_options_subcommand(argc, argv, lock_options, 
lock_subcommands,
+   lock_usage, 
PARSE_OPT_STOP_AT_NON_OPTION);
if (!argc)
usage_with_options(lock_usage, lock_options);
 
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index f44c04b..ecedab6 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -122,7 +122,7 @@ __perf_main ()
evts=$($cmd list --raw-dump)
__perfcomp_colon "$evts" "$cur"
# List subcommands for perf commands
-   elif [[ $prev == @(kvm|kmem|mem) ]]; then
+   elif [[ $prev == @(kvm|kmem|mem|lock) ]]; then
subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon "$subcmds" "$cur"
# List long option names
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf lock: Introduce --list-cmds for use by scripts

2014-04-17 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a2368c3199eba493d72c6d0e5b804f908a09706c
Gitweb: http://git.kernel.org/tip/a2368c3199eba493d72c6d0e5b804f908a09706c
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Fri, 14 Mar 2014 23:17:53 -0400
Committer:  Jiri Olsa jo...@redhat.com
CommitDate: Wed, 16 Apr 2014 17:16:04 +0200

perf lock: Introduce --list-cmds for use by scripts

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: David Ahern dsah...@gmail.com
Cc: David Ahern dsah...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1394853474-31019-4-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
Signed-off-by: Jiri Olsa jo...@redhat.com
---
 tools/perf/builtin-lock.c | 10 ++
 tools/perf/perf-completion.sh |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index c852c7a..6148afc 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -961,8 +961,10 @@ int cmd_lock(int argc, const char **argv, const char 
*prefix __maybe_unused)
perf lock info [options],
NULL
};
-   const char * const lock_usage[] = {
-   perf lock [options] {record|report|script|info},
+   const char *const lock_subcommands[] = { record, report, script,
+info, NULL };
+   const char *lock_usage[] = {
+   NULL,
NULL
};
const char * const report_usage[] = {
@@ -976,8 +978,8 @@ int cmd_lock(int argc, const char **argv, const char 
*prefix __maybe_unused)
for (i = 0; i  LOCKHASH_SIZE; i++)
INIT_LIST_HEAD(lockhash_table + i);
 
-   argc = parse_options(argc, argv, lock_options, lock_usage,
-PARSE_OPT_STOP_AT_NON_OPTION);
+   argc = parse_options_subcommand(argc, argv, lock_options, 
lock_subcommands,
+   lock_usage, 
PARSE_OPT_STOP_AT_NON_OPTION);
if (!argc)
usage_with_options(lock_usage, lock_options);
 
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index f44c04b..ecedab6 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -122,7 +122,7 @@ __perf_main ()
evts=$($cmd list --raw-dump)
__perfcomp_colon $evts $cur
# List subcommands for perf commands
-   elif [[ $prev == @(kvm|kmem|mem) ]]; then
+   elif [[ $prev == @(kvm|kmem|mem|lock) ]]; then
subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon $subcmds $cur
# List long option names
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf kmem: Introduce --list-cmds for use by scripts

2014-04-17 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  3bca23543b910a84d3c58a819663e0a4fad72bb6
Gitweb: http://git.kernel.org/tip/3bca23543b910a84d3c58a819663e0a4fad72bb6
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Fri, 14 Mar 2014 23:17:51 -0400
Committer:  Jiri Olsa jo...@redhat.com
CommitDate: Wed, 16 Apr 2014 17:16:04 +0200

perf kmem: Introduce --list-cmds for use by scripts

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: David Ahern dsah...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1394853474-31019-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
Signed-off-by: Jiri Olsa jo...@redhat.com
---
 tools/perf/builtin-kmem.c | 8 +---
 tools/perf/perf-completion.sh | 4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 929462a..bd91de0 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -756,11 +756,13 @@ int cmd_kmem(int argc, const char **argv, const char 
*prefix __maybe_unused)
OPT_BOOLEAN(0, raw-ip, raw_ip, show raw ip instead of symbol),
OPT_END()
};
-   const char * const kmem_usage[] = {
-   perf kmem [options] {record|stat},
+   const char *const kmem_subcommands[] = { record, stat, NULL };
+   const char *kmem_usage[] = {
+   NULL,
NULL
};
-   argc = parse_options(argc, argv, kmem_options, kmem_usage, 0);
+   argc = parse_options_subcommand(argc, argv, kmem_options,
+   kmem_subcommands, kmem_usage, 0);
 
if (!argc)
usage_with_options(kmem_usage, kmem_options);
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index ae3a576..0ef59dd 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -121,8 +121,8 @@ __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
+   # List subcommands for perf commands
+   elif [[ $prev == @(kvm|kmem) ]]; then
subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon $subcmds $cur
# List long option names
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf mem: Introduce --list-cmds for use by scripts

2014-04-17 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  8d2a2a1d885d36e978c4619a3db8791f9768dd6a
Gitweb: http://git.kernel.org/tip/8d2a2a1d885d36e978c4619a3db8791f9768dd6a
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Fri, 14 Mar 2014 23:17:52 -0400
Committer:  Jiri Olsa jo...@redhat.com
CommitDate: Wed, 16 Apr 2014 17:16:04 +0200

perf mem: Introduce --list-cmds for use by scripts

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: David Ahern dsah...@gmail.com
Cc: David Ahern dsah...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1394853474-31019-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
Signed-off-by: Jiri Olsa jo...@redhat.com
---
 tools/perf/builtin-mem.c  | 15 ---
 tools/perf/perf-completion.sh |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 2e3ade69..4a1a6c9 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -21,11 +21,6 @@ struct perf_mem {
DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
 };
 
-static const char * const mem_usage[] = {
-   perf mem [options] {record command |report},
-   NULL
-};
-
 static int __cmd_record(int argc, const char **argv)
 {
int rec_argc, i = 0, j;
@@ -220,9 +215,15 @@ int cmd_mem(int argc, const char **argv, const char 
*prefix __maybe_unused)
between columns '.' is reserved.),
OPT_END()
};
+   const char *const mem_subcommands[] = { record, report, NULL };
+   const char *mem_usage[] = {
+   NULL,
+   NULL
+   };
+
 
-   argc = parse_options(argc, argv, mem_options, mem_usage,
-PARSE_OPT_STOP_AT_NON_OPTION);
+   argc = parse_options_subcommand(argc, argv, mem_options, 
mem_subcommands,
+   mem_usage, 
PARSE_OPT_STOP_AT_NON_OPTION);
 
if (!argc || !(strncmp(argv[0], rec, 3) || mem_operation))
usage_with_options(mem_usage, mem_options);
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 0ef59dd..f44c04b 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -122,7 +122,7 @@ __perf_main ()
evts=$($cmd list --raw-dump)
__perfcomp_colon $evts $cur
# List subcommands for perf commands
-   elif [[ $prev == @(kvm|kmem) ]]; then
+   elif [[ $prev == @(kvm|kmem|mem) ]]; then
subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon $subcmds $cur
# List long option names
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf sched: Introduce --list-cmds for use by scripts

2014-04-17 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a83edb2dfc5989fbadc594109c933bae528a2809
Gitweb: http://git.kernel.org/tip/a83edb2dfc5989fbadc594109c933bae528a2809
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Fri, 14 Mar 2014 23:17:54 -0400
Committer:  Jiri Olsa jo...@redhat.com
CommitDate: Wed, 16 Apr 2014 17:16:05 +0200

perf sched: Introduce --list-cmds for use by scripts

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: David Ahern dsah...@gmail.com
Cc: David Ahern dsah...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1394853474-31019-5-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
Signed-off-by: Jiri Olsa jo...@redhat.com
---
 tools/perf/builtin-sched.c| 10 ++
 tools/perf/perf-completion.sh |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 9ac0a49..d3fb0ed 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1713,8 +1713,10 @@ int cmd_sched(int argc, const char **argv, const char 
*prefix __maybe_unused)
perf sched replay [options],
NULL
};
-   const char * const sched_usage[] = {
-   perf sched [options] {record|latency|map|replay|script},
+   const char *const sched_subcommands[] = { record, latency, map,
+ replay, script, NULL };
+   const char *sched_usage[] = {
+   NULL,
NULL
};
struct trace_sched_handler lat_ops  = {
@@ -1736,8 +1738,8 @@ int cmd_sched(int argc, const char **argv, const char 
*prefix __maybe_unused)
for (i = 0; i  ARRAY_SIZE(sched.curr_pid); i++)
sched.curr_pid[i] = -1;
 
-   argc = parse_options(argc, argv, sched_options, sched_usage,
-PARSE_OPT_STOP_AT_NON_OPTION);
+   argc = parse_options_subcommand(argc, argv, sched_options, 
sched_subcommands,
+   sched_usage, 
PARSE_OPT_STOP_AT_NON_OPTION);
if (!argc)
usage_with_options(sched_usage, sched_options);
 
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index ecedab6..3356984 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -122,7 +122,7 @@ __perf_main ()
evts=$($cmd list --raw-dump)
__perfcomp_colon $evts $cur
# List subcommands for perf commands
-   elif [[ $prev == @(kvm|kmem|mem|lock) ]]; then
+   elif [[ $prev == @(kvm|kmem|mem|lock|sched) ]]; then
subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon $subcmds $cur
# List long option names
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf bench: Set more defaults in the 'numa' suite

2014-04-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  40ba93e3aa001246110320edbe8cf2eb488c1fe7
Gitweb: http://git.kernel.org/tip/40ba93e3aa001246110320edbe8cf2eb488c1fe7
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 27 Mar 2014 19:50:17 -0400
Committer:  Jiri Olsa 
CommitDate: Mon, 14 Apr 2014 12:55:58 +0200

perf bench: Set more defaults in the 'numa' suite

Currently,

  $ perf bench numa mem

errors out with usage information. To make this more user-friendly, let
us provide a minimum set of default values required for a test
run. As an added bonus,

  $ perf bench all

now goes all the way to completion.

Signed-off-by: Ramkumar Ramachandra 
Cc: Arnaldo Carvalho de Melo 
Cc: David Ahern 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1395964219-22173-2-git-send-email-artag...@gmail.com
Signed-off-by: Jiri Olsa 
---
 tools/perf/bench/numa.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index d4c83c6..20697fb 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -1593,6 +1593,10 @@ static void init_params(struct params *p, const char 
*name, int argc, const char
p->data_rand_walk   = true;
p->nr_loops = -1;
p->init_random  = true;
+   p->mb_global_str= "1";
+   p->nr_proc  = 1;
+   p->nr_threads   = 1;
+   p->nr_secs  = 5;
 }
 
 static int run_bench_numa(const char *name, const char **argv)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf bench: Update manpage to mention numa and futex

2014-04-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  95a2b3c0a9e2a8038edbf3f9776d5a3d76146459
Gitweb: http://git.kernel.org/tip/95a2b3c0a9e2a8038edbf3f9776d5a3d76146459
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 27 Mar 2014 19:50:18 -0400
Committer:  Jiri Olsa 
CommitDate: Mon, 14 Apr 2014 12:55:41 +0200

perf bench: Update manpage to mention numa and futex

Signed-off-by: Ramkumar Ramachandra 
Cc: Arnaldo Carvalho de Melo 
Cc: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1395964219-22173-3-git-send-email-artag...@gmail.com
Signed-off-by: Jiri Olsa 
---
 tools/perf/Documentation/perf-bench.txt | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/tools/perf/Documentation/perf-bench.txt 
b/tools/perf/Documentation/perf-bench.txt
index 7065cd6..4464ad7 100644
--- a/tools/perf/Documentation/perf-bench.txt
+++ b/tools/perf/Documentation/perf-bench.txt
@@ -48,6 +48,12 @@ SUBSYSTEM
 'mem'::
Memory access performance.
 
+'numa'::
+   NUMA scheduling and MM benchmarks.
+
+'futex'::
+   Futex stressing benchmarks.
+
 'all'::
All benchmark subsystems.
 
@@ -187,6 +193,22 @@ Show only the result with page faults before memset.
 --no-prefault::
 Show only the result without page faults before memset.
 
+SUITES FOR 'numa'
+~
+*mem*::
+Suite for evaluating NUMA workloads.
+
+SUITES FOR 'futex'
+~~
+*hash*::
+Suite for evaluating hash tables.
+
+*wake*::
+Suite for evaluating wake calls.
+
+*requeue*::
+Suite for evaluating requeue calls.
+
 SEE ALSO
 
 linkperf:perf[1]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf bench: Fix segfault at the end of an 'all' execution

2014-04-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  5673872d4afd2584e075cf2b1adb2cccec46a0f3
Gitweb: http://git.kernel.org/tip/5673872d4afd2584e075cf2b1adb2cccec46a0f3
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 27 Mar 2014 19:50:19 -0400
Committer:  Jiri Olsa 
CommitDate: Mon, 14 Apr 2014 12:55:53 +0200

perf bench: Fix segfault at the end of an 'all' execution

At the end of

  $ perf bench all

the program segfaults because it attempts to dereference a NULL
pointer. Fix this fault.

Signed-off-by: Ramkumar Ramachandra 
Cc: Arnaldo Carvalho de Melo 
Cc: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1395964219-22173-4-git-send-email-artag...@gmail.com
Signed-off-by: Jiri Olsa 
---
 tools/perf/builtin-bench.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index f600b74..1e6e777 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -86,7 +86,7 @@ static struct collection collections[] = {
 
 /* Iterate over all benchmarks within a collection: */
 #define for_each_bench(coll, bench) \
-   for (bench = coll->benchmarks; bench->name; bench++)
+   for (bench = coll->benchmarks; bench && bench->name; bench++)
 
 static void dump_benchmarks(struct collection *coll)
 {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf tools: Pick up libdw without explicit LIBDW_DIR

2014-04-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  2c529e4e6aab405aa52e8627cbd691ed28b56a0b
Gitweb: http://git.kernel.org/tip/2c529e4e6aab405aa52e8627cbd691ed28b56a0b
Author: Ramkumar Ramachandra 
AuthorDate: Wed, 26 Mar 2014 18:44:05 -0400
Committer:  Jiri Olsa 
CommitDate: Mon, 14 Apr 2014 12:55:17 +0200

perf tools: Pick up libdw without explicit LIBDW_DIR

The Makefile logic sets FEATURE_CHECKS_CFLAGS-libdw-dwarf-unwind and
FEATURE_CHECKS_LDFLAGS-libdw-dwarf-unwind only if LIBDW_DIR is
defined. This means that under a normal setup,

  $ make NO_LIBUNWIND=1

won't automatically pick up libdw. Fix this.

Signed-off-by: Ramkumar Ramachandra 
Acked-by: Jean Pihet 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1395873845-466-1-git-send-email-artag...@gmail.com
Signed-off-by: Jiri Olsa 
---
 tools/perf/config/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5a3c452..ee21fa9 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -65,10 +65,9 @@ ifndef NO_LIBELF
   ifdef LIBDW_DIR
 LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
-
-FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
-FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
   endif
+  FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
+  FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
 endif
 
 # include ARCH specific config
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf tools: Pick up libdw without explicit LIBDW_DIR

2014-04-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  2c529e4e6aab405aa52e8627cbd691ed28b56a0b
Gitweb: http://git.kernel.org/tip/2c529e4e6aab405aa52e8627cbd691ed28b56a0b
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Wed, 26 Mar 2014 18:44:05 -0400
Committer:  Jiri Olsa jo...@redhat.com
CommitDate: Mon, 14 Apr 2014 12:55:17 +0200

perf tools: Pick up libdw without explicit LIBDW_DIR

The Makefile logic sets FEATURE_CHECKS_CFLAGS-libdw-dwarf-unwind and
FEATURE_CHECKS_LDFLAGS-libdw-dwarf-unwind only if LIBDW_DIR is
defined. This means that under a normal setup,

  $ make NO_LIBUNWIND=1

won't automatically pick up libdw. Fix this.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: Jean Pihet jean.pi...@linaro.org
Cc: Arnaldo Carvalho de Melo a...@redhat.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1395873845-466-1-git-send-email-artag...@gmail.com
Signed-off-by: Jiri Olsa jo...@redhat.com
---
 tools/perf/config/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5a3c452..ee21fa9 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -65,10 +65,9 @@ ifndef NO_LIBELF
   ifdef LIBDW_DIR
 LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
-
-FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
-FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
   endif
+  FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
+  FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
 endif
 
 # include ARCH specific config
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf bench: Update manpage to mention numa and futex

2014-04-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  95a2b3c0a9e2a8038edbf3f9776d5a3d76146459
Gitweb: http://git.kernel.org/tip/95a2b3c0a9e2a8038edbf3f9776d5a3d76146459
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 27 Mar 2014 19:50:18 -0400
Committer:  Jiri Olsa jo...@redhat.com
CommitDate: Mon, 14 Apr 2014 12:55:41 +0200

perf bench: Update manpage to mention numa and futex

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Arnaldo Carvalho de Melo a...@redhat.com
Cc: David Ahern dsah...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1395964219-22173-3-git-send-email-artag...@gmail.com
Signed-off-by: Jiri Olsa jo...@redhat.com
---
 tools/perf/Documentation/perf-bench.txt | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/tools/perf/Documentation/perf-bench.txt 
b/tools/perf/Documentation/perf-bench.txt
index 7065cd6..4464ad7 100644
--- a/tools/perf/Documentation/perf-bench.txt
+++ b/tools/perf/Documentation/perf-bench.txt
@@ -48,6 +48,12 @@ SUBSYSTEM
 'mem'::
Memory access performance.
 
+'numa'::
+   NUMA scheduling and MM benchmarks.
+
+'futex'::
+   Futex stressing benchmarks.
+
 'all'::
All benchmark subsystems.
 
@@ -187,6 +193,22 @@ Show only the result with page faults before memset.
 --no-prefault::
 Show only the result without page faults before memset.
 
+SUITES FOR 'numa'
+~
+*mem*::
+Suite for evaluating NUMA workloads.
+
+SUITES FOR 'futex'
+~~
+*hash*::
+Suite for evaluating hash tables.
+
+*wake*::
+Suite for evaluating wake calls.
+
+*requeue*::
+Suite for evaluating requeue calls.
+
 SEE ALSO
 
 linkperf:perf[1]
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf bench: Fix segfault at the end of an 'all' execution

2014-04-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  5673872d4afd2584e075cf2b1adb2cccec46a0f3
Gitweb: http://git.kernel.org/tip/5673872d4afd2584e075cf2b1adb2cccec46a0f3
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 27 Mar 2014 19:50:19 -0400
Committer:  Jiri Olsa jo...@redhat.com
CommitDate: Mon, 14 Apr 2014 12:55:53 +0200

perf bench: Fix segfault at the end of an 'all' execution

At the end of

  $ perf bench all

the program segfaults because it attempts to dereference a NULL
pointer. Fix this fault.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Arnaldo Carvalho de Melo a...@redhat.com
Cc: David Ahern dsah...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1395964219-22173-4-git-send-email-artag...@gmail.com
Signed-off-by: Jiri Olsa jo...@redhat.com
---
 tools/perf/builtin-bench.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index f600b74..1e6e777 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -86,7 +86,7 @@ static struct collection collections[] = {
 
 /* Iterate over all benchmarks within a collection: */
 #define for_each_bench(coll, bench) \
-   for (bench = coll-benchmarks; bench-name; bench++)
+   for (bench = coll-benchmarks; bench  bench-name; bench++)
 
 static void dump_benchmarks(struct collection *coll)
 {
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf bench: Set more defaults in the 'numa' suite

2014-04-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  40ba93e3aa001246110320edbe8cf2eb488c1fe7
Gitweb: http://git.kernel.org/tip/40ba93e3aa001246110320edbe8cf2eb488c1fe7
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 27 Mar 2014 19:50:17 -0400
Committer:  Jiri Olsa jo...@redhat.com
CommitDate: Mon, 14 Apr 2014 12:55:58 +0200

perf bench: Set more defaults in the 'numa' suite

Currently,

  $ perf bench numa mem

errors out with usage information. To make this more user-friendly, let
us provide a minimum set of default values required for a test
run. As an added bonus,

  $ perf bench all

now goes all the way to completion.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Arnaldo Carvalho de Melo a...@redhat.com
Cc: David Ahern dsah...@gmail.com
Cc: Ingo Molnar mi...@redhat.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1395964219-22173-2-git-send-email-artag...@gmail.com
Signed-off-by: Jiri Olsa jo...@redhat.com
---
 tools/perf/bench/numa.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index d4c83c6..20697fb 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -1593,6 +1593,10 @@ static void init_params(struct params *p, const char 
*name, int argc, const char
p-data_rand_walk   = true;
p-nr_loops = -1;
p-init_random  = true;
+   p-mb_global_str= 1;
+   p-nr_proc  = 1;
+   p-nr_threads   = 1;
+   p-nr_secs  = 5;
 }
 
 static int run_bench_numa(const char *name, const char **argv)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Update some code references in design.txt

2014-03-19 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  b68eebd1c2a539256e373123cdefabfd1986bfe2
Gitweb: http://git.kernel.org/tip/b68eebd1c2a539256e373123cdefabfd1986bfe2
Author: Ramkumar Ramachandra 
AuthorDate: Tue, 18 Mar 2014 15:10:04 -0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 18 Mar 2014 18:17:06 -0300

perf tools: Update some code references in design.txt

Update the names of some functions and enums in design.txt. The document
still has some stale information, but the motivation behind this patch
is to allow a developer to quickly grep and learn about the associated
structures.

Signed-off-by: Ramkumar Ramachandra 
Cc: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1395169804-1293-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/design.txt | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/design.txt b/tools/perf/design.txt
index 63a0e6f..a28dca2 100644
--- a/tools/perf/design.txt
+++ b/tools/perf/design.txt
@@ -18,7 +18,7 @@ underlying hardware counters.
 Performance counters are accessed via special file descriptors.
 There's one file descriptor per virtual counter used.
 
-The special file descriptor is opened via the perf_event_open()
+The special file descriptor is opened via the sys_perf_event_open()
 system call:
 
int sys_perf_event_open(struct perf_event_attr *hw_event_uptr,
@@ -82,7 +82,7 @@ machine-specific.
 If 'raw_type' is 0, then the 'type' field says what kind of counter
 this is, with the following encoding:
 
-enum perf_event_types {
+enum perf_type_id {
PERF_TYPE_HARDWARE  = 0,
PERF_TYPE_SOFTWARE  = 1,
PERF_TYPE_TRACEPOINT= 2,
@@ -95,7 +95,7 @@ specified by 'event_id':
  * Generalized performance counter event types, used by the hw_event.event_id
  * parameter of the sys_perf_event_open() syscall:
  */
-enum hw_event_ids {
+enum perf_hw_id {
/*
 * Common hardware events, generalized by the kernel:
 */
@@ -129,7 +129,7 @@ software events, selected by 'event_id':
  * physical and sw events of the kernel (and allow the profiling of them as
  * well):
  */
-enum sw_event_ids {
+enum perf_sw_ids {
PERF_COUNT_SW_CPU_CLOCK = 0,
PERF_COUNT_SW_TASK_CLOCK= 1,
PERF_COUNT_SW_PAGE_FAULTS   = 2,
@@ -230,7 +230,7 @@ these events are recorded in the ring-buffer (see below).
 The 'comm' bit allows tracking of process comm data on process creation.
 This too is recorded in the ring-buffer (see below).
 
-The 'pid' parameter to the perf_event_open() system call allows the
+The 'pid' parameter to the sys_perf_event_open() system call allows the
 counter to be specific to a task:
 
  pid == 0: if the pid parameter is zero, the counter is attached to the
@@ -260,7 +260,7 @@ The 'flags' parameter is currently unused and must be zero.
 
 The 'group_fd' parameter allows counter "groups" to be set up.  A
 counter group has one counter which is the group "leader".  The leader
-is created first, with group_fd = -1 in the perf_event_open call
+is created first, with group_fd = -1 in the sys_perf_event_open call
 that creates it.  The rest of the group members are created
 subsequently, with group_fd giving the fd of the group leader.
 (A single counter on its own is created with group_fd = -1 and is
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf timechart: Fix off-by-one error in 'record' argv handling

2014-03-19 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  263f89bf7d0f5ba98077dda8df1ff814862ad5ba
Gitweb: http://git.kernel.org/tip/263f89bf7d0f5ba98077dda8df1ff814862ad5ba
Author: Ramkumar Ramachandra 
AuthorDate: Sun, 16 Mar 2014 12:06:05 -0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 18 Mar 2014 18:16:47 -0300

perf timechart: Fix off-by-one error in 'record' argv handling

Since 367b315 (perf timechart: Add support for -P and -T in timechart
recording, 2013-11-01), the 'perf timechart record' command stopped
working:

  $ perf timechart record -- git status
  Workload failed: No such file or directory

This happens because of an off-by-one error while preparing the argv for
cmd_record(): it attempts to execute the command 'status' and complains
that it doesn't exist. Fix this error.

Signed-off-by: Ramkumar Ramachandra 
Acked-by: Stanislav Fomichev 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Stanislav Fomichev 
Link: 
http://lkml.kernel.org/r/1394985965-2332-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-timechart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 25526d6..d4991a2 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -1238,7 +1238,7 @@ static int timechart__record(struct timechart *tchart, 
int argc, const char **ar
for (i = 0; i < old_power_args_nr; i++)
*p++ = strdup(old_power_args[i]);
 
-   for (j = 1; j < (unsigned int)argc; j++)
+   for (j = 0; j < (unsigned int)argc; j++)
*p++ = argv[j];
 
return cmd_record(rec_argc, rec_argv, NULL);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf evsel: Update function names in debug messages

2014-03-19 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a33f6efc43cb71795bbdaf0251544ff3edbfdb2f
Gitweb: http://git.kernel.org/tip/a33f6efc43cb71795bbdaf0251544ff3edbfdb2f
Author: Ramkumar Ramachandra 
AuthorDate: Tue, 18 Mar 2014 15:10:42 -0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 18 Mar 2014 18:17:05 -0300

perf evsel: Update function names in debug messages

perf_event_open() was renamed to sys_perf_event_open(); update the debug
messages to reflect this.

Signed-off-by: Ramkumar Ramachandra 
Cc: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1395169842-1399-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/evsel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 26b67b1..5c28d82 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1023,7 +1023,7 @@ retry_sample_id:
 
group_fd = get_group_fd(evsel, cpu, thread);
 retry_open:
-   pr_debug2("perf_event_open: pid %d  cpu %d  group_fd %d 
 flags %#lx\n",
+   pr_debug2("sys_perf_event_open: pid %d  cpu %d  
group_fd %d  flags %#lx\n",
  pid, cpus->map[cpu], group_fd, flags);
 
FD(evsel, cpu, thread) = 
sys_perf_event_open(>attr,
@@ -1032,7 +1032,7 @@ retry_open:
 group_fd, 
flags);
if (FD(evsel, cpu, thread) < 0) {
err = -errno;
-   pr_debug2("perf_event_open failed, error %d\n",
+   pr_debug2("sys_perf_event_open failed, error 
%d\n",
  err);
goto try_fallback;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf sched: Fixup header alignment in 'latency' output

2014-03-19 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  80790e0b7ef768b6591fdf764b62c572b76a5d80
Gitweb: http://git.kernel.org/tip/80790e0b7ef768b6591fdf764b62c572b76a5d80
Author: Ramkumar Ramachandra 
AuthorDate: Mon, 17 Mar 2014 10:18:21 -0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 18 Mar 2014 18:16:55 -0300

perf sched: Fixup header alignment in 'latency' output

Before:

 
---
  Task  |   Runtime ms  | Switches | Average delay ms | Maximum 
delay ms | Maximum delay at |
 
---
  ...   |   |  |  | 
 |
  git:24540 |336.622 ms |   10 | avg:0.032 ms | max:
0.062 ms | max at: 115610.111046 s
  git:24541 |  0.457 ms |1 | avg:0.000 ms | max:
0.000 ms | max at:  0.00 s
 
-
  TOTAL:|396.542 ms |  353 |
 ---

After:

 
-
  Task  |   Runtime ms  | Switches | Average delay ms | Maximum 
delay ms | Maximum delay at   |
 
-
  ...   |   |  |  | 
 |
  git:24540 |336.622 ms |   10 | avg:0.032 ms | max:
0.062 ms | max at: 115610.111046 s
  git:24541 |  0.457 ms |1 | avg:0.000 ms | max:
0.000 ms | max at:  0.00 s
 
-
  TOTAL:|396.542 ms |  353 |
 ---

Signed-off-by: Ramkumar Ramachandra 
Cc: David Ahern 
Cc: Frederic Weisbecker 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1395065901-25740-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-sched.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 6a76a07..9ac0a49 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1124,7 +1124,7 @@ static void output_lat_thread(struct perf_sched *sched, 
struct work_atoms *work_
 
avg = work_list->total_lat / work_list->nb_atoms;
 
-   printf("|%11.3f ms |%9" PRIu64 " | avg:%9.3f ms | max:%9.3f ms | max 
at: %9.6f s\n",
+   printf("|%11.3f ms |%9" PRIu64 " | avg:%9.3f ms | max:%9.3f ms | max 
at: %13.6f s\n",
  (double)work_list->total_runtime / 1e6,
 work_list->nb_atoms, (double)avg / 1e6,
 (double)work_list->max_lat / 1e6,
@@ -1527,9 +1527,9 @@ static int perf_sched__lat(struct perf_sched *sched)
 
perf_sched__sort_lat(sched);
 
-   printf("\n 
---\n");
-   printf("  Task  |   Runtime ms  | Switches | Average 
delay ms | Maximum delay ms | Maximum delay at |\n");
-   printf(" 
---\n");
+   printf("\n 
-\n");
+   printf("  Task  |   Runtime ms  | Switches | Average 
delay ms | Maximum delay ms | Maximum delay at   |\n");
+   printf(" 
-\n");
 
next = rb_first(>sorted_atom_root);
 
@@ -1541,7 +1541,7 @@ static int perf_sched__lat(struct perf_sched *sched)
next = rb_next(next);
}
 
-   printf(" 
-\n");
+   printf(" 
-\n");
printf("  TOTAL:|%11.3f ms |%9" PRIu64 " |\n",
(double)sched->all_runtime / 1e6, sched->all_count);
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Remove unused simple_strtoul() function

2014-03-19 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a51e87cb5a0fbebee15a3373d951dbf6f59a76c2
Gitweb: http://git.kernel.org/tip/a51e87cb5a0fbebee15a3373d951dbf6f59a76c2
Author: Ramkumar Ramachandra 
AuthorDate: Tue, 18 Mar 2014 17:05:15 -0400
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 18 Mar 2014 18:17:07 -0300

perf tools: Remove unused simple_strtoul() function

Moreover, the corresponding function in include/linux/kernel.h is marked
obsolete.

Signed-off-by: Ramkumar Ramachandra 
Cc: David Ahern 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1395176715-4465-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/include/linux/kernel.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/tools/perf/util/include/linux/kernel.h 
b/tools/perf/util/include/linux/kernel.h
index d8c927c..9844c31 100644
--- a/tools/perf/util/include/linux/kernel.h
+++ b/tools/perf/util/include/linux/kernel.h
@@ -94,12 +94,6 @@ static inline int scnprintf(char * buf, size_t size, const 
char * fmt, ...)
return (i >= ssize) ? (ssize - 1) : i;
 }
 
-static inline unsigned long
-simple_strtoul(const char *nptr, char **endptr, int base)
-{
-   return strtoul(nptr, endptr, base);
-}
-
 int eprintf(int level,
const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Remove unused simple_strtoul() function

2014-03-19 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a51e87cb5a0fbebee15a3373d951dbf6f59a76c2
Gitweb: http://git.kernel.org/tip/a51e87cb5a0fbebee15a3373d951dbf6f59a76c2
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Tue, 18 Mar 2014 17:05:15 -0400
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Tue, 18 Mar 2014 18:17:07 -0300

perf tools: Remove unused simple_strtoul() function

Moreover, the corresponding function in include/linux/kernel.h is marked
obsolete.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: David Ahern dsah...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1395176715-4465-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/util/include/linux/kernel.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/tools/perf/util/include/linux/kernel.h 
b/tools/perf/util/include/linux/kernel.h
index d8c927c..9844c31 100644
--- a/tools/perf/util/include/linux/kernel.h
+++ b/tools/perf/util/include/linux/kernel.h
@@ -94,12 +94,6 @@ static inline int scnprintf(char * buf, size_t size, const 
char * fmt, ...)
return (i = ssize) ? (ssize - 1) : i;
 }
 
-static inline unsigned long
-simple_strtoul(const char *nptr, char **endptr, int base)
-{
-   return strtoul(nptr, endptr, base);
-}
-
 int eprintf(int level,
const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf timechart: Fix off-by-one error in 'record' argv handling

2014-03-19 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  263f89bf7d0f5ba98077dda8df1ff814862ad5ba
Gitweb: http://git.kernel.org/tip/263f89bf7d0f5ba98077dda8df1ff814862ad5ba
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Sun, 16 Mar 2014 12:06:05 -0400
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Tue, 18 Mar 2014 18:16:47 -0300

perf timechart: Fix off-by-one error in 'record' argv handling

Since 367b315 (perf timechart: Add support for -P and -T in timechart
recording, 2013-11-01), the 'perf timechart record' command stopped
working:

  $ perf timechart record -- git status
  Workload failed: No such file or directory

This happens because of an off-by-one error while preparing the argv for
cmd_record(): it attempts to execute the command 'status' and complains
that it doesn't exist. Fix this error.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: Stanislav Fomichev stfomic...@yandex-team.ru
Cc: David Ahern dsah...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Cc: Namhyung Kim namhy...@kernel.org
Cc: Stanislav Fomichev stfomic...@yandex-team.ru
Link: 
http://lkml.kernel.org/r/1394985965-2332-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/builtin-timechart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 25526d6..d4991a2 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -1238,7 +1238,7 @@ static int timechart__record(struct timechart *tchart, 
int argc, const char **ar
for (i = 0; i  old_power_args_nr; i++)
*p++ = strdup(old_power_args[i]);
 
-   for (j = 1; j  (unsigned int)argc; j++)
+   for (j = 0; j  (unsigned int)argc; j++)
*p++ = argv[j];
 
return cmd_record(rec_argc, rec_argv, NULL);
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf evsel: Update function names in debug messages

2014-03-19 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a33f6efc43cb71795bbdaf0251544ff3edbfdb2f
Gitweb: http://git.kernel.org/tip/a33f6efc43cb71795bbdaf0251544ff3edbfdb2f
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Tue, 18 Mar 2014 15:10:42 -0400
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Tue, 18 Mar 2014 18:17:05 -0300

perf evsel: Update function names in debug messages

perf_event_open() was renamed to sys_perf_event_open(); update the debug
messages to reflect this.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: David Ahern dsah...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1395169842-1399-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/util/evsel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 26b67b1..5c28d82 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1023,7 +1023,7 @@ retry_sample_id:
 
group_fd = get_group_fd(evsel, cpu, thread);
 retry_open:
-   pr_debug2(perf_event_open: pid %d  cpu %d  group_fd %d 
 flags %#lx\n,
+   pr_debug2(sys_perf_event_open: pid %d  cpu %d  
group_fd %d  flags %#lx\n,
  pid, cpus-map[cpu], group_fd, flags);
 
FD(evsel, cpu, thread) = 
sys_perf_event_open(evsel-attr,
@@ -1032,7 +1032,7 @@ retry_open:
 group_fd, 
flags);
if (FD(evsel, cpu, thread)  0) {
err = -errno;
-   pr_debug2(perf_event_open failed, error %d\n,
+   pr_debug2(sys_perf_event_open failed, error 
%d\n,
  err);
goto try_fallback;
}
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf sched: Fixup header alignment in 'latency' output

2014-03-19 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  80790e0b7ef768b6591fdf764b62c572b76a5d80
Gitweb: http://git.kernel.org/tip/80790e0b7ef768b6591fdf764b62c572b76a5d80
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Mon, 17 Mar 2014 10:18:21 -0400
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Tue, 18 Mar 2014 18:16:55 -0300

perf sched: Fixup header alignment in 'latency' output

Before:

 
---
  Task  |   Runtime ms  | Switches | Average delay ms | Maximum 
delay ms | Maximum delay at |
 
---
  ...   |   |  |  | 
 |
  git:24540 |336.622 ms |   10 | avg:0.032 ms | max:
0.062 ms | max at: 115610.111046 s
  git:24541 |  0.457 ms |1 | avg:0.000 ms | max:
0.000 ms | max at:  0.00 s
 
-
  TOTAL:|396.542 ms |  353 |
 ---

After:

 
-
  Task  |   Runtime ms  | Switches | Average delay ms | Maximum 
delay ms | Maximum delay at   |
 
-
  ...   |   |  |  | 
 |
  git:24540 |336.622 ms |   10 | avg:0.032 ms | max:
0.062 ms | max at: 115610.111046 s
  git:24541 |  0.457 ms |1 | avg:0.000 ms | max:
0.000 ms | max at:  0.00 s
 
-
  TOTAL:|396.542 ms |  353 |
 ---

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: David Ahern dsah...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1395065901-25740-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/builtin-sched.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 6a76a07..9ac0a49 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1124,7 +1124,7 @@ static void output_lat_thread(struct perf_sched *sched, 
struct work_atoms *work_
 
avg = work_list-total_lat / work_list-nb_atoms;
 
-   printf(|%11.3f ms |%9 PRIu64  | avg:%9.3f ms | max:%9.3f ms | max 
at: %9.6f s\n,
+   printf(|%11.3f ms |%9 PRIu64  | avg:%9.3f ms | max:%9.3f ms | max 
at: %13.6f s\n,
  (double)work_list-total_runtime / 1e6,
 work_list-nb_atoms, (double)avg / 1e6,
 (double)work_list-max_lat / 1e6,
@@ -1527,9 +1527,9 @@ static int perf_sched__lat(struct perf_sched *sched)
 
perf_sched__sort_lat(sched);
 
-   printf(\n 
---\n);
-   printf(  Task  |   Runtime ms  | Switches | Average 
delay ms | Maximum delay ms | Maximum delay at |\n);
-   printf( 
---\n);
+   printf(\n 
-\n);
+   printf(  Task  |   Runtime ms  | Switches | Average 
delay ms | Maximum delay ms | Maximum delay at   |\n);
+   printf( 
-\n);
 
next = rb_first(sched-sorted_atom_root);
 
@@ -1541,7 +1541,7 @@ static int perf_sched__lat(struct perf_sched *sched)
next = rb_next(next);
}
 
-   printf( 
-\n);
+   printf( 
-\n);
printf(  TOTAL:|%11.3f ms |%9 PRIu64  |\n,
(double)sched-all_runtime / 1e6, sched-all_count);
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Update some code references in design.txt

2014-03-19 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  b68eebd1c2a539256e373123cdefabfd1986bfe2
Gitweb: http://git.kernel.org/tip/b68eebd1c2a539256e373123cdefabfd1986bfe2
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Tue, 18 Mar 2014 15:10:04 -0400
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Tue, 18 Mar 2014 18:17:06 -0300

perf tools: Update some code references in design.txt

Update the names of some functions and enums in design.txt. The document
still has some stale information, but the motivation behind this patch
is to allow a developer to quickly grep and learn about the associated
structures.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: David Ahern dsah...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1395169804-1293-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/design.txt | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/design.txt b/tools/perf/design.txt
index 63a0e6f..a28dca2 100644
--- a/tools/perf/design.txt
+++ b/tools/perf/design.txt
@@ -18,7 +18,7 @@ underlying hardware counters.
 Performance counters are accessed via special file descriptors.
 There's one file descriptor per virtual counter used.
 
-The special file descriptor is opened via the perf_event_open()
+The special file descriptor is opened via the sys_perf_event_open()
 system call:
 
int sys_perf_event_open(struct perf_event_attr *hw_event_uptr,
@@ -82,7 +82,7 @@ machine-specific.
 If 'raw_type' is 0, then the 'type' field says what kind of counter
 this is, with the following encoding:
 
-enum perf_event_types {
+enum perf_type_id {
PERF_TYPE_HARDWARE  = 0,
PERF_TYPE_SOFTWARE  = 1,
PERF_TYPE_TRACEPOINT= 2,
@@ -95,7 +95,7 @@ specified by 'event_id':
  * Generalized performance counter event types, used by the hw_event.event_id
  * parameter of the sys_perf_event_open() syscall:
  */
-enum hw_event_ids {
+enum perf_hw_id {
/*
 * Common hardware events, generalized by the kernel:
 */
@@ -129,7 +129,7 @@ software events, selected by 'event_id':
  * physical and sw events of the kernel (and allow the profiling of them as
  * well):
  */
-enum sw_event_ids {
+enum perf_sw_ids {
PERF_COUNT_SW_CPU_CLOCK = 0,
PERF_COUNT_SW_TASK_CLOCK= 1,
PERF_COUNT_SW_PAGE_FAULTS   = 2,
@@ -230,7 +230,7 @@ these events are recorded in the ring-buffer (see below).
 The 'comm' bit allows tracking of process comm data on process creation.
 This too is recorded in the ring-buffer (see below).
 
-The 'pid' parameter to the perf_event_open() system call allows the
+The 'pid' parameter to the sys_perf_event_open() system call allows the
 counter to be specific to a task:
 
  pid == 0: if the pid parameter is zero, the counter is attached to the
@@ -260,7 +260,7 @@ The 'flags' parameter is currently unused and must be zero.
 
 The 'group_fd' parameter allows counter groups to be set up.  A
 counter group has one counter which is the group leader.  The leader
-is created first, with group_fd = -1 in the perf_event_open call
+is created first, with group_fd = -1 in the sys_perf_event_open call
 that creates it.  The rest of the group members are created
 subsequently, with group_fd giving the fd of the group leader.
 (A single counter on its own is created with group_fd = -1 and is
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf kvm: introduce --list-cmds for use by scripts

2014-03-18 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  09a71b97cce70551356b13b668aa1d7d6da84457
Gitweb: http://git.kernel.org/tip/09a71b97cce70551356b13b668aa1d7d6da84457
Author: Ramkumar Ramachandra 
AuthorDate: Mon, 3 Mar 2014 20:26:36 -0500
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 14 Mar 2014 18:08:41 -0300

perf kvm: introduce --list-cmds for use by scripts

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.

Signed-off-by: Ramkumar Ramachandra 
Acked-by: David Ahern 
Acked-by: Jiri Olsa 
Cc: David Ahern 
Link: 
http://lkml.kernel.org/r/1393896396-10427-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 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 [] 
{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(, "perf %s [] {", argv[0]);
+   for (int i = 0; subcommands[i]; i++) {
+   if (i)
+   strbuf_addstr(, "|");
+   strbuf_addstr(, subcommands[i]);
+   }
+   strbuf_addstr(, "}");
+
+   usagestr[0] = strdup(buf.buf);
+   strbuf_release();
+   }
+
parse_options_start(, argc, argv, flags);
switch (parse_options_step(, 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) {
   

[tip:perf/core] perf kvm: introduce --list-cmds for use by scripts

2014-03-18 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  09a71b97cce70551356b13b668aa1d7d6da84457
Gitweb: http://git.kernel.org/tip/09a71b97cce70551356b13b668aa1d7d6da84457
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Mon, 3 Mar 2014 20:26:36 -0500
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Fri, 14 Mar 2014 18:08:41 -0300

perf kvm: introduce --list-cmds for use by scripts

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.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: David Ahern dsah...@gmail.com
Acked-by: Jiri Olsa jo...@redhat.com
Cc: David Ahern dsah...@gmail.com
Link: 
http://lkml.kernel.org/r/1393896396-10427-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 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 

[tip:perf/core] perf tools: Generalize percent_color_snprintf()

2014-01-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  f77c6e9c8f9c444cd44423df0c2708e86a06a696
Gitweb: http://git.kernel.org/tip/f77c6e9c8f9c444cd44423df0c2708e86a06a696
Author: Ramkumar Ramachandra 
AuthorDate: Mon, 30 Dec 2013 13:04:18 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Jan 2014 10:46:39 -0300

perf tools: Generalize percent_color_snprintf()

Make percent_color_snprintf() handle negative values correctly.

Signed-off-by: Ramkumar Ramachandra 
Acked-by: Jiri Olsa 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1388388861-7931-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/color.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index 66e44a5..8cda46c 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -1,6 +1,7 @@
 #include 
 #include "cache.h"
 #include "color.h"
+#include 
 
 int perf_use_color_default = -1;
 
@@ -298,10 +299,10 @@ const char *get_percent_color(double percent)
 * entries in green - and keep the low overhead places
 * normal:
 */
-   if (percent >= MIN_RED)
+   if (fabs(percent) >= MIN_RED)
color = PERF_COLOR_RED;
else {
-   if (percent > MIN_GREEN)
+   if (fabs(percent) > MIN_GREEN)
color = PERF_COLOR_GREEN;
}
return color;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf diff: Color the Ratio column

2014-01-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  1f513b2c1e8a2008b8ab767fdb6fa6c154591ed3
Gitweb: http://git.kernel.org/tip/1f513b2c1e8a2008b8ab767fdb6fa6c154591ed3
Author: Ramkumar Ramachandra 
AuthorDate: Mon, 30 Dec 2013 13:04:20 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Jan 2014 11:37:17 -0300

perf diff: Color the Ratio column

In

  $ perf diff -c ratio

color the Ratio column using value_color_snprintf(), a new function that
operates exactly like percent_color_snprintf().

At first glance, it looks like percent_color_snprintf() can be turned
into a non-variadic function simplifying things; however, 53805ec (perf
tools: Remove cast of non-variadic function to variadic, 2013-10-31)
explains why it needs to be a variadic function.

Signed-off-by: Ramkumar Ramachandra 
Acked-by: Jiri Olsa 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1388388861-7931-4-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-diff.c | 20 
 tools/perf/util/color.c   | 10 +++---
 tools/perf/util/color.h   |  1 +
 3 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 6c3f220..73d8bff 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -795,6 +795,17 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
scnprintf(pfmt, 20, "%%%+d.2f", dfmt->header_width - 1);
return percent_color_snprintf(hpp->buf, hpp->size,
pfmt, diff);
+   case COMPUTE_RATIO:
+   if (he->dummy)
+   goto dummy_print;
+   if (pair->diff.computed)
+   diff = pair->diff.period_ratio;
+   else
+   diff = compute_ratio(he, pair);
+
+   scnprintf(pfmt, 20, "%%%d.6f", dfmt->header_width);
+   return value_color_snprintf(hpp->buf, hpp->size,
+   pfmt, diff);
default:
BUG_ON(1);
}
@@ -809,6 +820,12 @@ static int hpp__color_delta(struct perf_hpp_fmt *fmt,
return __hpp__color_compare(fmt, hpp, he, COMPUTE_DELTA);
 }
 
+static int hpp__color_ratio(struct perf_hpp_fmt *fmt,
+   struct perf_hpp *hpp, struct hist_entry *he)
+{
+   return __hpp__color_compare(fmt, hpp, he, COMPUTE_RATIO);
+}
+
 static void
 hpp__entry_unpair(struct hist_entry *he, int idx, char *buf, size_t size)
 {
@@ -987,6 +1004,9 @@ static void data__hpp_register(struct data__file *d, int 
idx)
case PERF_HPP_DIFF__DELTA:
fmt->color = hpp__color_delta;
break;
+   case PERF_HPP_DIFF__RATIO:
+   fmt->color = hpp__color_ratio;
+   break;
default:
break;
}
diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index 8cda46c..87b8672 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -319,15 +319,19 @@ int percent_color_fprintf(FILE *fp, const char *fmt, 
double percent)
return r;
 }
 
+int value_color_snprintf(char *bf, size_t size, const char *fmt, double value)
+{
+   const char *color = get_percent_color(value);
+   return color_snprintf(bf, size, color, fmt, value);
+}
+
 int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...)
 {
va_list args;
double percent;
-   const char *color;
 
va_start(args, fmt);
percent = va_arg(args, double);
va_end(args);
-   color = get_percent_color(percent);
-   return color_snprintf(bf, size, color, fmt, percent);
+   return value_color_snprintf(bf, size, fmt, percent);
 }
diff --git a/tools/perf/util/color.h b/tools/perf/util/color.h
index fced384..7ff30a6 100644
--- a/tools/perf/util/color.h
+++ b/tools/perf/util/color.h
@@ -39,6 +39,7 @@ int color_fprintf(FILE *fp, const char *color, const char 
*fmt, ...);
 int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, 
...);
 int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...);
 int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char 
*buf);
+int value_color_snprintf(char *bf, size_t size, const char *fmt, double value);
 int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...);
 int percent_color_fprintf(FILE *fp, const char *fmt, double percent);
 const char *get_percent_color(double percent);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf diff: Color the Delta column

2014-01-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  01f10bc85f538cd681d0a3338b97a33f308d944b
Gitweb: http://git.kernel.org/tip/01f10bc85f538cd681d0a3338b97a33f308d944b
Author: Ramkumar Ramachandra 
AuthorDate: Mon, 30 Dec 2013 13:04:19 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Jan 2014 11:36:46 -0300

perf diff: Color the Delta column

Color the numbers in the Delta column using percent_color_snprintf().

Generalize the coloring function so that we can accommodate all three
comparison methods in future patches: delta, ratio, and wdiff.

Signed-off-by: Ramkumar Ramachandra 
Acked-by: Jiri Olsa 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1388388861-7931-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-diff.c | 49 ++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 987cac3..6c3f220 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -770,6 +770,45 @@ static int hpp__entry_baseline(struct hist_entry *he, char 
*buf, size_t size)
return ret;
 }
 
+static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
+   struct perf_hpp *hpp, struct hist_entry *he,
+   int comparison_method)
+{
+   struct diff_hpp_fmt *dfmt =
+   container_of(fmt, struct diff_hpp_fmt, fmt);
+   struct hist_entry *pair = get_pair_fmt(he, dfmt);
+   double diff;
+   char pfmt[20] = " ";
+
+   if (!pair)
+   goto dummy_print;
+
+   switch (comparison_method) {
+   case COMPUTE_DELTA:
+   if (pair->diff.computed)
+   diff = pair->diff.period_ratio_delta;
+   else
+   diff = compute_delta(he, pair);
+
+   if (fabs(diff) < 0.01)
+   goto dummy_print;
+   scnprintf(pfmt, 20, "%%%+d.2f", dfmt->header_width - 1);
+   return percent_color_snprintf(hpp->buf, hpp->size,
+   pfmt, diff);
+   default:
+   BUG_ON(1);
+   }
+dummy_print:
+   return scnprintf(hpp->buf, hpp->size, "%*s",
+   dfmt->header_width, pfmt);
+}
+
+static int hpp__color_delta(struct perf_hpp_fmt *fmt,
+   struct perf_hpp *hpp, struct hist_entry *he)
+{
+   return __hpp__color_compare(fmt, hpp, he, COMPUTE_DELTA);
+}
+
 static void
 hpp__entry_unpair(struct hist_entry *he, int idx, char *buf, size_t size)
 {
@@ -941,8 +980,16 @@ static void data__hpp_register(struct data__file *d, int 
idx)
fmt->entry  = hpp__entry_global;
 
/* TODO more colors */
-   if (idx == PERF_HPP_DIFF__BASELINE)
+   switch (idx) {
+   case PERF_HPP_DIFF__BASELINE:
fmt->color = hpp__color_baseline;
+   break;
+   case PERF_HPP_DIFF__DELTA:
+   fmt->color = hpp__color_delta;
+   break;
+   default:
+   break;
+   }
 
init_header(d, dfmt);
perf_hpp__column_register(fmt);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf diff: Color the Weighted Diff column

2014-01-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a5846e215bd47f61133383822422c683600efa7a
Gitweb: http://git.kernel.org/tip/a5846e215bd47f61133383822422c683600efa7a
Author: Ramkumar Ramachandra 
AuthorDate: Mon, 30 Dec 2013 13:32:35 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Jan 2014 11:38:25 -0300

perf diff: Color the Weighted Diff column

In

  $ perf diff -c wdiff:M,N

color the numbers in the Weighted Diff column using color_snprintf(),
picking the colors using get_percent_color().

Signed-off-by: Ramkumar Ramachandra 
Acked-by: Jiri Olsa 
Cc: Jiri Olsa 
Link: 
http://lkml.kernel.org/r/1388390555-10808-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-diff.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 73d8bff..a77e312 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -778,6 +778,7 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
container_of(fmt, struct diff_hpp_fmt, fmt);
struct hist_entry *pair = get_pair_fmt(he, dfmt);
double diff;
+   s64 wdiff;
char pfmt[20] = " ";
 
if (!pair)
@@ -806,6 +807,18 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
scnprintf(pfmt, 20, "%%%d.6f", dfmt->header_width);
return value_color_snprintf(hpp->buf, hpp->size,
pfmt, diff);
+   case COMPUTE_WEIGHTED_DIFF:
+   if (he->dummy)
+   goto dummy_print;
+   if (pair->diff.computed)
+   wdiff = pair->diff.wdiff;
+   else
+   wdiff = compute_wdiff(he, pair);
+
+   scnprintf(pfmt, 20, "%%14ld", dfmt->header_width);
+   return color_snprintf(hpp->buf, hpp->size,
+   get_percent_color(wdiff),
+   pfmt, wdiff);
default:
BUG_ON(1);
}
@@ -826,6 +839,12 @@ static int hpp__color_ratio(struct perf_hpp_fmt *fmt,
return __hpp__color_compare(fmt, hpp, he, COMPUTE_RATIO);
 }
 
+static int hpp__color_wdiff(struct perf_hpp_fmt *fmt,
+   struct perf_hpp *hpp, struct hist_entry *he)
+{
+   return __hpp__color_compare(fmt, hpp, he, COMPUTE_WEIGHTED_DIFF);
+}
+
 static void
 hpp__entry_unpair(struct hist_entry *he, int idx, char *buf, size_t size)
 {
@@ -1007,6 +1026,9 @@ static void data__hpp_register(struct data__file *d, int 
idx)
case PERF_HPP_DIFF__RATIO:
fmt->color = hpp__color_ratio;
break;
+   case PERF_HPP_DIFF__WEIGHTED_DIFF:
+   fmt->color = hpp__color_wdiff;
+   break;
default:
break;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf diff: Color the Weighted Diff column

2014-01-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a5846e215bd47f61133383822422c683600efa7a
Gitweb: http://git.kernel.org/tip/a5846e215bd47f61133383822422c683600efa7a
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Mon, 30 Dec 2013 13:32:35 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Mon, 13 Jan 2014 11:38:25 -0300

perf diff: Color the Weighted Diff column

In

  $ perf diff -c wdiff:M,N

color the numbers in the Weighted Diff column using color_snprintf(),
picking the colors using get_percent_color().

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: Jiri Olsa jo...@redhat.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1388390555-10808-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/builtin-diff.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 73d8bff..a77e312 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -778,6 +778,7 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
container_of(fmt, struct diff_hpp_fmt, fmt);
struct hist_entry *pair = get_pair_fmt(he, dfmt);
double diff;
+   s64 wdiff;
char pfmt[20] =  ;
 
if (!pair)
@@ -806,6 +807,18 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
scnprintf(pfmt, 20, %%%d.6f, dfmt-header_width);
return value_color_snprintf(hpp-buf, hpp-size,
pfmt, diff);
+   case COMPUTE_WEIGHTED_DIFF:
+   if (he-dummy)
+   goto dummy_print;
+   if (pair-diff.computed)
+   wdiff = pair-diff.wdiff;
+   else
+   wdiff = compute_wdiff(he, pair);
+
+   scnprintf(pfmt, 20, %%14ld, dfmt-header_width);
+   return color_snprintf(hpp-buf, hpp-size,
+   get_percent_color(wdiff),
+   pfmt, wdiff);
default:
BUG_ON(1);
}
@@ -826,6 +839,12 @@ static int hpp__color_ratio(struct perf_hpp_fmt *fmt,
return __hpp__color_compare(fmt, hpp, he, COMPUTE_RATIO);
 }
 
+static int hpp__color_wdiff(struct perf_hpp_fmt *fmt,
+   struct perf_hpp *hpp, struct hist_entry *he)
+{
+   return __hpp__color_compare(fmt, hpp, he, COMPUTE_WEIGHTED_DIFF);
+}
+
 static void
 hpp__entry_unpair(struct hist_entry *he, int idx, char *buf, size_t size)
 {
@@ -1007,6 +1026,9 @@ static void data__hpp_register(struct data__file *d, int 
idx)
case PERF_HPP_DIFF__RATIO:
fmt-color = hpp__color_ratio;
break;
+   case PERF_HPP_DIFF__WEIGHTED_DIFF:
+   fmt-color = hpp__color_wdiff;
+   break;
default:
break;
}
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf diff: Color the Delta column

2014-01-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  01f10bc85f538cd681d0a3338b97a33f308d944b
Gitweb: http://git.kernel.org/tip/01f10bc85f538cd681d0a3338b97a33f308d944b
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Mon, 30 Dec 2013 13:04:19 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Mon, 13 Jan 2014 11:36:46 -0300

perf diff: Color the Delta column

Color the numbers in the Delta column using percent_color_snprintf().

Generalize the coloring function so that we can accommodate all three
comparison methods in future patches: delta, ratio, and wdiff.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: Jiri Olsa jo...@redhat.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1388388861-7931-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/builtin-diff.c | 49 ++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 987cac3..6c3f220 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -770,6 +770,45 @@ static int hpp__entry_baseline(struct hist_entry *he, char 
*buf, size_t size)
return ret;
 }
 
+static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
+   struct perf_hpp *hpp, struct hist_entry *he,
+   int comparison_method)
+{
+   struct diff_hpp_fmt *dfmt =
+   container_of(fmt, struct diff_hpp_fmt, fmt);
+   struct hist_entry *pair = get_pair_fmt(he, dfmt);
+   double diff;
+   char pfmt[20] =  ;
+
+   if (!pair)
+   goto dummy_print;
+
+   switch (comparison_method) {
+   case COMPUTE_DELTA:
+   if (pair-diff.computed)
+   diff = pair-diff.period_ratio_delta;
+   else
+   diff = compute_delta(he, pair);
+
+   if (fabs(diff)  0.01)
+   goto dummy_print;
+   scnprintf(pfmt, 20, %%%+d.2f, dfmt-header_width - 1);
+   return percent_color_snprintf(hpp-buf, hpp-size,
+   pfmt, diff);
+   default:
+   BUG_ON(1);
+   }
+dummy_print:
+   return scnprintf(hpp-buf, hpp-size, %*s,
+   dfmt-header_width, pfmt);
+}
+
+static int hpp__color_delta(struct perf_hpp_fmt *fmt,
+   struct perf_hpp *hpp, struct hist_entry *he)
+{
+   return __hpp__color_compare(fmt, hpp, he, COMPUTE_DELTA);
+}
+
 static void
 hpp__entry_unpair(struct hist_entry *he, int idx, char *buf, size_t size)
 {
@@ -941,8 +980,16 @@ static void data__hpp_register(struct data__file *d, int 
idx)
fmt-entry  = hpp__entry_global;
 
/* TODO more colors */
-   if (idx == PERF_HPP_DIFF__BASELINE)
+   switch (idx) {
+   case PERF_HPP_DIFF__BASELINE:
fmt-color = hpp__color_baseline;
+   break;
+   case PERF_HPP_DIFF__DELTA:
+   fmt-color = hpp__color_delta;
+   break;
+   default:
+   break;
+   }
 
init_header(d, dfmt);
perf_hpp__column_register(fmt);
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf diff: Color the Ratio column

2014-01-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  1f513b2c1e8a2008b8ab767fdb6fa6c154591ed3
Gitweb: http://git.kernel.org/tip/1f513b2c1e8a2008b8ab767fdb6fa6c154591ed3
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Mon, 30 Dec 2013 13:04:20 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Mon, 13 Jan 2014 11:37:17 -0300

perf diff: Color the Ratio column

In

  $ perf diff -c ratio

color the Ratio column using value_color_snprintf(), a new function that
operates exactly like percent_color_snprintf().

At first glance, it looks like percent_color_snprintf() can be turned
into a non-variadic function simplifying things; however, 53805ec (perf
tools: Remove cast of non-variadic function to variadic, 2013-10-31)
explains why it needs to be a variadic function.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: Jiri Olsa jo...@redhat.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1388388861-7931-4-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/builtin-diff.c | 20 
 tools/perf/util/color.c   | 10 +++---
 tools/perf/util/color.h   |  1 +
 3 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 6c3f220..73d8bff 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -795,6 +795,17 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
scnprintf(pfmt, 20, %%%+d.2f, dfmt-header_width - 1);
return percent_color_snprintf(hpp-buf, hpp-size,
pfmt, diff);
+   case COMPUTE_RATIO:
+   if (he-dummy)
+   goto dummy_print;
+   if (pair-diff.computed)
+   diff = pair-diff.period_ratio;
+   else
+   diff = compute_ratio(he, pair);
+
+   scnprintf(pfmt, 20, %%%d.6f, dfmt-header_width);
+   return value_color_snprintf(hpp-buf, hpp-size,
+   pfmt, diff);
default:
BUG_ON(1);
}
@@ -809,6 +820,12 @@ static int hpp__color_delta(struct perf_hpp_fmt *fmt,
return __hpp__color_compare(fmt, hpp, he, COMPUTE_DELTA);
 }
 
+static int hpp__color_ratio(struct perf_hpp_fmt *fmt,
+   struct perf_hpp *hpp, struct hist_entry *he)
+{
+   return __hpp__color_compare(fmt, hpp, he, COMPUTE_RATIO);
+}
+
 static void
 hpp__entry_unpair(struct hist_entry *he, int idx, char *buf, size_t size)
 {
@@ -987,6 +1004,9 @@ static void data__hpp_register(struct data__file *d, int 
idx)
case PERF_HPP_DIFF__DELTA:
fmt-color = hpp__color_delta;
break;
+   case PERF_HPP_DIFF__RATIO:
+   fmt-color = hpp__color_ratio;
+   break;
default:
break;
}
diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index 8cda46c..87b8672 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -319,15 +319,19 @@ int percent_color_fprintf(FILE *fp, const char *fmt, 
double percent)
return r;
 }
 
+int value_color_snprintf(char *bf, size_t size, const char *fmt, double value)
+{
+   const char *color = get_percent_color(value);
+   return color_snprintf(bf, size, color, fmt, value);
+}
+
 int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...)
 {
va_list args;
double percent;
-   const char *color;
 
va_start(args, fmt);
percent = va_arg(args, double);
va_end(args);
-   color = get_percent_color(percent);
-   return color_snprintf(bf, size, color, fmt, percent);
+   return value_color_snprintf(bf, size, fmt, percent);
 }
diff --git a/tools/perf/util/color.h b/tools/perf/util/color.h
index fced384..7ff30a6 100644
--- a/tools/perf/util/color.h
+++ b/tools/perf/util/color.h
@@ -39,6 +39,7 @@ int color_fprintf(FILE *fp, const char *color, const char 
*fmt, ...);
 int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, 
...);
 int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...);
 int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char 
*buf);
+int value_color_snprintf(char *bf, size_t size, const char *fmt, double value);
 int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...);
 int percent_color_fprintf(FILE *fp, const char *fmt, double percent);
 const char *get_percent_color(double percent);
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Generalize percent_color_snprintf()

2014-01-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  f77c6e9c8f9c444cd44423df0c2708e86a06a696
Gitweb: http://git.kernel.org/tip/f77c6e9c8f9c444cd44423df0c2708e86a06a696
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Mon, 30 Dec 2013 13:04:18 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Mon, 13 Jan 2014 10:46:39 -0300

perf tools: Generalize percent_color_snprintf()

Make percent_color_snprintf() handle negative values correctly.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: Jiri Olsa jo...@redhat.com
Cc: Jiri Olsa jo...@redhat.com
Link: 
http://lkml.kernel.org/r/1388388861-7931-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/util/color.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c
index 66e44a5..8cda46c 100644
--- a/tools/perf/util/color.c
+++ b/tools/perf/util/color.c
@@ -1,6 +1,7 @@
 #include linux/kernel.h
 #include cache.h
 #include color.h
+#include math.h
 
 int perf_use_color_default = -1;
 
@@ -298,10 +299,10 @@ const char *get_percent_color(double percent)
 * entries in green - and keep the low overhead places
 * normal:
 */
-   if (percent = MIN_RED)
+   if (fabs(percent) = MIN_RED)
color = PERF_COLOR_RED;
else {
-   if (percent  MIN_GREEN)
+   if (fabs(percent)  MIN_GREEN)
color = PERF_COLOR_GREEN;
}
return color;
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Complete 'perf kvm'

2013-12-16 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  8f2f5ada719560954174da30ce0a67261c616e39
Gitweb: http://git.kernel.org/tip/8f2f5ada719560954174da30ce0a67261c616e39
Author: Ramkumar Ramachandra 
AuthorDate: Wed, 11 Dec 2013 16:04:15 +0530
Committer:  Arnaldo Carvalho de Melo 
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 
Link: 
http://lkml.kernel.org/r/1386758056-24618-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 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]}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Complete 'perf kvm'

2013-12-16 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  8f2f5ada719560954174da30ce0a67261c616e39
Gitweb: http://git.kernel.org/tip/8f2f5ada719560954174da30ce0a67261c616e39
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Wed, 11 Dec 2013 16:04:15 +0530
Committer:  Arnaldo Carvalho de Melo a...@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 artag...@gmail.com
Link: 
http://lkml.kernel.org/r/1386758056-24618-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@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]}
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Rename file to reflect zsh support

2013-11-30 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a8b4c7014cadfdacd4e1f4c963128593be6f20de
Gitweb: http://git.kernel.org/tip/a8b4c7014cadfdacd4e1f4c963128593be6f20de
Author: Ramkumar Ramachandra 
AuthorDate: Sun, 17 Nov 2013 21:43:27 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300

perf completion: Rename file to reflect zsh support

Signed-off-by: Ramkumar Ramachandra 
Cc: Ingo Molnar 
Link: 
http://lkml.kernel.org/r/1384704807-15779-6-git-send-email-artag...@gmail.com
[ Fix 'make install' target ]
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Makefile.perf   | 4 ++--
 tools/perf/{bash_completion => perf-completion.sh} | 0
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 7fc8f17..e416ccc 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -840,9 +840,9 @@ ifndef NO_LIBPYTHON
$(INSTALL) scripts/python/*.py -t 
'$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'; \
$(INSTALL) scripts/python/bin/* -t 
'$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
 endif
-   $(call QUIET_INSTALL, bash_completion-script) \
+   $(call QUIET_INSTALL, perf_completion-script) \
$(INSTALL) -d -m 755 
'$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \
-   $(INSTALL) bash_completion 
'$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+   $(INSTALL) perf-completion.sh 
'$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
$(call QUIET_INSTALL, tests) \
$(INSTALL) -d -m 755 
'$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
$(INSTALL) tests/attr.py 
'$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
diff --git a/tools/perf/bash_completion b/tools/perf/perf-completion.sh
similarity index 100%
rename from tools/perf/bash_completion
rename to tools/perf/perf-completion.sh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Factor out call to __ltrim_colon_completions

2013-11-30 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  37e72c31061521d6f0e4b7fe47cd5748280ed691
Gitweb: http://git.kernel.org/tip/37e72c31061521d6f0e4b7fe47cd5748280ed691
Author: Ramkumar Ramachandra 
AuthorDate: Sun, 17 Nov 2013 21:43:25 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300

perf completion: Factor out call to __ltrim_colon_completions

In our sole callsite, __ltrim_colon_completions is called after
__perfcomp, to modify the COMPREPLY set by the invocation.

This is problematic, because in the zsh equivalent (using compset/
compadd), we'll have to generate completions in one-shot.

So factor out this entire callsite into a special override'able
__perfcomp_colon function; we will override it when introducing zsh
support.

Signed-off-by: Ramkumar Ramachandra 
Cc: Ingo Molnar 
Link: 
http://lkml.kernel.org/r/1384704807-15779-4-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bash_completion | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 82431268..573599b 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -94,6 +94,12 @@ __perfcomp ()
COMPREPLY=( $( compgen -W "$1" -- "$2" ) )
 }
 
+__perfcomp_colon ()
+{
+   __perfcomp "$1" "$2"
+   __ltrim_colon_completions $cur
+}
+
 __perf_main ()
 {
local cmd
@@ -114,8 +120,7 @@ __perf_main ()
# List possible events for -e option
elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
-   __perfcomp "$evts" "$cur"
-   __ltrim_colon_completions $cur
+   __perfcomp_colon "$evts" "$cur"
# List long option names
elif [[ $cur == --* ]];  then
subcmd=${words[1]}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Introduce zsh support

2013-11-30 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  f38ab8af794c184c15f5e001d0eaa16f4a120978
Gitweb: http://git.kernel.org/tip/f38ab8af794c184c15f5e001d0eaa16f4a120978
Author: Ramkumar Ramachandra 
AuthorDate: Sun, 17 Nov 2013 21:43:26 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300

perf completion: Introduce zsh support

__perfcomp(), __perfcomp_colon(), and _perf() have to be overridden.
Inspired by the way the git.git completion system is structured.

Signed-off-by: Ramkumar Ramachandra 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Link: 
http://lkml.kernel.org/r/1384704807-15779-5-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bash_completion | 63 +-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 573599b..4949488 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -1,4 +1,4 @@
-# perf completion
+# perf bash and zsh completion
 
 # Taken from git.git's completion script.
 __my_reassemble_comp_words_by_ref()
@@ -129,6 +129,67 @@ __perf_main ()
fi
 }
 
+if [[ -n ${ZSH_VERSION-} ]]; then
+   autoload -U +X compinit && compinit
+
+   __perfcomp ()
+   {
+   emulate -L zsh
+
+   local c IFS=$' \t\n'
+   local -a array
+
+   for c in ${=1}; do
+   case $c in
+   --*=*|*.) ;;
+   *) c="$c " ;;
+   esac
+   array[${#array[@]}+1]="$c"
+   done
+
+   compset -P '*[=:]'
+   compadd -Q -S '' -a -- array && _ret=0
+   }
+
+   __perfcomp_colon ()
+   {
+   emulate -L zsh
+
+   local cur_="${2-$cur}"
+   local c IFS=$' \t\n'
+   local -a array
+
+   if [[ "$cur_" == *:* ]]; then
+   local colon_word=${cur_%"${cur_##*:}"}
+   fi
+
+   for c in ${=1}; do
+   case $c in
+   --*=*|*.) ;;
+   *) c="$c " ;;
+   esac
+   array[$#array+1]=${c#"$colon_word"}
+   done
+
+   compset -P '*[=:]'
+   compadd -Q -S '' -a -- array && _ret=0
+   }
+
+   _perf ()
+   {
+   local _ret=1 cur cword prev
+   cur=${words[CURRENT]}
+   prev=${words[CURRENT-1]}
+   let cword=CURRENT-1
+   emulate ksh -c __perf_main
+   let _ret && _default && _ret=0
+   return _ret
+   }
+
+   compdef _perf perf
+   return
+fi
+
 type perf &>/dev/null &&
 _perf()
 {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Factor out compgen stuff

2013-11-30 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  12f9dd5042483698c74a133d9004ff1d1a6474f9
Gitweb: http://git.kernel.org/tip/12f9dd5042483698c74a133d9004ff1d1a6474f9
Author: Ramkumar Ramachandra 
AuthorDate: Sun, 17 Nov 2013 21:43:24 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300

perf completion: Factor out compgen stuff

compgen is a bash-builtin; factor out the invocations into a separate
function to give us a chance to override it with a zsh equivalent in
future patches.

Signed-off-by: Ramkumar Ramachandra 
Cc: Ingo Molnar 
Link: 
http://lkml.kernel.org/r/1384704807-15779-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bash_completion | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 3efdc84..82431268 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -89,6 +89,11 @@ __ltrim_colon_completions()
fi
 }
 
+__perfcomp ()
+{
+   COMPREPLY=( $( compgen -W "$1" -- "$2" ) )
+}
+
 __perf_main ()
 {
local cmd
@@ -99,23 +104,23 @@ __perf_main ()
# List perf subcommands or long options
if [ $cword -eq 1 ]; then
if [[ $cur == --* ]]; then
-   COMPREPLY=( $( compgen -W '--help --version \
+   __perfcomp '--help --version \
--exec-path --html-path --paginate --no-pager \
-   --perf-dir --work-tree --debugfs-dir' -- "$cur" ) )
+   --perf-dir --work-tree --debugfs-dir' -- "$cur"
else
cmds=$($cmd --list-cmds)
-   COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
+   __perfcomp "$cmds" "$cur"
fi
# List possible events for -e option
elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
-   COMPREPLY=( $( compgen -W '$evts' -- "$cur" ) )
+   __perfcomp "$evts" "$cur"
__ltrim_colon_completions $cur
# List long option names
elif [[ $cur == --* ]];  then
subcmd=${words[1]}
opts=$($cmd $subcmd --list-opts)
-   COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
+   __perfcomp "$opts" "$cur"
fi
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Introduce a layer of indirection

2013-11-30 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  2cf025e69543f5f4aa68e8549d60680515fef5ad
Gitweb: http://git.kernel.org/tip/2cf025e69543f5f4aa68e8549d60680515fef5ad
Author: Ramkumar Ramachandra 
AuthorDate: Sun, 17 Nov 2013 21:43:23 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300

perf completion: Introduce a layer of indirection

Define the variables cur, words, cword, and prev outside the main
completion function so that we have a chance to override it when we
introduce zsh support.

Signed-off-by: Ramkumar Ramachandra 
Cc: Ingo Molnar 
Link: 
http://lkml.kernel.org/r/1384704807-15779-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bash_completion | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 62e157db..3efdc84 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -89,15 +89,12 @@ __ltrim_colon_completions()
fi
 }
 
-type perf &>/dev/null &&
-_perf()
+__perf_main ()
 {
-   local cur words cword prev cmd
-
-   COMPREPLY=()
-   _get_comp_words_by_ref -n =: cur words cword prev
+   local cmd
 
cmd=${words[0]}
+   COMPREPLY=()
 
# List perf subcommands or long options
if [ $cword -eq 1 ]; then
@@ -120,6 +117,14 @@ _perf()
opts=$($cmd $subcmd --list-opts)
COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
fi
+}
+
+type perf &>/dev/null &&
+_perf()
+{
+   local cur words cword prev
+   _get_comp_words_by_ref -n =: cur words cword prev
+   __perf_main
 } &&
 
 complete -o bashdefault -o default -o nospace -F _perf perf 2>/dev/null \
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Introduce a layer of indirection

2013-11-30 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  2cf025e69543f5f4aa68e8549d60680515fef5ad
Gitweb: http://git.kernel.org/tip/2cf025e69543f5f4aa68e8549d60680515fef5ad
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Sun, 17 Nov 2013 21:43:23 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300

perf completion: Introduce a layer of indirection

Define the variables cur, words, cword, and prev outside the main
completion function so that we have a chance to override it when we
introduce zsh support.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Link: 
http://lkml.kernel.org/r/1384704807-15779-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/bash_completion | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 62e157db..3efdc84 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -89,15 +89,12 @@ __ltrim_colon_completions()
fi
 }
 
-type perf /dev/null 
-_perf()
+__perf_main ()
 {
-   local cur words cword prev cmd
-
-   COMPREPLY=()
-   _get_comp_words_by_ref -n =: cur words cword prev
+   local cmd
 
cmd=${words[0]}
+   COMPREPLY=()
 
# List perf subcommands or long options
if [ $cword -eq 1 ]; then
@@ -120,6 +117,14 @@ _perf()
opts=$($cmd $subcmd --list-opts)
COMPREPLY=( $( compgen -W '$opts' -- $cur ) )
fi
+}
+
+type perf /dev/null 
+_perf()
+{
+   local cur words cword prev
+   _get_comp_words_by_ref -n =: cur words cword prev
+   __perf_main
 } 
 
 complete -o bashdefault -o default -o nospace -F _perf perf 2/dev/null \
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Factor out call to __ltrim_colon_completions

2013-11-30 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  37e72c31061521d6f0e4b7fe47cd5748280ed691
Gitweb: http://git.kernel.org/tip/37e72c31061521d6f0e4b7fe47cd5748280ed691
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Sun, 17 Nov 2013 21:43:25 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300

perf completion: Factor out call to __ltrim_colon_completions

In our sole callsite, __ltrim_colon_completions is called after
__perfcomp, to modify the COMPREPLY set by the invocation.

This is problematic, because in the zsh equivalent (using compset/
compadd), we'll have to generate completions in one-shot.

So factor out this entire callsite into a special override'able
__perfcomp_colon function; we will override it when introducing zsh
support.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Link: 
http://lkml.kernel.org/r/1384704807-15779-4-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/bash_completion | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 82431268..573599b 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -94,6 +94,12 @@ __perfcomp ()
COMPREPLY=( $( compgen -W $1 -- $2 ) )
 }
 
+__perfcomp_colon ()
+{
+   __perfcomp $1 $2
+   __ltrim_colon_completions $cur
+}
+
 __perf_main ()
 {
local cmd
@@ -114,8 +120,7 @@ __perf_main ()
# List possible events for -e option
elif [[ $prev == -e  ${words[1]} == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
-   __perfcomp $evts $cur
-   __ltrim_colon_completions $cur
+   __perfcomp_colon $evts $cur
# List long option names
elif [[ $cur == --* ]];  then
subcmd=${words[1]}
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Introduce zsh support

2013-11-30 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  f38ab8af794c184c15f5e001d0eaa16f4a120978
Gitweb: http://git.kernel.org/tip/f38ab8af794c184c15f5e001d0eaa16f4a120978
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Sun, 17 Nov 2013 21:43:26 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300

perf completion: Introduce zsh support

__perfcomp(), __perfcomp_colon(), and _perf() have to be overridden.
Inspired by the way the git.git completion system is structured.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Namhyung Kim namhy...@kernel.org
Link: 
http://lkml.kernel.org/r/1384704807-15779-5-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/bash_completion | 63 +-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 573599b..4949488 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -1,4 +1,4 @@
-# perf completion
+# perf bash and zsh completion
 
 # Taken from git.git's completion script.
 __my_reassemble_comp_words_by_ref()
@@ -129,6 +129,67 @@ __perf_main ()
fi
 }
 
+if [[ -n ${ZSH_VERSION-} ]]; then
+   autoload -U +X compinit  compinit
+
+   __perfcomp ()
+   {
+   emulate -L zsh
+
+   local c IFS=$' \t\n'
+   local -a array
+
+   for c in ${=1}; do
+   case $c in
+   --*=*|*.) ;;
+   *) c=$c  ;;
+   esac
+   array[${#array[@]}+1]=$c
+   done
+
+   compset -P '*[=:]'
+   compadd -Q -S '' -a -- array  _ret=0
+   }
+
+   __perfcomp_colon ()
+   {
+   emulate -L zsh
+
+   local cur_=${2-$cur}
+   local c IFS=$' \t\n'
+   local -a array
+
+   if [[ $cur_ == *:* ]]; then
+   local colon_word=${cur_%${cur_##*:}}
+   fi
+
+   for c in ${=1}; do
+   case $c in
+   --*=*|*.) ;;
+   *) c=$c  ;;
+   esac
+   array[$#array+1]=${c#$colon_word}
+   done
+
+   compset -P '*[=:]'
+   compadd -Q -S '' -a -- array  _ret=0
+   }
+
+   _perf ()
+   {
+   local _ret=1 cur cword prev
+   cur=${words[CURRENT]}
+   prev=${words[CURRENT-1]}
+   let cword=CURRENT-1
+   emulate ksh -c __perf_main
+   let _ret  _default  _ret=0
+   return _ret
+   }
+
+   compdef _perf perf
+   return
+fi
+
 type perf /dev/null 
 _perf()
 {
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Factor out compgen stuff

2013-11-30 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  12f9dd5042483698c74a133d9004ff1d1a6474f9
Gitweb: http://git.kernel.org/tip/12f9dd5042483698c74a133d9004ff1d1a6474f9
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Sun, 17 Nov 2013 21:43:24 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300

perf completion: Factor out compgen stuff

compgen is a bash-builtin; factor out the invocations into a separate
function to give us a chance to override it with a zsh equivalent in
future patches.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Link: 
http://lkml.kernel.org/r/1384704807-15779-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/bash_completion | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 3efdc84..82431268 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -89,6 +89,11 @@ __ltrim_colon_completions()
fi
 }
 
+__perfcomp ()
+{
+   COMPREPLY=( $( compgen -W $1 -- $2 ) )
+}
+
 __perf_main ()
 {
local cmd
@@ -99,23 +104,23 @@ __perf_main ()
# List perf subcommands or long options
if [ $cword -eq 1 ]; then
if [[ $cur == --* ]]; then
-   COMPREPLY=( $( compgen -W '--help --version \
+   __perfcomp '--help --version \
--exec-path --html-path --paginate --no-pager \
-   --perf-dir --work-tree --debugfs-dir' -- $cur ) )
+   --perf-dir --work-tree --debugfs-dir' -- $cur
else
cmds=$($cmd --list-cmds)
-   COMPREPLY=( $( compgen -W '$cmds' -- $cur ) )
+   __perfcomp $cmds $cur
fi
# List possible events for -e option
elif [[ $prev == -e  ${words[1]} == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
-   COMPREPLY=( $( compgen -W '$evts' -- $cur ) )
+   __perfcomp $evts $cur
__ltrim_colon_completions $cur
# List long option names
elif [[ $cur == --* ]];  then
subcmd=${words[1]}
opts=$($cmd $subcmd --list-opts)
-   COMPREPLY=( $( compgen -W '$opts' -- $cur ) )
+   __perfcomp $opts $cur
fi
 }
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Rename file to reflect zsh support

2013-11-30 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  a8b4c7014cadfdacd4e1f4c963128593be6f20de
Gitweb: http://git.kernel.org/tip/a8b4c7014cadfdacd4e1f4c963128593be6f20de
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Sun, 17 Nov 2013 21:43:27 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300

perf completion: Rename file to reflect zsh support

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Link: 
http://lkml.kernel.org/r/1384704807-15779-6-git-send-email-artag...@gmail.com
[ Fix 'make install' target ]
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/Makefile.perf   | 4 ++--
 tools/perf/{bash_completion = perf-completion.sh} | 0
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 7fc8f17..e416ccc 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -840,9 +840,9 @@ ifndef NO_LIBPYTHON
$(INSTALL) scripts/python/*.py -t 
'$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'; \
$(INSTALL) scripts/python/bin/* -t 
'$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
 endif
-   $(call QUIET_INSTALL, bash_completion-script) \
+   $(call QUIET_INSTALL, perf_completion-script) \
$(INSTALL) -d -m 755 
'$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \
-   $(INSTALL) bash_completion 
'$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+   $(INSTALL) perf-completion.sh 
'$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
$(call QUIET_INSTALL, tests) \
$(INSTALL) -d -m 755 
'$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
$(INSTALL) tests/attr.py 
'$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
diff --git a/tools/perf/bash_completion b/tools/perf/perf-completion.sh
similarity index 100%
rename from tools/perf/bash_completion
rename to tools/perf/perf-completion.sh
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Update __ltrim_colon_completions

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  30079d1d5ebcb8d706c6e05cacebb7facc60cd95
Gitweb: http://git.kernel.org/tip/30079d1d5ebcb8d706c6e05cacebb7facc60cd95
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 4 Jul 2013 18:11:26 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 9 Oct 2013 11:11:48 -0300

perf completion: Update __ltrim_colon_completions

The function is taken from the bash-completion package; update it to use
the latest version where colon_word doesn't miss quoting.

Signed-off-by: Ramkumar Ramachandra 
Cc: Frederic Weisbecker 
Link: 
http://lkml.kernel.org/r/1372941691-14684-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bash_completion | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 50540cf..b0cdd12 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -11,7 +11,7 @@ __ltrim_colon_completions()
 {
if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then
# Remove colon-word prefix from COMPREPLY items
-   local colon_word=${1%${1##*:}}
+   local colon_word=${1%"${1##*:}"}
local i=${#COMPREPLY[*]}
while [[ $((--i)) -ge 0 ]]; do
COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Strip dependency on _filedir

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  7b6c48e16e5d312b0ebae78acfb3ff4f9c8c083c
Gitweb: http://git.kernel.org/tip/7b6c48e16e5d312b0ebae78acfb3ff4f9c8c083c
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 4 Jul 2013 18:11:27 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 9 Oct 2013 11:11:55 -0300

perf completion: Strip dependency on _filedir

_filedir is defined in the bash-completion package, but there is no need
to depend on it.  Instead, call complete with multiple -o arguments
before the -F argument like in git.git's completion script.

Signed-off-by: Ramkumar Ramachandra 
Cc: Frederic Weisbecker 
Link: 
http://lkml.kernel.org/r/1372941691-14684-4-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bash_completion | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index b0cdd12..d2598be 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -54,9 +54,8 @@ _perf()
subcmd=${COMP_WORDS[1]}
opts=$($cmd $subcmd --list-opts)
COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
-   # Fall down to list regular files
-   else
-   _filedir
fi
 } &&
-complete -F _perf perf
+
+complete -o bashdefault -o default -o nospace -F _perf perf 2>/dev/null \
+   || complete -o default -o nospace -F _perf perf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf stat: Don't print bogus data on -e cycles

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  c458fe62ca31496664c1211a7906d261220b18f9
Gitweb: http://git.kernel.org/tip/c458fe62ca31496664c1211a7906d261220b18f9
Author: Ramkumar Ramachandra 
AuthorDate: Mon, 30 Sep 2013 16:43:05 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 11 Oct 2013 12:17:33 -0300

perf stat: Don't print bogus data on -e cycles

When only the cycles event is requested:

$ perf stat -e cycles dd if=/dev/zero of=/dev/null count=100
100+0 records in
100+0 records out
51200 bytes (512 MB) copied, 0.26123 s, 2.0 GB/s

 Performance counter stats for 'dd if=/dev/zero of=/dev/null count=100':

   911,626,453 cycles#0.000 GHz

   0.262113350 seconds time elapsed

The 0.000 GHz comment in the output is totally bogus and misleading. It
happens because update_shadow_stats() doesn't touch runtime_nsecs_stats;
it is only written when a requested counter matches a SW_TASK_CLOCK. In
our case, since we have only requested HW_CPU_CYCLES,
runtime_nsecs_stats is unavailable. So, omit printing the comment
altogether.

Signed-off-by: Ramkumar Ramachandra 
Acked-by: Ingo Molnar 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1380539585-23859-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-stat.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 700b478..ce2266c 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -997,10 +997,10 @@ static void abs_printout(int cpu, int nr, struct 
perf_evsel *evsel, double avg)
} else if (perf_evsel__match(evsel, HARDWARE, HW_CPU_CYCLES)) {
total = avg_stats(_nsecs_stats[cpu]);
 
-   if (total)
-   ratio = 1.0 * avg / total;
-
-   fprintf(output, " # %8.3f GHz", ratio);
+   if (total) {
+   ratio = avg / total;
+   fprintf(output, " # %8.3f GHz", 
ratio);
+   }
} else if (transaction_run &&
   perf_evsel__cmp(evsel, nth_evsel(T_CYCLES_IN_TX))) {
total = avg_stats(_cycles_stats[cpu]);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf timechart: Add example in the documentation

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  d366c53e1d4fc9d7a5826fd82010b3cffaabe5f1
Gitweb: http://git.kernel.org/tip/d366c53e1d4fc9d7a5826fd82010b3cffaabe5f1
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 3 Oct 2013 14:45:16 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 11 Oct 2013 12:18:13 -0300

perf timechart: Add example in the documentation

While at it, update the synopsis to show both forms.

Signed-off-by: Ramkumar Ramachandra 
Cc: David Ahern 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Link: 
http://lkml.kernel.org/r/1380791716-10325-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-timechart.txt | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-timechart.txt 
b/tools/perf/Documentation/perf-timechart.txt
index 1632b0e..3ff8bd4 100644
--- a/tools/perf/Documentation/perf-timechart.txt
+++ b/tools/perf/Documentation/perf-timechart.txt
@@ -8,7 +8,8 @@ perf-timechart - Tool to visualize total system behavior during 
a workload
 SYNOPSIS
 
 [verse]
-'perf timechart' {record}
+'perf timechart' record 
+'perf timechart' []
 
 DESCRIPTION
 ---
@@ -41,6 +42,18 @@ OPTIONS
 --symfs=::
 Look for files with symbols relative to this directory.
 
+EXAMPLES
+
+
+$ perf timechart record git pull
+
+  [ perf record: Woken up 13 times to write data ]
+  [ perf record: Captured and wrote 4.253 MB perf.data (~185801 samples) ]
+
+$ perf timechart
+
+  Written 10.2 seconds of trace to output.svg.
+
 SEE ALSO
 
 linkperf:perf-record[1]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf trace: Improve the error messages

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  87f918685a452be514d060a09eeb4e0c91422e86
Gitweb: http://git.kernel.org/tip/87f918685a452be514d060a09eeb4e0c91422e86
Author: Ramkumar Ramachandra 
AuthorDate: Fri, 4 Oct 2013 10:47:31 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 14 Oct 2013 10:24:04 -0300

perf trace: Improve the error messages

Currently, execution of 'perf trace' reports the following cryptic
message to the user:

$ perf trace
Couldn't read the raw_syscalls tracepoints information!

Typically this happens because the user does not have permissions to
read the debugfs filesystem. Also handle the case when the kernel was
not compiled with debugfs support or when it isn't mounted.

Now, the tool prints detailed error messages:

$ perf trace
Error:  Unable to find debugfs
Hint:   Was your kernel was compiled with debugfs support?
Hint:   Is the debugfs filesystem mounted?
Hint:   Try 'sudo mount -t debugfs nodev /sys/kernel/debug'

$ perf trace
Error:  No permissions to read /sys/kernel/debug//tracing/events/raw_syscalls
Hint:   Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/'

Signed-off-by: Ramkumar Ramachandra 
Cc: David Ahern 
Cc: Ingo Molnar 
Link: 
http://lkml.kernel.org/r/1380863851-14460-1-git-send-email-artag...@gmail.com
[ Added ready to use commands to fix the issues as extra hints, use the
  current debugfs mount point when reporting permission error, use
  strerror_r instead of the deprecated sys_errlist, as reported by David Ahern ]
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-trace.c | 37 -
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 19ddcab..5496546 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1590,17 +1590,13 @@ static int trace__run(struct trace *trace, int argc, 
const char **argv)
}
 
if (perf_evlist__add_newtp(evlist, "raw_syscalls", "sys_enter", 
trace__sys_enter) ||
-   perf_evlist__add_newtp(evlist, "raw_syscalls", "sys_exit", 
trace__sys_exit)) {
-   fprintf(trace->output, "Couldn't read the raw_syscalls 
tracepoints information!\n");
-   goto out_delete_evlist;
-   }
+   perf_evlist__add_newtp(evlist, "raw_syscalls", "sys_exit", 
trace__sys_exit))
+   goto out_error_tp;
 
if (trace->sched &&
-   perf_evlist__add_newtp(evlist, "sched", "sched_stat_runtime",
-  trace__sched_stat_runtime)) {
-   fprintf(trace->output, "Couldn't read the sched_stat_runtime 
tracepoint information!\n");
-   goto out_delete_evlist;
-   }
+   perf_evlist__add_newtp(evlist, "sched", "sched_stat_runtime",
+   trace__sched_stat_runtime))
+   goto out_error_tp;
 
err = perf_evlist__create_maps(evlist, >opts.target);
if (err < 0) {
@@ -1717,6 +1713,29 @@ out_delete_evlist:
 out:
trace->live = false;
return err;
+out_error_tp:
+   switch(errno) {
+   case ENOENT:
+   fputs("Error:\tUnable to find debugfs\n"
+ "Hint:\tWas your kernel was compiled with debugfs 
support?\n"
+ "Hint:\tIs the debugfs filesystem mounted?\n"
+ "Hint:\tTry 'sudo mount -t debugfs nodev 
/sys/kernel/debug'\n",
+ trace->output);
+   break;
+   case EACCES:
+   fprintf(trace->output,
+   "Error:\tNo permissions to read 
%s/tracing/events/raw_syscalls\n"
+   "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n",
+   debugfs_mountpoint, debugfs_mountpoint);
+   break;
+   default: {
+   char bf[256];
+   fprintf(trace->output, "Can't trace: %s\n",
+   strerror_r(errno, bf, sizeof(bf)));
+   }
+   break;
+   }
+   goto out_delete_evlist;
 }
 
 static int trace__replay(struct trace *trace)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Ignore 'perf timechart' output file

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  f3c236b0c7a84e5d59cc639a1673a20b0a59ecc0
Gitweb: http://git.kernel.org/tip/f3c236b0c7a84e5d59cc639a1673a20b0a59ecc0
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 3 Oct 2013 14:10:36 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 11 Oct 2013 12:17:37 -0300

perf tools: Ignore 'perf timechart' output file

The default output file produced by the 'perf timechart' tool is called
output.svg, add it to .gitignore.

Signed-off-by: Ramkumar Ramachandra 
Cc: Ingo Molnar 
Link: 
http://lkml.kernel.org/r/1380789636-4512-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 8f8fbc2..782d86e 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -13,6 +13,7 @@ perf*.html
 common-cmds.h
 perf.data
 perf.data.old
+output.svg
 perf-archive
 tags
 TAGS
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf stat: Don' t print bogus data on -e instructions

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  3e7a081796146f97f166d77a655c0eb585065077
Gitweb: http://git.kernel.org/tip/3e7a081796146f97f166d77a655c0eb585065077
Author: Ramkumar Ramachandra 
AuthorDate: Tue, 1 Oct 2013 14:06:44 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 11 Oct 2013 12:17:35 -0300

perf stat: Don't print bogus data on -e instructions

When only the instructions event is requested:

$ perf stat -e instructions git s
M  builtin-stat.c

 Performance counter stats for 'git s':

   917,453,420 instructions  #0.00  insns per cycle

   0.213002926 seconds time elapsed

The 0.00 insns per cycle comment in the output is totally bogus and
misleading. It happens because update_shadow_stats() doesn't touch
runtime_cycles_stats when only the instructions event is requested. So,
omit printing the bogus data altogether.

Signed-off-by: Ramkumar Ramachandra 
Acked-by: Ingo Molnar 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1380616604-4077-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-stat.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index ce2266c..fb02b53 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -930,11 +930,10 @@ static void abs_printout(int cpu, int nr, struct 
perf_evsel *evsel, double avg)
 
if (perf_evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS)) {
total = avg_stats(_cycles_stats[cpu]);
-   if (total)
+   if (total) {
ratio = avg / total;
-
-   fprintf(output, " #   %5.2f  insns per cycle", ratio);
-
+   fprintf(output, " #   %5.2f  insns per cycle", 
ratio);
+   }
total = avg_stats(_stalled_cycles_front_stats[cpu]);
total = max(total, 
avg_stats(_stalled_cycles_back_stats[cpu]));
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Strip dependency on bash-completion

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  c3fb6717e90049b93d0f5f5714a4d878799d89c2
Gitweb: http://git.kernel.org/tip/c3fb6717e90049b93d0f5f5714a4d878799d89c2
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 4 Jul 2013 18:11:30 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 9 Oct 2013 11:12:24 -0300

perf completion: Strip dependency on bash-completion

The bash-completion package defines the _get_comp_words_by_ref function.
There is no need to depend on it, as we can reimplement it like git.git
has.

Signed-off-by: Ramkumar Ramachandra 
Cc: Frederic Weisbecker 
Cc: Namhyung Kim 
Link: 
http://lkml.kernel.org/r/1372941691-14684-7-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bash_completion | 83 ++
 1 file changed, 77 insertions(+), 6 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 35fdda1..ee9c6d8 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -1,5 +1,81 @@
 # perf completion
 
+# Taken from git.git's completion script.
+__my_reassemble_comp_words_by_ref()
+{
+   local exclude i j first
+   # Which word separators to exclude?
+   exclude="${1//[^$COMP_WORDBREAKS]}"
+   cword_=$COMP_CWORD
+   if [ -z "$exclude" ]; then
+   words_=("${COMP_WORDS[@]}")
+   return
+   fi
+   # List of word completion separators has shrunk;
+   # re-assemble words to complete.
+   for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do
+   # Append each nonempty word consisting of just
+   # word separator characters to the current word.
+   first=t
+   while
+   [ $i -gt 0 ] &&
+   [ -n "${COMP_WORDS[$i]}" ] &&
+   # word consists of excluded word separators
+   [ "${COMP_WORDS[$i]//[^$exclude]}" = 
"${COMP_WORDS[$i]}" ]
+   do
+   # Attach to the previous token,
+   # unless the previous token is the command name.
+   if [ $j -ge 2 ] && [ -n "$first" ]; then
+   ((j--))
+   fi
+   first=
+   words_[$j]=${words_[j]}${COMP_WORDS[i]}
+   if [ $i = $COMP_CWORD ]; then
+   cword_=$j
+   fi
+   if (($i < ${#COMP_WORDS[@]} - 1)); then
+   ((i++))
+   else
+   # Done.
+   return
+   fi
+   done
+   words_[$j]=${words_[j]}${COMP_WORDS[i]}
+   if [ $i = $COMP_CWORD ]; then
+   cword_=$j
+   fi
+   done
+}
+
+type _get_comp_words_by_ref &>/dev/null ||
+_get_comp_words_by_ref()
+{
+   local exclude cur_ words_ cword_
+   if [ "$1" = "-n" ]; then
+   exclude=$2
+   shift 2
+   fi
+   __my_reassemble_comp_words_by_ref "$exclude"
+   cur_=${words_[cword_]}
+   while [ $# -gt 0 ]; do
+   case "$1" in
+   cur)
+   cur=$cur_
+   ;;
+   prev)
+   prev=${words_[$cword_-1]}
+   ;;
+   words)
+   words=("${words_[@]}")
+   ;;
+   cword)
+   cword=$cword_
+   ;;
+   esac
+   shift
+   done
+}
+
 type __ltrim_colon_completions &>/dev/null ||
 __ltrim_colon_completions()
 {
@@ -19,12 +95,7 @@ _perf()
local cur prev cmd
 
COMPREPLY=()
-   if function_exists _get_comp_words_by_ref; then
-   _get_comp_words_by_ref -n : cur prev
-   else
-   cur=$(_get_cword :)
-   prev=${COMP_WORDS[COMP_CWORD-1]}
-   fi
+   _get_comp_words_by_ref -n : cur prev
 
cmd=${COMP_WORDS[0]}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Use more comp words

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  6e0dc374a2c912a8a967ea8a4f9696dd4b0a6d3e
Gitweb: http://git.kernel.org/tip/6e0dc374a2c912a8a967ea8a4f9696dd4b0a6d3e
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 4 Jul 2013 18:11:31 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 9 Oct 2013 11:12:31 -0300

perf completion: Use more comp words

The completion words $words and $cword are available, so we might as
well use them instead of directly accessing COMP_WORDS.

Signed-off-by: Ramkumar Ramachandra 
Cc: Frederic Weisbecker 
Link: 
http://lkml.kernel.org/r/1372941691-14684-8-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bash_completion | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index ee9c6d8..62e157db 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -92,15 +92,15 @@ __ltrim_colon_completions()
 type perf &>/dev/null &&
 _perf()
 {
-   local cur prev cmd
+   local cur words cword prev cmd
 
COMPREPLY=()
-   _get_comp_words_by_ref -n : cur prev
+   _get_comp_words_by_ref -n =: cur words cword prev
 
-   cmd=${COMP_WORDS[0]}
+   cmd=${words[0]}
 
# List perf subcommands or long options
-   if [ $COMP_CWORD -eq 1 ]; then
+   if [ $cword -eq 1 ]; then
if [[ $cur == --* ]]; then
COMPREPLY=( $( compgen -W '--help --version \
--exec-path --html-path --paginate --no-pager \
@@ -110,13 +110,13 @@ _perf()
COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
fi
# List possible events for -e option
-   elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; 
then
+   elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
COMPREPLY=( $( compgen -W '$evts' -- "$cur" ) )
__ltrim_colon_completions $cur
# List long option names
elif [[ $cur == --* ]];  then
-   subcmd=${COMP_WORDS[1]}
+   subcmd=${words[1]}
opts=$($cmd $subcmd --list-opts)
COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
fi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Don' t dictate perf install location

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  1ba6e01782fd2a94481e18b91b363636f8171565
Gitweb: http://git.kernel.org/tip/1ba6e01782fd2a94481e18b91b363636f8171565
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 4 Jul 2013 18:11:25 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 9 Oct 2013 11:11:40 -0300

perf completion: Don't dictate perf install location

The statement

  have perf

limits the locations in which to look for the perf program.  Moreover,
it depends on the bash-completion package to be installed.  Replace it
with a call to `type perf`.

Signed-off-by: Ramkumar Ramachandra 
Cc: Frederic Weisbecker 
Link: 
http://lkml.kernel.org/r/1372941691-14684-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bash_completion | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 56e6a12..50540cf 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -19,7 +19,7 @@ __ltrim_colon_completions()
fi
 }
 
-have perf &&
+type perf &>/dev/null &&
 _perf()
 {
local cur prev cmd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Strip function_exists ()

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  4685a6cfaeac6d2fe8ed10a9aa0cbff5026529cb
Gitweb: http://git.kernel.org/tip/4685a6cfaeac6d2fe8ed10a9aa0cbff5026529cb
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 4 Jul 2013 18:11:29 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 9 Oct 2013 11:12:06 -0300

perf completion: Strip function_exists ()

Use "type" to check existence consistently.

Signed-off-by: Ramkumar Ramachandra 
Cc: Frederic Weisbecker 
Link: 
http://lkml.kernel.org/r/1372941691-14684-6-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bash_completion | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index d2598be..35fdda1 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -1,12 +1,6 @@
 # perf completion
 
-function_exists()
-{
-   declare -F $1 > /dev/null
-   return $?
-}
-
-function_exists __ltrim_colon_completions ||
+type __ltrim_colon_completions &>/dev/null ||
 __ltrim_colon_completions()
 {
if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Strip function_exists ()

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  4685a6cfaeac6d2fe8ed10a9aa0cbff5026529cb
Gitweb: http://git.kernel.org/tip/4685a6cfaeac6d2fe8ed10a9aa0cbff5026529cb
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 4 Jul 2013 18:11:29 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 9 Oct 2013 11:12:06 -0300

perf completion: Strip function_exists ()

Use type to check existence consistently.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Link: 
http://lkml.kernel.org/r/1372941691-14684-6-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/bash_completion | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index d2598be..35fdda1 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -1,12 +1,6 @@
 # perf completion
 
-function_exists()
-{
-   declare -F $1  /dev/null
-   return $?
-}
-
-function_exists __ltrim_colon_completions ||
+type __ltrim_colon_completions /dev/null ||
 __ltrim_colon_completions()
 {
if [[ $1 == *:*  $COMP_WORDBREAKS == *:* ]]; then
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Strip dependency on bash-completion

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  c3fb6717e90049b93d0f5f5714a4d878799d89c2
Gitweb: http://git.kernel.org/tip/c3fb6717e90049b93d0f5f5714a4d878799d89c2
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 4 Jul 2013 18:11:30 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 9 Oct 2013 11:12:24 -0300

perf completion: Strip dependency on bash-completion

The bash-completion package defines the _get_comp_words_by_ref function.
There is no need to depend on it, as we can reimplement it like git.git
has.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Cc: Namhyung Kim namhyung@lge.com
Link: 
http://lkml.kernel.org/r/1372941691-14684-7-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/bash_completion | 83 ++
 1 file changed, 77 insertions(+), 6 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 35fdda1..ee9c6d8 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -1,5 +1,81 @@
 # perf completion
 
+# Taken from git.git's completion script.
+__my_reassemble_comp_words_by_ref()
+{
+   local exclude i j first
+   # Which word separators to exclude?
+   exclude=${1//[^$COMP_WORDBREAKS]}
+   cword_=$COMP_CWORD
+   if [ -z $exclude ]; then
+   words_=(${COMP_WORDS[@]})
+   return
+   fi
+   # List of word completion separators has shrunk;
+   # re-assemble words to complete.
+   for ((i=0, j=0; i  ${#COMP_WORDS[@]}; i++, j++)); do
+   # Append each nonempty word consisting of just
+   # word separator characters to the current word.
+   first=t
+   while
+   [ $i -gt 0 ] 
+   [ -n ${COMP_WORDS[$i]} ] 
+   # word consists of excluded word separators
+   [ ${COMP_WORDS[$i]//[^$exclude]} = 
${COMP_WORDS[$i]} ]
+   do
+   # Attach to the previous token,
+   # unless the previous token is the command name.
+   if [ $j -ge 2 ]  [ -n $first ]; then
+   ((j--))
+   fi
+   first=
+   words_[$j]=${words_[j]}${COMP_WORDS[i]}
+   if [ $i = $COMP_CWORD ]; then
+   cword_=$j
+   fi
+   if (($i  ${#COMP_WORDS[@]} - 1)); then
+   ((i++))
+   else
+   # Done.
+   return
+   fi
+   done
+   words_[$j]=${words_[j]}${COMP_WORDS[i]}
+   if [ $i = $COMP_CWORD ]; then
+   cword_=$j
+   fi
+   done
+}
+
+type _get_comp_words_by_ref /dev/null ||
+_get_comp_words_by_ref()
+{
+   local exclude cur_ words_ cword_
+   if [ $1 = -n ]; then
+   exclude=$2
+   shift 2
+   fi
+   __my_reassemble_comp_words_by_ref $exclude
+   cur_=${words_[cword_]}
+   while [ $# -gt 0 ]; do
+   case $1 in
+   cur)
+   cur=$cur_
+   ;;
+   prev)
+   prev=${words_[$cword_-1]}
+   ;;
+   words)
+   words=(${words_[@]})
+   ;;
+   cword)
+   cword=$cword_
+   ;;
+   esac
+   shift
+   done
+}
+
 type __ltrim_colon_completions /dev/null ||
 __ltrim_colon_completions()
 {
@@ -19,12 +95,7 @@ _perf()
local cur prev cmd
 
COMPREPLY=()
-   if function_exists _get_comp_words_by_ref; then
-   _get_comp_words_by_ref -n : cur prev
-   else
-   cur=$(_get_cword :)
-   prev=${COMP_WORDS[COMP_CWORD-1]}
-   fi
+   _get_comp_words_by_ref -n : cur prev
 
cmd=${COMP_WORDS[0]}
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Use more comp words

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  6e0dc374a2c912a8a967ea8a4f9696dd4b0a6d3e
Gitweb: http://git.kernel.org/tip/6e0dc374a2c912a8a967ea8a4f9696dd4b0a6d3e
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 4 Jul 2013 18:11:31 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 9 Oct 2013 11:12:31 -0300

perf completion: Use more comp words

The completion words $words and $cword are available, so we might as
well use them instead of directly accessing COMP_WORDS.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Link: 
http://lkml.kernel.org/r/1372941691-14684-8-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/bash_completion | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index ee9c6d8..62e157db 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -92,15 +92,15 @@ __ltrim_colon_completions()
 type perf /dev/null 
 _perf()
 {
-   local cur prev cmd
+   local cur words cword prev cmd
 
COMPREPLY=()
-   _get_comp_words_by_ref -n : cur prev
+   _get_comp_words_by_ref -n =: cur words cword prev
 
-   cmd=${COMP_WORDS[0]}
+   cmd=${words[0]}
 
# List perf subcommands or long options
-   if [ $COMP_CWORD -eq 1 ]; then
+   if [ $cword -eq 1 ]; then
if [[ $cur == --* ]]; then
COMPREPLY=( $( compgen -W '--help --version \
--exec-path --html-path --paginate --no-pager \
@@ -110,13 +110,13 @@ _perf()
COMPREPLY=( $( compgen -W '$cmds' -- $cur ) )
fi
# List possible events for -e option
-   elif [[ $prev == -e  ${COMP_WORDS[1]} == @(record|stat|top) ]]; 
then
+   elif [[ $prev == -e  ${words[1]} == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
COMPREPLY=( $( compgen -W '$evts' -- $cur ) )
__ltrim_colon_completions $cur
# List long option names
elif [[ $cur == --* ]];  then
-   subcmd=${COMP_WORDS[1]}
+   subcmd=${words[1]}
opts=$($cmd $subcmd --list-opts)
COMPREPLY=( $( compgen -W '$opts' -- $cur ) )
fi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Don' t dictate perf install location

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  1ba6e01782fd2a94481e18b91b363636f8171565
Gitweb: http://git.kernel.org/tip/1ba6e01782fd2a94481e18b91b363636f8171565
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 4 Jul 2013 18:11:25 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 9 Oct 2013 11:11:40 -0300

perf completion: Don't dictate perf install location

The statement

  have perf

limits the locations in which to look for the perf program.  Moreover,
it depends on the bash-completion package to be installed.  Replace it
with a call to `type perf`.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Link: 
http://lkml.kernel.org/r/1372941691-14684-2-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/bash_completion | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 56e6a12..50540cf 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -19,7 +19,7 @@ __ltrim_colon_completions()
fi
 }
 
-have perf 
+type perf /dev/null 
 _perf()
 {
local cur prev cmd
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf stat: Don' t print bogus data on -e instructions

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  3e7a081796146f97f166d77a655c0eb585065077
Gitweb: http://git.kernel.org/tip/3e7a081796146f97f166d77a655c0eb585065077
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Tue, 1 Oct 2013 14:06:44 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Fri, 11 Oct 2013 12:17:35 -0300

perf stat: Don't print bogus data on -e instructions

When only the instructions event is requested:

$ perf stat -e instructions git s
M  builtin-stat.c

 Performance counter stats for 'git s':

   917,453,420 instructions  #0.00  insns per cycle

   0.213002926 seconds time elapsed

The 0.00 insns per cycle comment in the output is totally bogus and
misleading. It happens because update_shadow_stats() doesn't touch
runtime_cycles_stats when only the instructions event is requested. So,
omit printing the bogus data altogether.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: Ingo Molnar mi...@kernel.org
Cc: Paul Mackerras pau...@samba.org
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Link: 
http://lkml.kernel.org/r/1380616604-4077-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/builtin-stat.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index ce2266c..fb02b53 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -930,11 +930,10 @@ static void abs_printout(int cpu, int nr, struct 
perf_evsel *evsel, double avg)
 
if (perf_evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS)) {
total = avg_stats(runtime_cycles_stats[cpu]);
-   if (total)
+   if (total) {
ratio = avg / total;
-
-   fprintf(output,  #   %5.2f  insns per cycle, ratio);
-
+   fprintf(output,  #   %5.2f  insns per cycle, 
ratio);
+   }
total = avg_stats(runtime_stalled_cycles_front_stats[cpu]);
total = max(total, 
avg_stats(runtime_stalled_cycles_back_stats[cpu]));
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Ignore 'perf timechart' output file

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  f3c236b0c7a84e5d59cc639a1673a20b0a59ecc0
Gitweb: http://git.kernel.org/tip/f3c236b0c7a84e5d59cc639a1673a20b0a59ecc0
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 3 Oct 2013 14:10:36 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Fri, 11 Oct 2013 12:17:37 -0300

perf tools: Ignore 'perf timechart' output file

The default output file produced by the 'perf timechart' tool is called
output.svg, add it to .gitignore.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Link: 
http://lkml.kernel.org/r/1380789636-4512-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 8f8fbc2..782d86e 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -13,6 +13,7 @@ perf*.html
 common-cmds.h
 perf.data
 perf.data.old
+output.svg
 perf-archive
 tags
 TAGS
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf timechart: Add example in the documentation

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  d366c53e1d4fc9d7a5826fd82010b3cffaabe5f1
Gitweb: http://git.kernel.org/tip/d366c53e1d4fc9d7a5826fd82010b3cffaabe5f1
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 3 Oct 2013 14:45:16 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Fri, 11 Oct 2013 12:18:13 -0300

perf timechart: Add example in the documentation

While at it, update the synopsis to show both forms.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: David Ahern dsah...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Namhyung Kim namhy...@gmail.com
Link: 
http://lkml.kernel.org/r/1380791716-10325-1-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/Documentation/perf-timechart.txt | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-timechart.txt 
b/tools/perf/Documentation/perf-timechart.txt
index 1632b0e..3ff8bd4 100644
--- a/tools/perf/Documentation/perf-timechart.txt
+++ b/tools/perf/Documentation/perf-timechart.txt
@@ -8,7 +8,8 @@ perf-timechart - Tool to visualize total system behavior during 
a workload
 SYNOPSIS
 
 [verse]
-'perf timechart' {record}
+'perf timechart' record command
+'perf timechart' [options]
 
 DESCRIPTION
 ---
@@ -41,6 +42,18 @@ OPTIONS
 --symfs=directory::
 Look for files with symbols relative to this directory.
 
+EXAMPLES
+
+
+$ perf timechart record git pull
+
+  [ perf record: Woken up 13 times to write data ]
+  [ perf record: Captured and wrote 4.253 MB perf.data (~185801 samples) ]
+
+$ perf timechart
+
+  Written 10.2 seconds of trace to output.svg.
+
 SEE ALSO
 
 linkperf:perf-record[1]
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf trace: Improve the error messages

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  87f918685a452be514d060a09eeb4e0c91422e86
Gitweb: http://git.kernel.org/tip/87f918685a452be514d060a09eeb4e0c91422e86
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Fri, 4 Oct 2013 10:47:31 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Mon, 14 Oct 2013 10:24:04 -0300

perf trace: Improve the error messages

Currently, execution of 'perf trace' reports the following cryptic
message to the user:

$ perf trace
Couldn't read the raw_syscalls tracepoints information!

Typically this happens because the user does not have permissions to
read the debugfs filesystem. Also handle the case when the kernel was
not compiled with debugfs support or when it isn't mounted.

Now, the tool prints detailed error messages:

$ perf trace
Error:  Unable to find debugfs
Hint:   Was your kernel was compiled with debugfs support?
Hint:   Is the debugfs filesystem mounted?
Hint:   Try 'sudo mount -t debugfs nodev /sys/kernel/debug'

$ perf trace
Error:  No permissions to read /sys/kernel/debug//tracing/events/raw_syscalls
Hint:   Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/'

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: David Ahern dsah...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Link: 
http://lkml.kernel.org/r/1380863851-14460-1-git-send-email-artag...@gmail.com
[ Added ready to use commands to fix the issues as extra hints, use the
  current debugfs mount point when reporting permission error, use
  strerror_r instead of the deprecated sys_errlist, as reported by David Ahern ]
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/builtin-trace.c | 37 -
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 19ddcab..5496546 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1590,17 +1590,13 @@ static int trace__run(struct trace *trace, int argc, 
const char **argv)
}
 
if (perf_evlist__add_newtp(evlist, raw_syscalls, sys_enter, 
trace__sys_enter) ||
-   perf_evlist__add_newtp(evlist, raw_syscalls, sys_exit, 
trace__sys_exit)) {
-   fprintf(trace-output, Couldn't read the raw_syscalls 
tracepoints information!\n);
-   goto out_delete_evlist;
-   }
+   perf_evlist__add_newtp(evlist, raw_syscalls, sys_exit, 
trace__sys_exit))
+   goto out_error_tp;
 
if (trace-sched 
-   perf_evlist__add_newtp(evlist, sched, sched_stat_runtime,
-  trace__sched_stat_runtime)) {
-   fprintf(trace-output, Couldn't read the sched_stat_runtime 
tracepoint information!\n);
-   goto out_delete_evlist;
-   }
+   perf_evlist__add_newtp(evlist, sched, sched_stat_runtime,
+   trace__sched_stat_runtime))
+   goto out_error_tp;
 
err = perf_evlist__create_maps(evlist, trace-opts.target);
if (err  0) {
@@ -1717,6 +1713,29 @@ out_delete_evlist:
 out:
trace-live = false;
return err;
+out_error_tp:
+   switch(errno) {
+   case ENOENT:
+   fputs(Error:\tUnable to find debugfs\n
+ Hint:\tWas your kernel was compiled with debugfs 
support?\n
+ Hint:\tIs the debugfs filesystem mounted?\n
+ Hint:\tTry 'sudo mount -t debugfs nodev 
/sys/kernel/debug'\n,
+ trace-output);
+   break;
+   case EACCES:
+   fprintf(trace-output,
+   Error:\tNo permissions to read 
%s/tracing/events/raw_syscalls\n
+   Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n,
+   debugfs_mountpoint, debugfs_mountpoint);
+   break;
+   default: {
+   char bf[256];
+   fprintf(trace-output, Can't trace: %s\n,
+   strerror_r(errno, bf, sizeof(bf)));
+   }
+   break;
+   }
+   goto out_delete_evlist;
 }
 
 static int trace__replay(struct trace *trace)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf stat: Don't print bogus data on -e cycles

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  c458fe62ca31496664c1211a7906d261220b18f9
Gitweb: http://git.kernel.org/tip/c458fe62ca31496664c1211a7906d261220b18f9
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Mon, 30 Sep 2013 16:43:05 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Fri, 11 Oct 2013 12:17:33 -0300

perf stat: Don't print bogus data on -e cycles

When only the cycles event is requested:

$ perf stat -e cycles dd if=/dev/zero of=/dev/null count=100
100+0 records in
100+0 records out
51200 bytes (512 MB) copied, 0.26123 s, 2.0 GB/s

 Performance counter stats for 'dd if=/dev/zero of=/dev/null count=100':

   911,626,453 cycles#0.000 GHz

   0.262113350 seconds time elapsed

The 0.000 GHz comment in the output is totally bogus and misleading. It
happens because update_shadow_stats() doesn't touch runtime_nsecs_stats;
it is only written when a requested counter matches a SW_TASK_CLOCK. In
our case, since we have only requested HW_CPU_CYCLES,
runtime_nsecs_stats is unavailable. So, omit printing the comment
altogether.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Acked-by: Ingo Molnar mi...@kernel.org
Cc: Paul Mackerras pau...@samba.org
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Link: 
http://lkml.kernel.org/r/1380539585-23859-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/builtin-stat.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 700b478..ce2266c 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -997,10 +997,10 @@ static void abs_printout(int cpu, int nr, struct 
perf_evsel *evsel, double avg)
} else if (perf_evsel__match(evsel, HARDWARE, HW_CPU_CYCLES)) {
total = avg_stats(runtime_nsecs_stats[cpu]);
 
-   if (total)
-   ratio = 1.0 * avg / total;
-
-   fprintf(output,  # %8.3f GHz, ratio);
+   if (total) {
+   ratio = avg / total;
+   fprintf(output,  # %8.3f GHz, 
ratio);
+   }
} else if (transaction_run 
   perf_evsel__cmp(evsel, nth_evsel(T_CYCLES_IN_TX))) {
total = avg_stats(runtime_cycles_stats[cpu]);
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Strip dependency on _filedir

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  7b6c48e16e5d312b0ebae78acfb3ff4f9c8c083c
Gitweb: http://git.kernel.org/tip/7b6c48e16e5d312b0ebae78acfb3ff4f9c8c083c
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 4 Jul 2013 18:11:27 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 9 Oct 2013 11:11:55 -0300

perf completion: Strip dependency on _filedir

_filedir is defined in the bash-completion package, but there is no need
to depend on it.  Instead, call complete with multiple -o arguments
before the -F argument like in git.git's completion script.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Link: 
http://lkml.kernel.org/r/1372941691-14684-4-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/bash_completion | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index b0cdd12..d2598be 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -54,9 +54,8 @@ _perf()
subcmd=${COMP_WORDS[1]}
opts=$($cmd $subcmd --list-opts)
COMPREPLY=( $( compgen -W '$opts' -- $cur ) )
-   # Fall down to list regular files
-   else
-   _filedir
fi
 } 
-complete -F _perf perf
+
+complete -o bashdefault -o default -o nospace -F _perf perf 2/dev/null \
+   || complete -o default -o nospace -F _perf perf
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf completion: Update __ltrim_colon_completions

2013-10-14 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  30079d1d5ebcb8d706c6e05cacebb7facc60cd95
Gitweb: http://git.kernel.org/tip/30079d1d5ebcb8d706c6e05cacebb7facc60cd95
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 4 Jul 2013 18:11:26 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 9 Oct 2013 11:11:48 -0300

perf completion: Update __ltrim_colon_completions

The function is taken from the bash-completion package; update it to use
the latest version where colon_word doesn't miss quoting.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Link: 
http://lkml.kernel.org/r/1372941691-14684-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/bash_completion | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 50540cf..b0cdd12 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -11,7 +11,7 @@ __ltrim_colon_completions()
 {
if [[ $1 == *:*  $COMP_WORDBREAKS == *:* ]]; then
# Remove colon-word prefix from COMPREPLY items
-   local colon_word=${1%${1##*:}}
+   local colon_word=${1%${1##*:}}
local i=${#COMPREPLY[*]}
while [[ $((--i)) -ge 0 ]]; do
COMPREPLY[$i]=${COMPREPLY[$i]#$colon_word}
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:sched/core] sched: Remove bogus parameter in structured comment

2013-10-12 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  62e947cb0cd27c392aabe732c64f5023e272cf0e
Gitweb: http://git.kernel.org/tip/62e947cb0cd27c392aabe732c64f5023e272cf0e
Author: Ramkumar Ramachandra 
AuthorDate: Thu, 10 Oct 2013 15:50:33 +0530
Committer:  Ingo Molnar 
CommitDate: Sat, 12 Oct 2013 19:01:24 +0200

sched: Remove bogus parameter in structured comment

The balance parameter was removed by 23f0d20 ("sched: Factor out
code to should_we_balance()", 2013-08-06).

Signed-off-by: Ramkumar Ramachandra 
Cc: Joonsoo Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1381400433-2030-1-git-send-email-artag...@gmail.com
Signed-off-by: Ingo Molnar 
---
 kernel/sched/fair.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 803e343..8274679 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5586,7 +5586,6 @@ static inline enum fbq_type fbq_classify_rq(struct rq *rq)
 /**
  * update_sd_lb_stats - Update sched_domain's statistics for load balancing.
  * @env: The load balancing environment.
- * @balance: Should we balance.
  * @sds: variable to hold the statistics for this sched_domain.
  */
 static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats 
*sds)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:sched/core] sched: Remove bogus parameter in structured comment

2013-10-12 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  62e947cb0cd27c392aabe732c64f5023e272cf0e
Gitweb: http://git.kernel.org/tip/62e947cb0cd27c392aabe732c64f5023e272cf0e
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Thu, 10 Oct 2013 15:50:33 +0530
Committer:  Ingo Molnar mi...@kernel.org
CommitDate: Sat, 12 Oct 2013 19:01:24 +0200

sched: Remove bogus parameter in structured comment

The balance parameter was removed by 23f0d20 (sched: Factor out
code to should_we_balance(), 2013-08-06).

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Joonsoo Kim iamjoonsoo@lge.com
Cc: Peter Zijlstra pet...@infradead.org
Link: 
http://lkml.kernel.org/r/1381400433-2030-1-git-send-email-artag...@gmail.com
Signed-off-by: Ingo Molnar mi...@kernel.org
---
 kernel/sched/fair.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 803e343..8274679 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5586,7 +5586,6 @@ static inline enum fbq_type fbq_classify_rq(struct rq *rq)
 /**
  * update_sd_lb_stats - Update sched_domain's statistics for load balancing.
  * @env: The load balancing environment.
- * @balance: Should we balance.
  * @sds: variable to hold the statistics for this sched_domain.
  */
 static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats 
*sds)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:x86/asm] x86/ia32/asm: Remove unused argument in macro

2013-07-23 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  d2475b8ff81ebeed88d8fcbc22876aced5a0807a
Gitweb: http://git.kernel.org/tip/d2475b8ff81ebeed88d8fcbc22876aced5a0807a
Author: Ramkumar Ramachandra 
AuthorDate: Wed, 10 Jul 2013 23:34:28 +0530
Committer:  Ingo Molnar 
CommitDate: Tue, 23 Jul 2013 11:23:21 +0200

x86/ia32/asm: Remove unused argument in macro

Commit 3fe26fa ("x86: get rid of pt_regs argument in sigreturn variants",
from 2012-11-12) changed the body of PTREGSCALL to drop arg, and
updated the callsites; unfortunately, it forgot to update the
macro argument list, leaving an unused argument.  Fix this.

Signed-off-by: Ramkumar Ramachandra 
Cc: Al Viro 
Link: 
http://lkml.kernel.org/r/1373479468-7175-1-git-send-email-artag...@gmail.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/ia32/ia32entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 474dc1b..4299eb0 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -452,7 +452,7 @@ ia32_badsys:
 
CFI_ENDPROC

-   .macro PTREGSCALL label, func, arg
+   .macro PTREGSCALL label, func
ALIGN
 GLOBAL(\label)
leaq \func(%rip),%rax
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:x86/asm] x86/ia32/asm: Remove unused argument in macro

2013-07-23 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  d2475b8ff81ebeed88d8fcbc22876aced5a0807a
Gitweb: http://git.kernel.org/tip/d2475b8ff81ebeed88d8fcbc22876aced5a0807a
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Wed, 10 Jul 2013 23:34:28 +0530
Committer:  Ingo Molnar mi...@kernel.org
CommitDate: Tue, 23 Jul 2013 11:23:21 +0200

x86/ia32/asm: Remove unused argument in macro

Commit 3fe26fa (x86: get rid of pt_regs argument in sigreturn variants,
from 2012-11-12) changed the body of PTREGSCALL to drop arg, and
updated the callsites; unfortunately, it forgot to update the
macro argument list, leaving an unused argument.  Fix this.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Al Viro v...@zeniv.linux.org.uk
Link: 
http://lkml.kernel.org/r/1373479468-7175-1-git-send-email-artag...@gmail.com
Signed-off-by: Ingo Molnar mi...@kernel.org
---
 arch/x86/ia32/ia32entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 474dc1b..4299eb0 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -452,7 +452,7 @@ ia32_badsys:
 
CFI_ENDPROC

-   .macro PTREGSCALL label, func, arg
+   .macro PTREGSCALL label, func
ALIGN
 GLOBAL(\label)
leaq \func(%rip),%rax
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf script: Fix broken include in Context.xs

2013-07-12 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  750ade7e82709c2835cb221a7b6a9ef0a6a9c0ac
Gitweb: http://git.kernel.org/tip/750ade7e82709c2835cb221a7b6a9ef0a6a9c0ac
Author: Ramkumar Ramachandra 
AuthorDate: Tue, 9 Jul 2013 15:30:30 +0530
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 10 Jul 2013 13:47:00 -0300

perf script: Fix broken include in Context.xs

765532c8 (perf script: Finish the rename from trace to script,
2010-12-23) made a mistake during find-and-replace replacing
"../../../util/trace-event.h" with "../../../util/script-event.h", a
non-existent file.  Fix this include.

Signed-off-by: Ramkumar Ramachandra 
Cc: Namhyung Kim 
Link: 
http://lkml.kernel.org/r/1373364033-7918-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/scripts/perl/Perf-Trace-Util/Context.xs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs 
b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
index c1e2ed1..8c7ea42 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
@@ -23,7 +23,7 @@
 #include "perl.h"
 #include "XSUB.h"
 #include "../../../perf.h"
-#include "../../../util/script-event.h"
+#include "../../../util/trace-event.h"
 
 MODULE = Perf::Trace::Context  PACKAGE = Perf::Trace::Context
 PROTOTYPES: ENABLE
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf script: Fix broken include in Context.xs

2013-07-12 Thread tip-bot for Ramkumar Ramachandra
Commit-ID:  750ade7e82709c2835cb221a7b6a9ef0a6a9c0ac
Gitweb: http://git.kernel.org/tip/750ade7e82709c2835cb221a7b6a9ef0a6a9c0ac
Author: Ramkumar Ramachandra artag...@gmail.com
AuthorDate: Tue, 9 Jul 2013 15:30:30 +0530
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Wed, 10 Jul 2013 13:47:00 -0300

perf script: Fix broken include in Context.xs

765532c8 (perf script: Finish the rename from trace to script,
2010-12-23) made a mistake during find-and-replace replacing
../../../util/trace-event.h with ../../../util/script-event.h, a
non-existent file.  Fix this include.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
Cc: Namhyung Kim namhy...@kernel.org
Link: 
http://lkml.kernel.org/r/1373364033-7918-3-git-send-email-artag...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/scripts/perl/Perf-Trace-Util/Context.xs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs 
b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
index c1e2ed1..8c7ea42 100644
--- a/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Context.xs
@@ -23,7 +23,7 @@
 #include perl.h
 #include XSUB.h
 #include ../../../perf.h
-#include ../../../util/script-event.h
+#include ../../../util/trace-event.h
 
 MODULE = Perf::Trace::Context  PACKAGE = Perf::Trace::Context
 PROTOTYPES: ENABLE
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/