linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] perf script: Add missing closedir() calls
@ 2012-01-07 17:25 Namhyung Kim
  2012-01-07 17:25 ` [PATCH 2/8] perf test: Change type of '-v' option to INCR Namhyung Kim
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Namhyung Kim @ 2012-01-07 17:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Paul Mackerras, linux-kernel

The get_script_path() calls opendir() but misses corresponding
closedir()'s. Add them.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 tools/perf/builtin-script.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index fd1909afcfd6..bb68ddf257b7 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1018,13 +1018,17 @@ static char *get_script_path(const char *script_root, const char *suffix)
 			__script_root = get_script_root(&script_dirent, suffix);
 			if (__script_root && !strcmp(script_root, __script_root)) {
 				free(__script_root);
+				closedir(lang_dir);
+				closedir(scripts_dir);
 				snprintf(script_path, MAXPATHLEN, "%s/%s",
 					 lang_path, script_dirent.d_name);
 				return strdup(script_path);
 			}
 			free(__script_root);
 		}
+		closedir(lang_dir);
 	}
+	closedir(scripts_dir);
 
 	return NULL;
 }
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/8] perf test: Change type of '-v' option to INCR
  2012-01-07 17:25 [PATCH 1/8] perf script: Add missing closedir() calls Namhyung Kim
@ 2012-01-07 17:25 ` Namhyung Kim
  2012-01-09  7:23   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2012-01-07 17:25 ` [PATCH 3/8] perf top: Add error message for EMFILE Namhyung Kim
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Namhyung Kim @ 2012-01-07 17:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Paul Mackerras, linux-kernel

The '-v' option is usually defined via OPT_INCR not _INTEGER.
Follow the trend :).

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 tools/perf/builtin-test.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 2b9a7f497a20..3854e869dce1 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -1396,7 +1396,7 @@ int cmd_test(int argc, const char **argv, const char *prefix __used)
 	NULL,
 	};
 	const struct option test_options[] = {
-	OPT_INTEGER('v', "verbose", &verbose,
+	OPT_INCR('v', "verbose", &verbose,
 		    "be more verbose (show symbol address, etc)"),
 	OPT_END()
 	};
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/8] perf top: Add error message for EMFILE
  2012-01-07 17:25 [PATCH 1/8] perf script: Add missing closedir() calls Namhyung Kim
  2012-01-07 17:25 ` [PATCH 2/8] perf test: Change type of '-v' option to INCR Namhyung Kim
@ 2012-01-07 17:25 ` Namhyung Kim
  2012-01-09  7:24   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2012-01-07 17:25 ` [PATCH 4/8] perf kmem: Add missing closedir() calls Namhyung Kim
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Namhyung Kim @ 2012-01-07 17:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Paul Mackerras, linux-kernel

When a user tries to open so many events, perf_event_open syscall
may fail with EMFILE. Provide advise for that case.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 tools/perf/builtin-top.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 4f81eeb99875..ad18dd37e87d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -889,6 +889,10 @@ try_again:
 				ui__warning("The %s event is not supported.\n",
 					    event_name(counter));
 				goto out_err;
+			} else if (err == EMFILE) {
+				ui__warning("Too many events are opened.\n"
+					    "Try again after reducing the number of events\n");
+				goto out_err;
 			}
 
 			ui__warning("The sys_perf_event_open() syscall "
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/8] perf kmem: Add missing closedir() calls
  2012-01-07 17:25 [PATCH 1/8] perf script: Add missing closedir() calls Namhyung Kim
  2012-01-07 17:25 ` [PATCH 2/8] perf test: Change type of '-v' option to INCR Namhyung Kim
  2012-01-07 17:25 ` [PATCH 3/8] perf top: Add error message for EMFILE Namhyung Kim
@ 2012-01-07 17:25 ` Namhyung Kim
  2012-01-09  7:25   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2012-01-07 17:25 ` [PATCH 5/8] perf kmem: Fix a memory leak Namhyung Kim
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Namhyung Kim @ 2012-01-07 17:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Paul Mackerras, linux-kernel

The setup_cpunode_map() calls opendir() but misses corresponding
closedir(). Add them.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 tools/perf/builtin-kmem.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index fe1ad8f21961..7a9b5c55ad5a 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -108,7 +108,9 @@ static void setup_cpunode_map(void)
 				continue;
 			cpunode_map[cpu] = mem;
 		}
+		closedir(dir2);
 	}
+	closedir(dir1);
 }
 
 static void insert_alloc_stat(unsigned long call_site, unsigned long ptr,
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 5/8] perf kmem: Fix a memory leak
  2012-01-07 17:25 [PATCH 1/8] perf script: Add missing closedir() calls Namhyung Kim
                   ` (2 preceding siblings ...)
  2012-01-07 17:25 ` [PATCH 4/8] perf kmem: Add missing closedir() calls Namhyung Kim
@ 2012-01-07 17:25 ` Namhyung Kim
  2012-01-09  7:26   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2012-01-07 17:25 ` [PATCH 6/8] perf annotate: Fix usage string Namhyung Kim
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Namhyung Kim @ 2012-01-07 17:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Paul Mackerras, linux-kernel

The 'str' should be freed when sort_dimension__add()
failed too.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 tools/perf/builtin-kmem.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 7a9b5c55ad5a..39104c0beea3 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -647,6 +647,7 @@ static int setup_sorting(struct list_head *sort_list, const char *arg)
 			break;
 		if (sort_dimension__add(tok, sort_list) < 0) {
 			error("Unknown --sort key: '%s'", tok);
+			free(str);
 			return -1;
 		}
 	}
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 6/8] perf annotate: Fix usage string
  2012-01-07 17:25 [PATCH 1/8] perf script: Add missing closedir() calls Namhyung Kim
                   ` (3 preceding siblings ...)
  2012-01-07 17:25 ` [PATCH 5/8] perf kmem: Fix a memory leak Namhyung Kim
@ 2012-01-07 17:25 ` Namhyung Kim
  2012-01-09  7:26   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2012-01-07 17:25 ` [PATCH 7/8] perf annotate: Get rid of field_sep check Namhyung Kim
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Namhyung Kim @ 2012-01-07 17:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Paul Mackerras, linux-kernel

The annotate command doesn't take non-option arguments.
In fact, it can take last argument as a symbol filter
though, but that's a special case and, IMHO, it should
be discouraged in favor of the -s option.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 tools/perf/builtin-annotate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 214ba7f9f577..3ec2496f1e35 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -235,7 +235,7 @@ out_delete:
 }
 
 static const char * const annotate_usage[] = {
-	"perf annotate [<options>] <command>",
+	"perf annotate [<options>]",
 	NULL
 };
 
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 7/8] perf annotate: Get rid of field_sep check
  2012-01-07 17:25 [PATCH 1/8] perf script: Add missing closedir() calls Namhyung Kim
                   ` (4 preceding siblings ...)
  2012-01-07 17:25 ` [PATCH 6/8] perf annotate: Fix usage string Namhyung Kim
@ 2012-01-07 17:25 ` Namhyung Kim
  2012-01-09  7:27   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2012-01-07 17:25 ` [PATCH 8/8] perf report: Fix --stdio output alignment when --showcpuutilization used Namhyung Kim
  2012-01-09  7:23 ` [tip:perf/core] perf script: Add missing closedir() calls tip-bot for Namhyung Kim
  7 siblings, 1 reply; 16+ messages in thread
From: Namhyung Kim @ 2012-01-07 17:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Paul Mackerras, linux-kernel

The 'field_sep' variable is not set anywhere. Just remove
the conditional.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 tools/perf/builtin-annotate.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 3ec2496f1e35..806e0a286634 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -313,10 +313,5 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __used)
 		annotate.sym_hist_filter = argv[0];
 	}
 
-	if (field_sep && *field_sep == '.') {
-		pr_err("'.' is the only non valid --field-separator argument\n");
-		return -1;
-	}
-
 	return __cmd_annotate(&annotate);
 }
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 8/8] perf report: Fix --stdio output alignment when --showcpuutilization used
  2012-01-07 17:25 [PATCH 1/8] perf script: Add missing closedir() calls Namhyung Kim
                   ` (5 preceding siblings ...)
  2012-01-07 17:25 ` [PATCH 7/8] perf annotate: Get rid of field_sep check Namhyung Kim
@ 2012-01-07 17:25 ` Namhyung Kim
  2012-01-09  7:28   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2012-01-09  7:23 ` [tip:perf/core] perf script: Add missing closedir() calls tip-bot for Namhyung Kim
  7 siblings, 1 reply; 16+ messages in thread
From: Namhyung Kim @ 2012-01-07 17:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Paul Mackerras, linux-kernel

Current perf report output is broken if --showcpuutilization is used.
Combination with -n and/or --show-total-period make things worse.
This patch fixes it as follows:

before:
# Events: 13  cycles
#
# Overhead  sys    us    Command      Shared Object                 Symbol
# ........  .......  .................  .....................
#
    48.25%    48.25%     0.00%    sleep  [kernel.kallsyms]  [k] trace_hardirqs_off
    34.99%    34.99%     0.00%    sleep  [kernel.kallsyms]  [k] __find_get_block_slow
    15.99%    15.99%     0.00%    sleep  [kernel.kallsyms]  [k] lock_release_holdtime
     0.77%     0.77%     0.00%    sleep  [kernel.kallsyms]  [k] native_write_msr_safe

after:
# Events: 13  cycles
#
# Overhead     sys        us    Command      Shared Object                 Symbol
# ........   .......   .......  .......  .................  .....................
#
    48.25%    48.25%     0.00%    sleep  [kernel.kallsyms]  [k] trace_hardirqs_off
    34.99%    34.99%     0.00%    sleep  [kernel.kallsyms]  [k] __find_get_block_slow
    15.99%    15.99%     0.00%    sleep  [kernel.kallsyms]  [k] lock_release_holdtime
     0.77%     0.77%     0.00%    sleep  [kernel.kallsyms]  [k] native_write_msr_safe

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 tools/perf/util/hist.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index abef2703cd24..7561d5c90d98 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -917,20 +917,6 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
 
 	fprintf(fp, "# %s", pair ? "Baseline" : "Overhead");
 
-	if (symbol_conf.show_nr_samples) {
-		if (sep)
-			fprintf(fp, "%cSamples", *sep);
-		else
-			fputs("  Samples  ", fp);
-	}
-
-	if (symbol_conf.show_total_period) {
-		if (sep)
-			ret += fprintf(fp, "%cPeriod", *sep);
-		else
-			ret += fprintf(fp, "   Period    ");
-	}
-
 	if (symbol_conf.show_cpu_utilization) {
 		if (sep) {
 			ret += fprintf(fp, "%csys", *sep);
@@ -940,8 +926,8 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
 				ret += fprintf(fp, "%cguest us", *sep);
 			}
 		} else {
-			ret += fprintf(fp, "  sys  ");
-			ret += fprintf(fp, "  us  ");
+			ret += fprintf(fp, "     sys  ");
+			ret += fprintf(fp, "      us  ");
 			if (perf_guest) {
 				ret += fprintf(fp, "  guest sys  ");
 				ret += fprintf(fp, "  guest us  ");
@@ -949,6 +935,20 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
 		}
 	}
 
+	if (symbol_conf.show_nr_samples) {
+		if (sep)
+			fprintf(fp, "%cSamples", *sep);
+		else
+			fputs("  Samples  ", fp);
+	}
+
+	if (symbol_conf.show_total_period) {
+		if (sep)
+			ret += fprintf(fp, "%cPeriod", *sep);
+		else
+			ret += fprintf(fp, "   Period    ");
+	}
+
 	if (pair) {
 		if (sep)
 			ret += fprintf(fp, "%cDelta", *sep);
@@ -993,6 +993,8 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
 		goto print_entries;
 
 	fprintf(fp, "# ........");
+	if (symbol_conf.show_cpu_utilization)
+		fprintf(fp, "   .......   .......");
 	if (symbol_conf.show_nr_samples)
 		fprintf(fp, " ..........");
 	if (symbol_conf.show_total_period)
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:perf/core] perf script: Add missing closedir() calls
  2012-01-07 17:25 [PATCH 1/8] perf script: Add missing closedir() calls Namhyung Kim
                   ` (6 preceding siblings ...)
  2012-01-07 17:25 ` [PATCH 8/8] perf report: Fix --stdio output alignment when --showcpuutilization used Namhyung Kim
@ 2012-01-09  7:23 ` tip-bot for Namhyung Kim
  7 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-01-09  7:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung,
	tglx, mingo

Commit-ID:  946ef2a24523e59e5cf931068ab7e9443c63c9df
Gitweb:     http://git.kernel.org/tip/946ef2a24523e59e5cf931068ab7e9443c63c9df
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Sun, 8 Jan 2012 02:25:25 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sun, 8 Jan 2012 12:35:41 -0200

perf script: Add missing closedir() calls

The get_script_path() calls opendir() but misses corresponding
closedir()'s. Add them.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1325957132-10600-1-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index fd1909a..bb68ddf 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1018,13 +1018,17 @@ static char *get_script_path(const char *script_root, const char *suffix)
 			__script_root = get_script_root(&script_dirent, suffix);
 			if (__script_root && !strcmp(script_root, __script_root)) {
 				free(__script_root);
+				closedir(lang_dir);
+				closedir(scripts_dir);
 				snprintf(script_path, MAXPATHLEN, "%s/%s",
 					 lang_path, script_dirent.d_name);
 				return strdup(script_path);
 			}
 			free(__script_root);
 		}
+		closedir(lang_dir);
 	}
+	closedir(scripts_dir);
 
 	return NULL;
 }

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:perf/core] perf test: Change type of '-v' option to INCR
  2012-01-07 17:25 ` [PATCH 2/8] perf test: Change type of '-v' option to INCR Namhyung Kim
@ 2012-01-09  7:23   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-01-09  7:23 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung,
	tglx, mingo

Commit-ID:  c30ab8aa084843159b4679e9a3d7f63187d5906a
Gitweb:     http://git.kernel.org/tip/c30ab8aa084843159b4679e9a3d7f63187d5906a
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Sun, 8 Jan 2012 02:25:26 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sun, 8 Jan 2012 13:25:00 -0200

perf test: Change type of '-v' option to INCR

The '-v' option is usually defined via OPT_INCR not _INTEGER.  Follow
the trend :).

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1325957132-10600-2-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 2b9a7f4..3854e86 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -1396,7 +1396,7 @@ int cmd_test(int argc, const char **argv, const char *prefix __used)
 	NULL,
 	};
 	const struct option test_options[] = {
-	OPT_INTEGER('v', "verbose", &verbose,
+	OPT_INCR('v', "verbose", &verbose,
 		    "be more verbose (show symbol address, etc)"),
 	OPT_END()
 	};

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:perf/core] perf top: Add error message for EMFILE
  2012-01-07 17:25 ` [PATCH 3/8] perf top: Add error message for EMFILE Namhyung Kim
@ 2012-01-09  7:24   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-01-09  7:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung,
	tglx, mingo

Commit-ID:  cdce445906852d90efdc773ca7ba460e6e41664d
Gitweb:     http://git.kernel.org/tip/cdce445906852d90efdc773ca7ba460e6e41664d
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Sun, 8 Jan 2012 02:25:27 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sun, 8 Jan 2012 13:26:11 -0200

perf top: Add error message for EMFILE

When a user tries to open so many events, perf_event_open syscall may
fail with EMFILE. Provide advise for that case.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1325957132-10600-3-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index d89dec9..8f80df8 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -888,6 +888,10 @@ try_again:
 				ui__warning("The %s event is not supported.\n",
 					    event_name(counter));
 				goto out_err;
+			} else if (err == EMFILE) {
+				ui__warning("Too many events are opened.\n"
+					    "Try again after reducing the number of events\n");
+				goto out_err;
 			}
 
 			ui__warning("The sys_perf_event_open() syscall "

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:perf/core] perf kmem: Add missing closedir() calls
  2012-01-07 17:25 ` [PATCH 4/8] perf kmem: Add missing closedir() calls Namhyung Kim
@ 2012-01-09  7:25   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-01-09  7:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung,
	tglx, mingo

Commit-ID:  8442da1d9f445b454accdb148355ee990ebf3b32
Gitweb:     http://git.kernel.org/tip/8442da1d9f445b454accdb148355ee990ebf3b32
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Sun, 8 Jan 2012 02:25:28 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sun, 8 Jan 2012 13:27:06 -0200

perf kmem: Add missing closedir() calls

The setup_cpunode_map() calls opendir() but misses corresponding
closedir(). Add them.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1325957132-10600-4-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-kmem.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index fe1ad8f..7a9b5c5 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -108,7 +108,9 @@ static void setup_cpunode_map(void)
 				continue;
 			cpunode_map[cpu] = mem;
 		}
+		closedir(dir2);
 	}
+	closedir(dir1);
 }
 
 static void insert_alloc_stat(unsigned long call_site, unsigned long ptr,

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:perf/core] perf kmem: Fix a memory leak
  2012-01-07 17:25 ` [PATCH 5/8] perf kmem: Fix a memory leak Namhyung Kim
@ 2012-01-09  7:26   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-01-09  7:26 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung,
	tglx, mingo

Commit-ID:  1b22859d4320d472a7a51ff4a43f62b0578469de
Gitweb:     http://git.kernel.org/tip/1b22859d4320d472a7a51ff4a43f62b0578469de
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Sun, 8 Jan 2012 02:25:29 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sun, 8 Jan 2012 13:27:54 -0200

perf kmem: Fix a memory leak

The 'str' should be freed when sort_dimension__add() failed too.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1325957132-10600-5-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-kmem.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 7a9b5c5..39104c0 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -647,6 +647,7 @@ static int setup_sorting(struct list_head *sort_list, const char *arg)
 			break;
 		if (sort_dimension__add(tok, sort_list) < 0) {
 			error("Unknown --sort key: '%s'", tok);
+			free(str);
 			return -1;
 		}
 	}

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:perf/core] perf annotate: Fix usage string
  2012-01-07 17:25 ` [PATCH 6/8] perf annotate: Fix usage string Namhyung Kim
@ 2012-01-09  7:26   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-01-09  7:26 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung,
	tglx, mingo

Commit-ID:  993452541796f3637da9f2e537b9333494b3b2a1
Gitweb:     http://git.kernel.org/tip/993452541796f3637da9f2e537b9333494b3b2a1
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Sun, 8 Jan 2012 02:25:30 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sun, 8 Jan 2012 13:28:48 -0200

perf annotate: Fix usage string

The annotate command doesn't take non-option arguments.

In fact, it can take last argument as a symbol filter though, but that's
a special case and, IMHO, it should be discouraged in favor of the -s
option.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1325957132-10600-6-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-annotate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 214ba7f..3ec2496 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -235,7 +235,7 @@ out_delete:
 }
 
 static const char * const annotate_usage[] = {
-	"perf annotate [<options>] <command>",
+	"perf annotate [<options>]",
 	NULL
 };
 

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:perf/core] perf annotate: Get rid of field_sep check
  2012-01-07 17:25 ` [PATCH 7/8] perf annotate: Get rid of field_sep check Namhyung Kim
@ 2012-01-09  7:27   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-01-09  7:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung,
	tglx, mingo

Commit-ID:  6714a04114639350a7fed93edf8e1b995c5e8059
Gitweb:     http://git.kernel.org/tip/6714a04114639350a7fed93edf8e1b995c5e8059
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Sun, 8 Jan 2012 02:25:31 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sun, 8 Jan 2012 13:29:34 -0200

perf annotate: Get rid of field_sep check

The 'field_sep' variable is not set anywhere. Just remove the
conditional.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1325957132-10600-7-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-annotate.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 3ec2496..806e0a2 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -313,10 +313,5 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __used)
 		annotate.sym_hist_filter = argv[0];
 	}
 
-	if (field_sep && *field_sep == '.') {
-		pr_err("'.' is the only non valid --field-separator argument\n");
-		return -1;
-	}
-
 	return __cmd_annotate(&annotate);
 }

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [tip:perf/core] perf report: Fix --stdio output alignment when --showcpuutilization used
  2012-01-07 17:25 ` [PATCH 8/8] perf report: Fix --stdio output alignment when --showcpuutilization used Namhyung Kim
@ 2012-01-09  7:28   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-01-09  7:28 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, namhyung,
	tglx, mingo

Commit-ID:  0ed35abc2b569e94498705d250c4767c5284f643
Gitweb:     http://git.kernel.org/tip/0ed35abc2b569e94498705d250c4767c5284f643
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Sun, 8 Jan 2012 02:25:32 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sun, 8 Jan 2012 13:32:51 -0200

perf report: Fix --stdio output alignment when --showcpuutilization used

Current perf report output is broken if --showcpuutilization is used.
Combination with -n and/or --show-total-period make things worse.
This patch fixes it as follows:

before:
    48.25%    48.25%     0.00%    sleep  [kernel.kallsyms]  [k] trace_hardirqs_off
    34.99%    34.99%     0.00%    sleep  [kernel.kallsyms]  [k] __find_get_block_slow
    15.99%    15.99%     0.00%    sleep  [kernel.kallsyms]  [k] lock_release_holdtime
     0.77%     0.77%     0.00%    sleep  [kernel.kallsyms]  [k] native_write_msr_safe

after:
    48.25%    48.25%     0.00%    sleep  [kernel.kallsyms]  [k] trace_hardirqs_off
    34.99%    34.99%     0.00%    sleep  [kernel.kallsyms]  [k] __find_get_block_slow
    15.99%    15.99%     0.00%    sleep  [kernel.kallsyms]  [k] lock_release_holdtime
     0.77%     0.77%     0.00%    sleep  [kernel.kallsyms]  [k] native_write_msr_safe

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1325957132-10600-8-git-send-email-namhyung@gmail.com
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 4df4495..6f505d1 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -919,20 +919,6 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
 
 	fprintf(fp, "# %s", pair ? "Baseline" : "Overhead");
 
-	if (symbol_conf.show_nr_samples) {
-		if (sep)
-			fprintf(fp, "%cSamples", *sep);
-		else
-			fputs("  Samples  ", fp);
-	}
-
-	if (symbol_conf.show_total_period) {
-		if (sep)
-			ret += fprintf(fp, "%cPeriod", *sep);
-		else
-			ret += fprintf(fp, "   Period    ");
-	}
-
 	if (symbol_conf.show_cpu_utilization) {
 		if (sep) {
 			ret += fprintf(fp, "%csys", *sep);
@@ -942,8 +928,8 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
 				ret += fprintf(fp, "%cguest us", *sep);
 			}
 		} else {
-			ret += fprintf(fp, "  sys  ");
-			ret += fprintf(fp, "  us  ");
+			ret += fprintf(fp, "     sys  ");
+			ret += fprintf(fp, "      us  ");
 			if (perf_guest) {
 				ret += fprintf(fp, "  guest sys  ");
 				ret += fprintf(fp, "  guest us  ");
@@ -951,6 +937,20 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
 		}
 	}
 
+	if (symbol_conf.show_nr_samples) {
+		if (sep)
+			fprintf(fp, "%cSamples", *sep);
+		else
+			fputs("  Samples  ", fp);
+	}
+
+	if (symbol_conf.show_total_period) {
+		if (sep)
+			ret += fprintf(fp, "%cPeriod", *sep);
+		else
+			ret += fprintf(fp, "   Period    ");
+	}
+
 	if (pair) {
 		if (sep)
 			ret += fprintf(fp, "%cDelta", *sep);
@@ -995,6 +995,8 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
 		goto print_entries;
 
 	fprintf(fp, "# ........");
+	if (symbol_conf.show_cpu_utilization)
+		fprintf(fp, "   .......   .......");
 	if (symbol_conf.show_nr_samples)
 		fprintf(fp, " ..........");
 	if (symbol_conf.show_total_period)

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-01-09  7:28 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-07 17:25 [PATCH 1/8] perf script: Add missing closedir() calls Namhyung Kim
2012-01-07 17:25 ` [PATCH 2/8] perf test: Change type of '-v' option to INCR Namhyung Kim
2012-01-09  7:23   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-01-07 17:25 ` [PATCH 3/8] perf top: Add error message for EMFILE Namhyung Kim
2012-01-09  7:24   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-01-07 17:25 ` [PATCH 4/8] perf kmem: Add missing closedir() calls Namhyung Kim
2012-01-09  7:25   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-01-07 17:25 ` [PATCH 5/8] perf kmem: Fix a memory leak Namhyung Kim
2012-01-09  7:26   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-01-07 17:25 ` [PATCH 6/8] perf annotate: Fix usage string Namhyung Kim
2012-01-09  7:26   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-01-07 17:25 ` [PATCH 7/8] perf annotate: Get rid of field_sep check Namhyung Kim
2012-01-09  7:27   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-01-07 17:25 ` [PATCH 8/8] perf report: Fix --stdio output alignment when --showcpuutilization used Namhyung Kim
2012-01-09  7:28   ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-01-09  7:23 ` [tip:perf/core] perf script: Add missing closedir() calls tip-bot for Namhyung Kim

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