Skip to contentSkip to conversation

perf tools fixes

GIT PULL New Arnaldo Carvalho de Melo 2 participants 6 messages May 13, 2010 – May 14, 2010 perf events

lore
Share & tools
lore
#0 lore raw

Hi Ingo,

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf

Regards,

- Arnaldo

Frederic Weisbecker (2):
perf hist: Fix hists__browse no-newt case
perf hist: Fix missing getline declaration

Kirill Smelkov (1):
perf trace scripts: Fix typos in perf-trace-python.txt

Stephane Eranian (1):
perf tools: change event inheritance logic in stat and record

 tools/perf/Documentation/perf-record.txt       |    4 ++--
 tools/perf/Documentation/perf-stat.txt         |    4 ++--
 tools/perf/Documentation/perf-trace-python.txt |    4 ++--
 tools/perf/builtin-record.c                    |   12 ++++++------
 tools/perf/builtin-stat.c                      |   10 +++++-----
 tools/perf/util/hist.c                         |    1 +
 tools/perf/util/hist.h                         |    2 +-
 7 files changed, 19 insertions(+), 18 deletions(-)
#1 lore raw

PATCH 1/4 perf hist: Fix hists__browse no-newt case

From: Frederic Weisbecker <[email protected]>

Fix mistake in a parameter type of the no-newt hists__browse() version.

Fixes:
builtin-report.c: In function ‘__cmd_report’:
builtin-report.c:314: erreur: incompatible type for argument 1 of ‘hists__browse’

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Paul Mackerras <[email protected]>

LKML-Reference: <[email protected]>

---
 tools/perf/util/hist.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/util/hist.h +1 -1
index ed9c067..0b4c8df 100644
@@ -78,7 +78,7 @@ void hists__filter_by_dso(struct hists *self, const struct dso *dso);
 void hists__filter_by_thread(struct hists *self, const struct thread *thread);
 
 #ifdef NO_NEWT_SUPPORT
-static inline int hists__browse(struct hists self __used,
+static inline int hists__browse(struct hists *self __used,
 				const char *helpline __used,
 				const char *input_name __used)
 {
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 2/4 perf hist: Fix missing getline declaration

In reply to Arnaldo Carvalho de Melo

From: Frederic Weisbecker <[email protected]>

hist.c needs to include util.h so that it gets stdio.h inclusion with __GNU_SOURCE defined.

Fixes:
util/hist.c: In function ‘hist_entry__parse_objdump_line’:
util/hist.c:931: erreur: implicit declaration of function ‘getline’ util/hist.c:931: erreur: nested extern declaration of ‘getline’

Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Paul Mackerras <[email protected]>

LKML-Reference: <[email protected]>

---
 tools/perf/util/hist.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tools/perf/util/hist.c +1 -0
index 451d2e4..5dc4f84 100644
@@ -1,3 +1,4 @@
+#include "util.h"
 #include "hist.h"
 #include "session.h"
 #include "sort.h"
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH 3/4 perf tools: change event inheritance logic in stat and record

In reply to Arnaldo Carvalho de Melo

From: Stephane Eranian <[email protected]>

By default, event inheritance across fork and pthread_create was on but the -i option of stat and record, which enabled inheritance, led to believe it was off by default.

This patch fixes this logic by inverting the meaning of the -i option. By default inheritance is on whether you attach to a process (-p), a thread (-t) or start a process. If you pass -i, then you turn off inheritance. Turning off inheritance if you don't need it, helps limit perf resource usage as well.

The patch also fixes perf stat -t xxxx and perf record -t xxxx which did not start the counters.

Cc David S. Miller <[email protected]>
Cc Frédéric Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>

LKML-Reference: <[email protected]>

---
 tools/perf/Documentation/perf-record.txt |    4 ++--
 tools/perf/Documentation/perf-stat.txt   |    4 ++--
 tools/perf/builtin-record.c              |   12 ++++++------
 tools/perf/builtin-stat.c                |   10 +++++-----
 4 files changed, 15 insertions(+), 15 deletions(-)
tools/perf/Documentation/perf-record.txt +2 -2
index 020d871..34e255f 100644
@@ -69,8 +69,8 @@ OPTIONS
 	Output file name.
 
 -i::
---inherit::
-	Child tasks inherit counters.
+--no-inherit::
+	Child tasks do not inherit counters.
 -F::
 --freq=::
 	Profile at this frequency.
tools/perf/Documentation/perf-stat.txt +2 -2
index 484080d..2cab8e8 100644
@@ -31,8 +31,8 @@ OPTIONS
 	 hexadecimal event descriptor.
 
 -i::
---inherit::
-        child tasks inherit counters
+--no-inherit::
+        child tasks do not inherit counters
 -p::
 --pid=<pid>::
         stat events on existing pid
tools/perf/builtin-record.c +6 -6
index 6b77b28..0f467cf 100644
@@ -54,7 +54,7 @@ static pid_t			target_tid			=     -1;
 static pid_t			*all_tids			=      NULL;
 static int			thread_num			=      0;
 static pid_t			child_pid			=     -1;
-static bool			inherit				=   true;
+static bool			no_inherit			=  false;
 static enum write_mode_t	write_mode			= WRITE_FORCE;
 static bool			call_graph			=  false;
 static bool			inherit_stat			=  false;
@@ -298,8 +298,8 @@ static void create_counter(int counter, int cpu)
 
 	attr->mmap		= track;
 	attr->comm		= track;
-	attr->inherit		= inherit;
-	if (target_pid == -1 && !system_wide) {
+	attr->inherit		= !no_inherit;
+	if (target_pid == -1 && target_tid == -1 && !system_wide) {
 		attr->disabled = 1;
 		attr->enable_on_exec = 1;
 	}
@@ -641,7 +641,7 @@ static int __cmd_record(int argc, const char **argv)
 		close(child_ready_pipe[0]);
 	}
 
-	if ((!system_wide && !inherit) || profile_cpu != -1) {
+	if ((!system_wide && no_inherit) || profile_cpu != -1) {
 		open_counters(profile_cpu);
 	} else {
 		nr_cpus = read_cpu_map();
@@ -821,8 +821,8 @@ static const struct option options[] = {
 		    "event period to sample"),
 	OPT_STRING('o', "output", &output_name, "file",
 		    "output file name"),
-	OPT_BOOLEAN('i', "inherit", &inherit,
-		    "child tasks inherit counters"),
+	OPT_BOOLEAN('i', "no-inherit", &no_inherit,
+		    "child tasks do not inherit counters"),
 	OPT_INTEGER('F', "freq", &user_freq,
 		    "profile at this frequency"),
 	OPT_INTEGER('m', "mmap-pages", &mmap_pages,
tools/perf/builtin-stat.c +5 -5
index e619ac8..ff8c413 100644
@@ -72,7 +72,7 @@ static unsigned int		nr_cpus				=  0;
 static int			run_idx				=  0;
 
 static int			run_count			=  1;
-static bool			inherit				=  true;
+static bool			no_inherit			= false;
 static bool			scale				=  true;
 static pid_t			target_pid			= -1;
 static pid_t			target_tid			= -1;
@@ -167,8 +167,8 @@ static int create_perf_stat_counter(int counter)
 				++ncreated;
 		}
 	} else {
-		attr->inherit	     = inherit;
-		if (target_pid == -1) {
+		attr->inherit = !no_inherit;
+		if (target_pid == -1 && target_tid == -1) {
 			attr->disabled = 1;
 			attr->enable_on_exec = 1;
 		}
@@ -518,8 +518,8 @@ static const struct option options[] = {
 	OPT_CALLBACK('e', "event", NULL, "event",
 		     "event selector. use 'perf list' to list available events",
 		     parse_events),
-	OPT_BOOLEAN('i', "inherit", &inherit,
-		    "child tasks inherit counters"),
+	OPT_BOOLEAN('i', "no-inherit", &no_inherit,
+		    "child tasks do not inherit counters"),
 	OPT_INTEGER('p', "pid", &target_pid,
 		    "stat events on existing process id"),
 	OPT_INTEGER('t', "tid", &target_tid,
Signature · 1 line
1.6.2.5
#4 lore raw

PATCH 4/4 perf trace scripts: Fix typos in perf-trace-python.txt

In reply to Arnaldo Carvalho de Melo

From: Kirill Smelkov <[email protected]>

option option -> option
special special -> special

LKML-Reference: <[email protected]>

---
 tools/perf/Documentation/perf-trace-python.txt |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/Documentation/perf-trace-python.txt +2 -2
index 864aac2..693be80 100644
@@ -182,7 +182,7 @@ mean either that the record step recorded event types that it wasn't
 really interested in, or the script was run against a trace file that
 doesn't correspond to the script.
 
-The script generated by -g option option simply prints a line for each
+The script generated by -g option simply prints a line for each
 event found in the trace stream i.e. it basically just dumps the event
 and its parameter values to stdout.  The print_header() function is
 simply a utility function used for that purpose.  Let's rename the
@@ -582,7 +582,7 @@ files:
   flag_str(event_name, field_name, field_value) - returns the string represention corresponding to field_value for the flag field field_name of event event_name
   symbol_str(event_name, field_name, field_value) - returns the string represention corresponding to field_value for the symbolic field field_name of event event_name
 
-The *autodict* function returns a special special kind of Python
+The *autodict* function returns a special kind of Python
 dictionary that implements Perl's 'autovivifying' hashes in Python
 i.e. with autovivifying hashes, you can assign nested hash values
 without having to go to the trouble of creating intermediate levels if
Signature · 1 line
1.6.2.5
#5 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 21 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf

Regards,

- Arnaldo

Frederic Weisbecker (2):
perf hist: Fix hists__browse no-newt case
perf hist: Fix missing getline declaration

Kirill Smelkov (1):
perf trace scripts: Fix typos in perf-trace-python.txt

Stephane Eranian (1):
perf tools: change event inheritance logic in stat and record

Quoted 8 lines
 tools/perf/Documentation/perf-record.txt       |    4 ++--
 tools/perf/Documentation/perf-stat.txt         |    4 ++--
 tools/perf/Documentation/perf-trace-python.txt |    4 ++--
 tools/perf/builtin-record.c                    |   12 ++++++------
 tools/perf/builtin-stat.c                      |   10 +++++-----
 tools/perf/util/hist.c                         |    1 +
 tools/perf/util/hist.h                         |    2 +-
 7 files changed, 19 insertions(+), 18 deletions(-)

Pulled, thanks Arnaldo!

Ingo