Skip to contentSkip to conversation

perf tools: Misc fixies

PATCH In review Jiri Olsa 3 participants 11 messages Sep 12, 2013 – Oct 15, 2013 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

cover perf tools: Misc fixies

hi,
sending misc standalone fixies from plugins support patchset, plus one extra kmem command fix.

available at:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/core_file

thanks,
jirka

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>

---
Jiri Olsa (4):
perf tools: Fix 'make install prefix=...' build rule perf tools: Remove unused trace-event-* code perf tools: Unify page_size usage
perf tools: Make kmem work for non numa machines

 tools/perf/Makefile                 |  1 +
 tools/perf/builtin-kmem.c           |  2 +-
 tools/perf/builtin-record.c         |  5 +----
 tools/perf/perf.c                   |  1 +
 tools/perf/util/python.c            |  1 +
 tools/perf/util/trace-event-parse.c | 36 ------------------------------------
 tools/perf/util/trace-event.h       |  9 ---------
 7 files changed, 5 insertions(+), 50 deletions(-)
author
#1 lore raw

PATCH 1/4 perf tools: Fix 'make install prefix=...' build rule

Currently we fail for following make command:

  $ sudo make install prefix=/opt/perf
  ...
      GEN python/perf.so
  install -d -m 755 '/opt/perf/bin'
  install perf '/opt/perf/bin'
  install perf-archive -t '/opt/perf/libexec/perf-core'
  install: accessing `/opt/perf/libexec/perf-core': No such file or directory
  make: *** [install-bin] Error 1

Fixing this by properly creating '/opt/perf/libexec/perf-core' directory.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/perf/Makefile +1 -0
index c5dc1ad..229964a 100644
@@ -769,6 +769,7 @@ check: $(OUTPUT)common-cmds.h
 install-bin: all
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
 	$(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'
+	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
 	$(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
 ifndef NO_LIBPERL
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
Signature · 1 line
1.7.11.7
author
#2 lore raw

PATCH 2/4 perf tools: Remove unused trace-event-* code

In reply to Jiri Olsa

Removing unused trace-event-* code.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/util/trace-event-parse.c | 36 ------------------------------------
 tools/perf/util/trace-event.h       |  9 ---------
 2 files changed, 45 deletions(-)
tools/perf/util/trace-event-parse.c +0 -36
index fe7a27d..da28065 100644
@@ -120,42 +120,6 @@ raw_field_value(struct event_format *event, const char *name, void *data)
 	return val;
 }
 
-void *raw_field_ptr(struct event_format *event, const char *name, void *data)
-{
-	struct format_field *field;
-
-	field = pevent_find_any_field(event, name);
-	if (!field)
-		return NULL;
-
-	if (field->flags & FIELD_IS_DYNAMIC) {
-		int offset;
-
-		offset = *(int *)(data + field->offset);
-		offset &= 0xffff;
-
-		return data + offset;
-	}
-
-	return data + field->offset;
-}
-
-int trace_parse_common_type(struct pevent *pevent, void *data)
-{
-	struct pevent_record record;
-
-	record.data = data;
-	return pevent_data_type(pevent, &record);
-}
-
-int trace_parse_common_pid(struct pevent *pevent, void *data)
-{
-	struct pevent_record record;
-
-	record.data = data;
-	return pevent_data_pid(pevent, &record);
-}
-
 unsigned long long read_size(struct event_format *event, void *ptr, int size)
 {
 	return pevent_read_number(event->pevent, ptr, size);
tools/perf/util/trace-event.h +0 -9
index fafe1a4..04df631 100644
@@ -11,8 +11,6 @@ union perf_event;
 struct perf_tool;
 struct thread;
 
-extern struct pevent *perf_pevent;
-
 int bigendian(void);
 
 struct pevent *read_trace_init(int file_bigendian, int host_bigendian);
@@ -23,26 +21,19 @@ int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size);
 int parse_event_file(struct pevent *pevent,
 		     char *buf, unsigned long size, char *sys);
 
-struct pevent_record *trace_peek_data(struct pevent *pevent, int cpu);
-
 unsigned long long
 raw_field_value(struct event_format *event, const char *name, void *data);
-void *raw_field_ptr(struct event_format *event, const char *name, void *data);
 
 void parse_proc_kallsyms(struct pevent *pevent, char *file, unsigned int size);
 void parse_ftrace_printk(struct pevent *pevent, char *file, unsigned int size);
 
 ssize_t trace_report(int fd, struct pevent **pevent, bool repipe);
 
-int trace_parse_common_type(struct pevent *pevent, void *data);
-int trace_parse_common_pid(struct pevent *pevent, void *data);
-
 struct event_format *trace_find_next_event(struct pevent *pevent,
 					   struct event_format *event);
 unsigned long long read_size(struct event_format *event, void *ptr, int size);
 unsigned long long eval_flag(const char *flag);
 
-struct pevent_record *trace_read_data(struct pevent *pevent, int cpu);
 int read_tracing_data(int fd, struct list_head *pattrs);
 
 struct tracing_data {
Signature · 1 line
1.7.11.7
#3 lore raw

[tip:perf/core] perf tools: Remove unused trace-event-* code

perf tools: Remove unused trace-event-* code
Commit-ID:  5283ec23a02e8afdc984c7f5f07e2a2662d4934a
Gitweb:     http://git.kernel.org/tip/5283ec23a02e8afdc984c7f5f07e2a2662d4934a
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 12 Sep 2013 18:39:34 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 9 Oct 2013 11:15:28 -0300

perf tools: Remove unused trace-event-* code

Removing unused trace-event-* code.

---
 tools/perf/util/trace-event-parse.c | 36 ------------------------------------
 tools/perf/util/trace-event.h       |  9 ---------
 2 files changed, 45 deletions(-)
tools/perf/util/trace-event-parse.c +0 -36
index e9e1c03..6681f71 100644
@@ -120,42 +120,6 @@ raw_field_value(struct event_format *event, const char *name, void *data)
 	return val;
 }
 
-void *raw_field_ptr(struct event_format *event, const char *name, void *data)
-{
-	struct format_field *field;
-
-	field = pevent_find_any_field(event, name);
-	if (!field)
-		return NULL;
-
-	if (field->flags & FIELD_IS_DYNAMIC) {
-		int offset;
-
-		offset = *(int *)(data + field->offset);
-		offset &= 0xffff;
-
-		return data + offset;
-	}
-
-	return data + field->offset;
-}
-
-int trace_parse_common_type(struct pevent *pevent, void *data)
-{
-	struct pevent_record record;
-
-	record.data = data;
-	return pevent_data_type(pevent, &record);
-}
-
-int trace_parse_common_pid(struct pevent *pevent, void *data)
-{
-	struct pevent_record record;
-
-	record.data = data;
-	return pevent_data_pid(pevent, &record);
-}
-
 unsigned long long read_size(struct event_format *event, void *ptr, int size)
 {
 	return pevent_read_number(event->pevent, ptr, size);
tools/perf/util/trace-event.h +0 -9
index fafe1a4..04df631 100644
@@ -11,8 +11,6 @@ union perf_event;
 struct perf_tool;
 struct thread;
 
-extern struct pevent *perf_pevent;
-
 int bigendian(void);
 
 struct pevent *read_trace_init(int file_bigendian, int host_bigendian);
@@ -23,26 +21,19 @@ int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size);
 int parse_event_file(struct pevent *pevent,
 		     char *buf, unsigned long size, char *sys);
 
-struct pevent_record *trace_peek_data(struct pevent *pevent, int cpu);
-
 unsigned long long
 raw_field_value(struct event_format *event, const char *name, void *data);
-void *raw_field_ptr(struct event_format *event, const char *name, void *data);
 
 void parse_proc_kallsyms(struct pevent *pevent, char *file, unsigned int size);
 void parse_ftrace_printk(struct pevent *pevent, char *file, unsigned int size);
 
 ssize_t trace_report(int fd, struct pevent **pevent, bool repipe);
 
-int trace_parse_common_type(struct pevent *pevent, void *data);
-int trace_parse_common_pid(struct pevent *pevent, void *data);
-
 struct event_format *trace_find_next_event(struct pevent *pevent,
 					   struct event_format *event);
 unsigned long long read_size(struct event_format *event, void *ptr, int size);
 unsigned long long eval_flag(const char *flag);
 
-struct pevent_record *trace_read_data(struct pevent *pevent, int cpu);
 int read_tracing_data(int fd, struct list_head *pattrs);
 
 struct tracing_data {
author
#4 lore raw

PATCH 3/4 perf tools: Unify page_size usage

In reply to Jiri Olsa

Making page_size global from the util object. Removing the not needed one.

Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc David Ahern <[email protected]>
---
 tools/perf/builtin-record.c | 5 +----
 tools/perf/perf.c           | 1 +
 tools/perf/util/python.c    | 1 +
 3 files changed, 3 insertions(+), 4 deletions(-)
tools/perf/builtin-record.c +1 -4
index a41ac415..ceea545 100644
@@ -70,7 +70,6 @@ struct perf_record {
 	struct perf_session	*session;
 	const char		*progname;
 	int			output;
-	unsigned int		page_size;
 	int			realtime_prio;
 	bool			no_buildid;
 	bool			no_buildid_cache;
@@ -119,7 +118,7 @@ static int perf_record__mmap_read(struct perf_record *rec,
 {
 	unsigned int head = perf_mmap__read_head(md);
 	unsigned int old = md->prev;
-	unsigned char *data = md->base + rec->page_size;
+	unsigned char *data = md->base + page_size;
 	unsigned long size;
 	void *buf;
 	int rc = 0;
@@ -360,8 +359,6 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
 
 	rec->progname = argv[0];
 
-	rec->page_size = sysconf(_SC_PAGE_SIZE);
-
 	on_exit(perf_record__sig_exit, rec);
 	signal(SIGCHLD, sig_handler);
 	signal(SIGINT, sig_handler);
tools/perf/perf.c +1 -0
index 85e1aed..6f0a209 100644
@@ -456,6 +456,7 @@ int main(int argc, const char **argv)
 {
 	const char *cmd;
 
+	/* The page_size is placed in util object. */
 	page_size = sysconf(_SC_PAGE_SIZE);
 
 	cmd = perf_extract_argv0_path(argv[0]);
tools/perf/util/python.c +1 -0
index 3eddf96..06efd02 100644
@@ -1029,6 +1029,7 @@ PyMODINIT_FUNC initperf(void)
 	    pyrf_cpu_map__setup_types() < 0)
 		return;
 
+	/* The page_size is placed in util object. */
 	page_size = sysconf(_SC_PAGE_SIZE);
 
 	Py_INCREF(&pyrf_evlist__type);
Signature · 1 line
1.7.11.7
#5 lore raw

[tip:perf/core] perf tools: Unify page_size usage

perf tools: Unify page_size usage
Commit-ID:  918512b435e15fefe609d236e0ecd62cb8f389c9
Gitweb:     http://git.kernel.org/tip/918512b435e15fefe609d236e0ecd62cb8f389c9
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 12 Sep 2013 18:39:35 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 9 Oct 2013 11:22:55 -0300

perf tools: Unify page_size usage

Making page_size global from the util object.

Removing the not needed one.

---
 tools/perf/builtin-record.c | 5 +----
 tools/perf/perf.c           | 1 +
 tools/perf/util/python.c    | 1 +
 3 files changed, 3 insertions(+), 4 deletions(-)
tools/perf/builtin-record.c +1 -4
index cf36ba2..0aacd62 100644
@@ -70,7 +70,6 @@ struct perf_record {
 	struct perf_session	*session;
 	const char		*progname;
 	int			output;
-	unsigned int		page_size;
 	int			realtime_prio;
 	bool			no_buildid;
 	bool			no_buildid_cache;
@@ -119,7 +118,7 @@ static int perf_record__mmap_read(struct perf_record *rec,
 {
 	unsigned int head = perf_mmap__read_head(md);
 	unsigned int old = md->prev;
-	unsigned char *data = md->base + rec->page_size;
+	unsigned char *data = md->base + page_size;
 	unsigned long size;
 	void *buf;
 	int rc = 0;
@@ -360,8 +359,6 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
 
 	rec->progname = argv[0];
 
-	rec->page_size = sysconf(_SC_PAGE_SIZE);
-
 	on_exit(perf_record__sig_exit, rec);
 	signal(SIGCHLD, sig_handler);
 	signal(SIGINT, sig_handler);
tools/perf/perf.c +1 -0
index 245020c..6265778 100644
@@ -456,6 +456,7 @@ int main(int argc, const char **argv)
 {
 	const char *cmd;
 
+	/* The page_size is placed in util object. */
 	page_size = sysconf(_SC_PAGE_SIZE);
 
 	cmd = perf_extract_argv0_path(argv[0]);
tools/perf/util/python.c +1 -0
index 71b5412..a24ce0a 100644
@@ -1036,6 +1036,7 @@ PyMODINIT_FUNC initperf(void)
 	    pyrf_cpu_map__setup_types() < 0)
 		return;
 
+	/* The page_size is placed in util object. */
 	page_size = sysconf(_SC_PAGE_SIZE);
 
 	Py_INCREF(&pyrf_evlist__type);
author
#6 lore raw

PATCH 4/4 perf tools: Make kmem work for non numa machines

In reply to Jiri Olsa

The commit '2814eb0 perf kmem: Remove die() calls' disabled kmem command for machines without numa support. It made the command fail if '/sys/devices/system/node' dir wasn't found.

Skipping the numa based initialization in case the directory is not found and continue execution.

Cc Namhyung Kim <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/builtin-kmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-kmem.c +1 -1
index c2dff9c..9b5f077 100644
@@ -101,7 +101,7 @@ static int setup_cpunode_map(void)
 
 	dir1 = opendir(PATH_SYS_NODE);
 	if (!dir1)
-		return -1;
+		return 0;
 
 	while ((dent1 = readdir(dir1)) != NULL) {
 		if (dent1->d_type != DT_DIR ||
Signature · 1 line
1.7.11.7
author
#7 lore raw

Re: [PATCH 4/4] perf tools: Make kmem work for non numa machines

Quoted 7 lines · Jiri Olsa

The commit '2814eb0 perf kmem: Remove die() calls' disabled kmem command for machines without numa support. It made the command fail if '/sys/devices/system/node' dir wasn't found.

Skipping the numa based initialization in case the directory is not found and continue execution.

Quoted 8 lines
Cc Namhyung Kim <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>

ping

thanks,
jirka

Quoted 20 lines
---
 tools/perf/builtin-kmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-kmem.c +1 -1
index c2dff9c..9b5f077 100644
@@ -101,7 +101,7 @@ static int setup_cpunode_map(void)
 
 	dir1 = opendir(PATH_SYS_NODE);
 	if (!dir1)
-		return -1;
+		return 0;
 
 	while ((dent1 = readdir(dir1)) != NULL) {
 		if (dent1->d_type != DT_DIR ||
Signature · 1 line
1.7.11.7
#8 lore raw

Re: [PATCH 4/4] perf tools: Make kmem work for non numa machines

Em Mon, Sep 23, 2013 at 03:50:31PM +0200, Jiri Olsa escreveu:

Quoted 2 lines

ping

Its in perf/core, guess should send it via perf/urgent too, right?

- Arnaldo

author
#9 lore raw

Re: [PATCH 4/4] perf tools: Make kmem work for non numa machines

Quoted 6 lines · Arnaldo Carvalho de Melo

Em Mon, Sep 23, 2013 at 03:50:31PM +0200, Jiri Olsa escreveu:

Quoted 2 lines

ping

Its in perf/core, guess should send it via perf/urgent too, right?

that would be great, thanks

jirka

#10 lore raw

[tip:perf/urgent] perf kmem: Make it work again on non NUMA machines

In reply to Jiri Olsa
perf kmem: Make it work again on non NUMA machines
Commit-ID:  4921e320244e099bdf237fd10428594ce5f5b87d
Gitweb:     http://git.kernel.org/tip/4921e320244e099bdf237fd10428594ce5f5b87d
Author:     Jiri Olsa <[email protected]>
AuthorDate: Thu, 12 Sep 2013 18:39:36 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 24 Sep 2013 14:13:46 -0300

perf kmem: Make it work again on non NUMA machines

The commit '2814eb0 perf kmem: Remove die() calls' disabled 'perf kmem' command for machines without numa support. It made the command fail if '/sys/devices/system/node' dir wasn't found.

Skipping the numa based initialization in case the directory is not found and continue execution.

---
 tools/perf/builtin-kmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-kmem.c +1 -1
index c2dff9c..9b5f077 100644
@@ -101,7 +101,7 @@ static int setup_cpunode_map(void)
 
 	dir1 = opendir(PATH_SYS_NODE);
 	if (!dir1)
-		return -1;
+		return 0;
 
 	while ((dent1 = readdir(dir1)) != NULL) {
 		if (dent1->d_type != DT_DIR ||