Skip to contentSkip to conversation

perf tools: Cleanups on tracepoint handling

PATCH In review Namhyung Kim 5 participants 41 messages Jun 4, 2013 – Jul 19, 2013 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

cover perf tools: Cleanups on tracepoint handling

Hello,

This patchset is a resend version of previous work and basis of upcoming perf ftrace patchset. Although I saw no issue on this series when I posted earlier, it'd be great if Steve or others take a look at it again and give comments.

I also updated 'perf/cleanup' branch on my tree at:

git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git

Thanks,
Namhyung

Namhyung Kim (16):
tools lib traceevent: Remove unused install targets
tools lib traceevent: Get rid of unused gui target
tools lib traceevent: Add const qualifier to string arguments tools lib traceevent: Add trace_seq_reset()
tools lib traceevent: Add page_size field to pevent
tools lib traceevent: Port kbuffer parser routines
perf util: Save page size in a trace file to pevent
perf util: Save long size of traced system
perf util: Make file/host_bigendian variable local
perf util: Skip reading header_event file
perf util: Parse header_page to get proper long size
perf util: Get rid of unused header_page_* variables
perf util: Move latency_format variable to builtin-script.c perf util: Rename read_*() functions in trace-event-info.c perf util: No need to call read_trace_init() in tracing_data_header() perf util: Remove unused enum and macro in trace-event.h

 tools/lib/traceevent/Makefile        |  18 +-
 tools/lib/traceevent/event-parse.c   |   7 +-
 tools/lib/traceevent/event-parse.h   |  15 +-
 tools/lib/traceevent/kbuffer-parse.c | 732 +++++++++++++++++++++++++++++++++++
 tools/lib/traceevent/kbuffer.h       |  67 ++++
 tools/lib/traceevent/trace-seq.c     |  13 +
 tools/perf/builtin-script.c          |   1 +
 tools/perf/util/trace-event-info.c   |  22 +-
 tools/perf/util/trace-event-parse.c  |   6 -
 tools/perf/util/trace-event-read.c   |  52 ++-
 tools/perf/util/trace-event.h        |  15 -
 11 files changed, 875 insertions(+), 73 deletions(-)
 create mode 100644 tools/lib/traceevent/kbuffer-parse.c
 create mode 100644 tools/lib/traceevent/kbuffer.h
Signature · 1 line
1.7.11.7
author maintainer
#1 lore raw

PATCH 1/16 tools lib traceevent: Remove unused install targets

From: Namhyung Kim <[email protected]>

The html_install, img_install, install_plugin and install_python are unused in the Makefile. Get rid of them.

---
 tools/lib/traceevent/Makefile | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
tools/lib/traceevent/Makefile +2 -7
index 0b0a90787db6..fd7510d99583 100644
@@ -39,13 +39,8 @@ bindir_relative = bin
 bindir = $(prefix)/$(bindir_relative)
 man_dir = $(prefix)/share/man
 man_dir_SQ = '$(subst ','\'',$(man_dir))'
-html_install = $(prefix)/share/kernelshark/html
-html_install_SQ = '$(subst ','\'',$(html_install))'
-img_install = $(prefix)/share/kernelshark/html/images
-img_install_SQ = '$(subst ','\'',$(img_install))'
 
-export man_dir man_dir_SQ html_install html_install_SQ INSTALL
-export img_install img_install_SQ
+export man_dir man_dir_SQ INSTALL
 export DESTDIR DESTDIR_SQ
 
 # copy a bit from Linux kbuild
@@ -300,7 +295,7 @@ define do_install
 	$(INSTALL) $1 '$(DESTDIR_SQ)$2'
 endef
 
-install_lib: all_cmd install_plugins install_python
+install_lib: all_cmd
 	$(Q)$(call do_install,$(LIB_FILE),$(bindir_SQ))
 
 install: install_lib
Signature · 1 line
1.7.11.7
#2 lore raw

[tip:perf/core] tools lib traceevent: Remove unused install targets

tools lib traceevent: Remove unused install targets
Commit-ID:  9f1efa82640b4f06c8f6c847f088c53e4100395c
Gitweb:     http://git.kernel.org/tip/9f1efa82640b4f06c8f6c847f088c53e4100395c
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:16 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:07 -0300

tools lib traceevent: Remove unused install targets

The html_install, img_install, install_plugin and install_python are unused in the Makefile. Get rid of them.

---
 tools/lib/traceevent/Makefile | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
tools/lib/traceevent/Makefile +2 -7
index 0b0a907..fd7510d 100644
@@ -39,13 +39,8 @@ bindir_relative = bin
 bindir = $(prefix)/$(bindir_relative)
 man_dir = $(prefix)/share/man
 man_dir_SQ = '$(subst ','\'',$(man_dir))'
-html_install = $(prefix)/share/kernelshark/html
-html_install_SQ = '$(subst ','\'',$(html_install))'
-img_install = $(prefix)/share/kernelshark/html/images
-img_install_SQ = '$(subst ','\'',$(img_install))'
 
-export man_dir man_dir_SQ html_install html_install_SQ INSTALL
-export img_install img_install_SQ
+export man_dir man_dir_SQ INSTALL
 export DESTDIR DESTDIR_SQ
 
 # copy a bit from Linux kbuild
@@ -300,7 +295,7 @@ define do_install
 	$(INSTALL) $1 '$(DESTDIR_SQ)$2'
 endef
 
-install_lib: all_cmd install_plugins install_python
+install_lib: all_cmd
 	$(Q)$(call do_install,$(LIB_FILE),$(bindir_SQ))
 
 install: install_lib
author maintainer
#3 lore raw

PATCH 2/16 tools lib traceevent: Get rid of unused gui target

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

It's came from trace-cmd's kernelshark which is not a part of libtraceevent.

---
 tools/lib/traceevent/Makefile | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
tools/lib/traceevent/Makefile +1 -7
index fd7510d99583..4505de874929 100644
@@ -71,10 +71,7 @@ $(if $(BUILD_OUTPUT),, \
 
 all: sub-make
 
-gui: force
-	$(call build_output, all_cmd)
-
-$(filter-out gui,$(MAKECMDGOALS)): sub-make
+$(MAKECMDGOALS): sub-make
 
 sub-make: force
 	$(call build_output, $(MAKECMDGOALS))
@@ -253,9 +250,6 @@ define check_deps
 		$(RM) $@.$$$$
 endef
 
-$(gui_deps): ks_version.h
-$(non_gui_deps): tc_version.h
-
 $(all_deps): .%.d: $(src)/%.c
 	$(Q)$(call check_deps)
 
Signature · 1 line
1.7.11.7
#4 lore raw

[tip:perf/core] tools lib traceevent: Get rid of unused gui target

tools lib traceevent: Get rid of unused gui target
Commit-ID:  4ccdf57d46843f5c03e390bdb652c9744e30ee20
Gitweb:     http://git.kernel.org/tip/4ccdf57d46843f5c03e390bdb652c9744e30ee20
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:17 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:09 -0300

tools lib traceevent: Get rid of unused gui target

It's came from trace-cmd's kernelshark which is not a part of libtraceevent.

---
 tools/lib/traceevent/Makefile | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
tools/lib/traceevent/Makefile +1 -7
index fd7510d..4505de8 100644
@@ -71,10 +71,7 @@ $(if $(BUILD_OUTPUT),, \
 
 all: sub-make
 
-gui: force
-	$(call build_output, all_cmd)
-
-$(filter-out gui,$(MAKECMDGOALS)): sub-make
+$(MAKECMDGOALS): sub-make
 
 sub-make: force
 	$(call build_output, $(MAKECMDGOALS))
@@ -253,9 +250,6 @@ define check_deps
 		$(RM) $@.$$$$
 endef
 
-$(gui_deps): ks_version.h
-$(non_gui_deps): tc_version.h
-
 $(all_deps): .%.d: $(src)/%.c
 	$(Q)$(call check_deps)
 
author maintainer
#5 lore raw

PATCH 3/16 tools lib traceevent: Add const qualifier to string arguments

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

If pevent_register_event_handler() received a string literal as @sys_name or @event_name parameter, it emitted a warning about const qualifier removal. Since they're not modified in the function we can make it have const qualifier.

---
 tools/lib/traceevent/event-parse.c | 7 +++----
 tools/lib/traceevent/event-parse.h | 3 ++-
 2 files changed, 5 insertions(+), 5 deletions(-)
tools/lib/traceevent/event-parse.c +3 -4
index 82b0606dcb8a..d1c2a6a4cd32 100644
@@ -5450,10 +5450,9 @@ int pevent_register_print_function(struct pevent *pevent,
  * If @id is >= 0, then it is used to find the event.
  * else @sys_name and @event_name are used.
  */
-int pevent_register_event_handler(struct pevent *pevent,
-				  int id, char *sys_name, char *event_name,
-				  pevent_event_handler_func func,
-				  void *context)
+int pevent_register_event_handler(struct pevent *pevent, int id,
+				  const char *sys_name, const char *event_name,
+				  pevent_event_handler_func func, void *context)
 {
 	struct event_format *event;
 	struct event_handler *handle;
tools/lib/traceevent/event-parse.h +2 -1
index 7be7e89533e4..bfceab948f22 100644
@@ -561,7 +561,8 @@ int pevent_print_num_field(struct trace_seq *s, const char *fmt,
 			   struct event_format *event, const char *name,
 			   struct pevent_record *record, int err);
 
-int pevent_register_event_handler(struct pevent *pevent, int id, char *sys_name, char *event_name,
+int pevent_register_event_handler(struct pevent *pevent, int id,
+				  const char *sys_name, const char *event_name,
 				  pevent_event_handler_func func, void *context);
 int pevent_register_print_function(struct pevent *pevent,
 				   pevent_func_handler func,
Signature · 1 line
1.7.11.7
#6 lore raw

[tip:perf/core] tools lib traceevent: Add const qualifier to string arguments

tools lib traceevent: Add const qualifier to string arguments
Commit-ID:  79d5adf06dd530fe6a9ab3d086b2d23eb7560491
Gitweb:     http://git.kernel.org/tip/79d5adf06dd530fe6a9ab3d086b2d23eb7560491
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:18 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:11 -0300

tools lib traceevent: Add const qualifier to string arguments

If pevent_register_event_handler() received a string literal as @sys_name or @event_name parameter, it emitted a warning about const qualifier removal. Since they're not modified in the function we can make it have const qualifier.

---
 tools/lib/traceevent/event-parse.c | 7 +++----
 tools/lib/traceevent/event-parse.h | 3 ++-
 2 files changed, 5 insertions(+), 5 deletions(-)
tools/lib/traceevent/event-parse.c +3 -4
index 82b0606..d1c2a6a 100644
@@ -5450,10 +5450,9 @@ int pevent_register_print_function(struct pevent *pevent,
  * If @id is >= 0, then it is used to find the event.
  * else @sys_name and @event_name are used.
  */
-int pevent_register_event_handler(struct pevent *pevent,
-				  int id, char *sys_name, char *event_name,
-				  pevent_event_handler_func func,
-				  void *context)
+int pevent_register_event_handler(struct pevent *pevent, int id,
+				  const char *sys_name, const char *event_name,
+				  pevent_event_handler_func func, void *context)
 {
 	struct event_format *event;
 	struct event_handler *handle;
tools/lib/traceevent/event-parse.h +2 -1
index 7be7e89..bfceab9 100644
@@ -561,7 +561,8 @@ int pevent_print_num_field(struct trace_seq *s, const char *fmt,
 			   struct event_format *event, const char *name,
 			   struct pevent_record *record, int err);
 
-int pevent_register_event_handler(struct pevent *pevent, int id, char *sys_name, char *event_name,
+int pevent_register_event_handler(struct pevent *pevent, int id,
+				  const char *sys_name, const char *event_name,
 				  pevent_event_handler_func func, void *context);
 int pevent_register_print_function(struct pevent *pevent,
 				   pevent_func_handler func,
author maintainer
#7 lore raw

PATCH 4/16 tools lib traceevent: Add trace_seq_reset()

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

Sometimes it'd be useful if existing trace_seq can be reused. But currently it's impossible since there's no API to reset the trace_seq. Let's add trace_seq_reset() for this case.

---
 tools/lib/traceevent/event-parse.h |  1 +
 tools/lib/traceevent/trace-seq.c   | 13 +++++++++++++
 2 files changed, 14 insertions(+)
tools/lib/traceevent/event-parse.h +1 -0
index bfceab948f22..39f0c1dca915 100644
@@ -69,6 +69,7 @@ struct trace_seq {
 };
 
 void trace_seq_init(struct trace_seq *s);
+void trace_seq_reset(struct trace_seq *s);
 void trace_seq_destroy(struct trace_seq *s);
 
 extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
tools/lib/traceevent/trace-seq.c +13 -0
index a57db805136a..d7f2e68bc5b9 100644
@@ -49,6 +49,19 @@ void trace_seq_init(struct trace_seq *s)
 }
 
 /**
+ * trace_seq_reset - re-initialize the trace_seq structure
+ * @s: a pointer to the trace_seq structure to reset
+ */
+void trace_seq_reset(struct trace_seq *s)
+{
+	if (!s)
+		return;
+	TRACE_SEQ_CHECK(s);
+	s->len = 0;
+	s->readpos = 0;
+}
+
+/**
  * trace_seq_destroy - free up memory of a trace_seq
  * @s: a pointer to the trace_seq to free the buffer
  *
Signature · 1 line
1.7.11.7
#8 lore raw

[tip:perf/core] tools lib traceevent: Add trace_seq_reset()

tools lib traceevent: Add trace_seq_reset()
Commit-ID:  6a48aec3a7179b0cdae2339d5a4072214ee6c6fe
Gitweb:     http://git.kernel.org/tip/6a48aec3a7179b0cdae2339d5a4072214ee6c6fe
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:19 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:12 -0300

tools lib traceevent: Add trace_seq_reset()

Sometimes it'd be useful if existing trace_seq can be reused. But currently it's impossible since there's no API to reset the trace_seq. Let's add trace_seq_reset() for this case.

---
 tools/lib/traceevent/event-parse.h |  1 +
 tools/lib/traceevent/trace-seq.c   | 13 +++++++++++++
 2 files changed, 14 insertions(+)
tools/lib/traceevent/event-parse.h +1 -0
index bfceab9..39f0c1d 100644
@@ -69,6 +69,7 @@ struct trace_seq {
 };
 
 void trace_seq_init(struct trace_seq *s);
+void trace_seq_reset(struct trace_seq *s);
 void trace_seq_destroy(struct trace_seq *s);
 
 extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
tools/lib/traceevent/trace-seq.c +13 -0
index a57db80..d7f2e68 100644
@@ -49,6 +49,19 @@ void trace_seq_init(struct trace_seq *s)
 }
 
 /**
+ * trace_seq_reset - re-initialize the trace_seq structure
+ * @s: a pointer to the trace_seq structure to reset
+ */
+void trace_seq_reset(struct trace_seq *s)
+{
+	if (!s)
+		return;
+	TRACE_SEQ_CHECK(s);
+	s->len = 0;
+	s->readpos = 0;
+}
+
+/**
  * trace_seq_destroy - free up memory of a trace_seq
  * @s: a pointer to the trace_seq to free the buffer
  *
author maintainer
#9 lore raw

PATCH 5/16 tools lib traceevent: Add page_size field to pevent

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

The page size of traced system can be different than current system's because the recorded data file might be analyzed in a different machine. In this case we should use original page size of traced system when accessing the data file, so this information needs to be saved.

Cc Steven Rostedt <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 tools/lib/traceevent/event-parse.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/lib/traceevent/event-parse.h +11 -0
index 39f0c1dca915..c37b2026d04a 100644
@@ -400,6 +400,7 @@ struct pevent {
 
 	int cpus;
 	int long_size;
+	int page_size;
 
 	struct cmdline *cmdlines;
 	struct cmdline_list *cmdlist;
@@ -621,6 +622,16 @@ static inline void pevent_set_long_size(struct pevent *pevent, int long_size)
 	pevent->long_size = long_size;
 }
 
+static inline int pevent_get_page_size(struct pevent *pevent)
+{
+	return pevent->page_size;
+}
+
+static inline void pevent_set_page_size(struct pevent *pevent, int _page_size)
+{
+	pevent->page_size = _page_size;
+}
+
 static inline int pevent_is_file_bigendian(struct pevent *pevent)
 {
 	return pevent->file_bigendian;
Signature · 1 line
1.7.11.7
#10 lore raw

[tip:perf/core] tools lib traceevent: Add page_size field to pevent

tools lib traceevent: Add page_size field to pevent
Commit-ID:  012ac692575b1ea6ed930871850584e4c64f1382
Gitweb:     http://git.kernel.org/tip/012ac692575b1ea6ed930871850584e4c64f1382
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:20 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:14 -0300

tools lib traceevent: Add page_size field to pevent

The page size of traced system can be different than current system's because the recorded data file might be analyzed in a different machine. In this case we should use original page size of traced system when accessing the data file, so this information needs to be saved.

---
 tools/lib/traceevent/event-parse.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/lib/traceevent/event-parse.h +11 -0
index 39f0c1d..c37b202 100644
@@ -400,6 +400,7 @@ struct pevent {
 
 	int cpus;
 	int long_size;
+	int page_size;
 
 	struct cmdline *cmdlines;
 	struct cmdline_list *cmdlist;
@@ -621,6 +622,16 @@ static inline void pevent_set_long_size(struct pevent *pevent, int long_size)
 	pevent->long_size = long_size;
 }
 
+static inline int pevent_get_page_size(struct pevent *pevent)
+{
+	return pevent->page_size;
+}
+
+static inline void pevent_set_page_size(struct pevent *pevent, int _page_size)
+{
+	pevent->page_size = _page_size;
+}
+
 static inline int pevent_is_file_bigendian(struct pevent *pevent)
 {
 	return pevent->file_bigendian;
author maintainer
#11 lore raw

PATCH 6/16 tools lib traceevent: Port kbuffer parser routines

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

kbuffer code is for parsing ftrace ring-buffer binary data and used for trace-cmd. Move the code here in order to be used more widely.

---
 tools/lib/traceevent/Makefile        |   1 +
 tools/lib/traceevent/kbuffer-parse.c | 732 +++++++++++++++++++++++++++++++++++
 tools/lib/traceevent/kbuffer.h       |  67 ++++
 3 files changed, 800 insertions(+)
 create mode 100644 tools/lib/traceevent/kbuffer-parse.c
 create mode 100644 tools/lib/traceevent/kbuffer.h
tools/lib/traceevent/Makefile +1 -0
index 4505de874929..0794acca46a3 100644
@@ -181,6 +181,7 @@ $(obj)/%.o: $(src)/%.c
 	$(Q)$(call do_compile)
 
 PEVENT_LIB_OBJS = event-parse.o trace-seq.o parse-filter.o parse-utils.o
+PEVENT_LIB_OBJS += kbuffer-parse.o
 
 ALL_OBJS = $(PEVENT_LIB_OBJS)
 
tools/lib/traceevent/kbuffer-parse.c new file +732 -0

732 lines not on this page · raw message

tools/lib/traceevent/kbuffer.h new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#12 lore raw

[tip:perf/core] tools lib traceevent: Port kbuffer parser routines

tools lib traceevent: Port kbuffer parser routines
Commit-ID:  d6c25223f6067c6889d8fc3f9576d34bbac161b0
Gitweb:     http://git.kernel.org/tip/d6c25223f6067c6889d8fc3f9576d34bbac161b0
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:21 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:16 -0300

tools lib traceevent: Port kbuffer parser routines

kbuffer code is for parsing ftrace ring-buffer binary data and used for trace-cmd. Move the code here in order to be used more widely.

---
 tools/lib/traceevent/Makefile        |   1 +
 tools/lib/traceevent/kbuffer-parse.c | 732 +++++++++++++++++++++++++++++++++++
 tools/lib/traceevent/kbuffer.h       |  67 ++++
 3 files changed, 800 insertions(+)
tools/lib/traceevent/Makefile +1 -0
index 4505de8..0794acc 100644
@@ -181,6 +181,7 @@ $(obj)/%.o: $(src)/%.c
 	$(Q)$(call do_compile)
 
 PEVENT_LIB_OBJS = event-parse.o trace-seq.o parse-filter.o parse-utils.o
+PEVENT_LIB_OBJS += kbuffer-parse.o
 
 ALL_OBJS = $(PEVENT_LIB_OBJS)
 
tools/lib/traceevent/kbuffer-parse.c new file +732 -0

732 lines not on this page · raw message

tools/lib/traceevent/kbuffer.h new file +67 -0

67 lines not on this page · raw message

author maintainer
#13 lore raw

PATCH 7/16 perf util: Save page size in a trace file to pevent

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

We now have page_size field in struct pevent, save the actual size of the system.

---
 tools/perf/util/trace-event-read.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/perf/util/trace-event-read.c +5 -2
index af215c0d2379..c6b491bcb8cd 100644
@@ -349,6 +349,7 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
 	int show_funcs = 0;
 	int show_printk = 0;
 	ssize_t size = -1;
+	int file_page_size;
 	struct pevent *pevent;
 	int err;
 
@@ -393,10 +394,12 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
 		goto out;
 	long_size = buf[0];
 
-	page_size = read4(pevent);
-	if (!page_size)
+	file_page_size = read4(pevent);
+	if (!file_page_size)
 		goto out;
 
+	pevent_set_page_size(pevent, file_page_size);
+
 	err = read_header_files(pevent);
 	if (err)
 		goto out;
Signature · 1 line
1.7.11.7
#14 lore raw

[tip:perf/core] perf util: Save page size in a trace file to pevent

perf util: Save page size in a trace file to pevent
Commit-ID:  30f36762aab575f2894f7528d91ecd0b6e26e3e4
Gitweb:     http://git.kernel.org/tip/30f36762aab575f2894f7528d91ecd0b6e26e3e4
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:22 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:17 -0300

perf util: Save page size in a trace file to pevent

We now have page_size field in struct pevent, save the actual size of the system.

---
 tools/perf/util/trace-event-read.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/perf/util/trace-event-read.c +5 -2
index af215c0..c6b491b 100644
@@ -349,6 +349,7 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
 	int show_funcs = 0;
 	int show_printk = 0;
 	ssize_t size = -1;
+	int file_page_size;
 	struct pevent *pevent;
 	int err;
 
@@ -393,10 +394,12 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
 		goto out;
 	long_size = buf[0];
 
-	page_size = read4(pevent);
-	if (!page_size)
+	file_page_size = read4(pevent);
+	if (!file_page_size)
 		goto out;
 
+	pevent_set_page_size(pevent, file_page_size);
+
 	err = read_header_files(pevent);
 	if (err)
 		goto out;
author maintainer
#15 lore raw

PATCH 8/16 perf util: Save long size of traced system

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

Save size of long type of system to struct pevent. Since original static variable was not used anywhere, just get rid of it.

---
 tools/perf/util/trace-event-read.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
tools/perf/util/trace-event-read.c +3 -8
index c6b491bcb8cd..6166294d7f22 100644
@@ -41,7 +41,6 @@ static int input_fd;
 
 int file_bigendian;
 int host_bigendian;
-static int long_size;
 
 static ssize_t trace_data_size;
 static bool repipe;
@@ -231,12 +230,6 @@ static int read_header_files(struct pevent *pevent)
 	size = read8(pevent);
 	skip(size);
 
-	/*
-	 * The size field in the page is of type long,
-	 * use that instead, since it represents the kernel.
-	 */
-	long_size = header_page_size_size;
-
 	if (do_read(buf, 13) < 0)
 		return -1;
 
@@ -349,6 +342,7 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
 	int show_funcs = 0;
 	int show_printk = 0;
 	ssize_t size = -1;
+	int file_long_size;
 	int file_page_size;
 	struct pevent *pevent;
 	int err;
@@ -392,12 +386,13 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
 
 	if (do_read(buf, 1) < 0)
 		goto out;
-	long_size = buf[0];
+	file_long_size = buf[0];
 
 	file_page_size = read4(pevent);
 	if (!file_page_size)
 		goto out;
 
+	pevent_set_long_size(pevent, file_long_size);
 	pevent_set_page_size(pevent, file_page_size);
 
 	err = read_header_files(pevent);
Signature · 1 line
1.7.11.7
#16 lore raw

[tip:perf/core] perf util: Save long size of traced system

perf util: Save long size of traced system
Commit-ID:  59657f9c8dd91363f1c94c1f749b33ecf626cfc2
Gitweb:     http://git.kernel.org/tip/59657f9c8dd91363f1c94c1f749b33ecf626cfc2
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:23 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:19 -0300

perf util: Save long size of traced system

Save size of long type of system to struct pevent. Since original static variable was not used anywhere, just get rid of it.

---
 tools/perf/util/trace-event-read.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
tools/perf/util/trace-event-read.c +3 -8
index c6b491b..6166294 100644
@@ -41,7 +41,6 @@ static int input_fd;
 
 int file_bigendian;
 int host_bigendian;
-static int long_size;
 
 static ssize_t trace_data_size;
 static bool repipe;
@@ -231,12 +230,6 @@ static int read_header_files(struct pevent *pevent)
 	size = read8(pevent);
 	skip(size);
 
-	/*
-	 * The size field in the page is of type long,
-	 * use that instead, since it represents the kernel.
-	 */
-	long_size = header_page_size_size;
-
 	if (do_read(buf, 13) < 0)
 		return -1;
 
@@ -349,6 +342,7 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
 	int show_funcs = 0;
 	int show_printk = 0;
 	ssize_t size = -1;
+	int file_long_size;
 	int file_page_size;
 	struct pevent *pevent;
 	int err;
@@ -392,12 +386,13 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
 
 	if (do_read(buf, 1) < 0)
 		goto out;
-	long_size = buf[0];
+	file_long_size = buf[0];
 
 	file_page_size = read4(pevent);
 	if (!file_page_size)
 		goto out;
 
+	pevent_set_long_size(pevent, file_long_size);
 	pevent_set_page_size(pevent, file_page_size);
 
 	err = read_header_files(pevent);
author maintainer
#17 lore raw

PATCH 9/16 perf util: Make file/host_bigendian variable local

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

They're not used anywhere, just make them local variables.

---
 tools/perf/util/trace-event-read.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
tools/perf/util/trace-event-read.c +2 -3
index 6166294d7f22..0dd9fbda88eb 100644
@@ -39,9 +39,6 @@
 
 static int input_fd;
 
-int file_bigendian;
-int host_bigendian;
-
 static ssize_t trace_data_size;
 static bool repipe;
 
@@ -342,6 +339,8 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
 	int show_funcs = 0;
 	int show_printk = 0;
 	ssize_t size = -1;
+	int file_bigendian;
+	int host_bigendian;
 	int file_long_size;
 	int file_page_size;
 	struct pevent *pevent;
Signature · 1 line
1.7.11.7
#18 lore raw

[tip:perf/core] perf util: Make file/ host_bigendian variable local

perf util: Make file/host_bigendian variable local
Commit-ID:  63af28fa167374e470c32570b7c955c4d973dda4
Gitweb:     http://git.kernel.org/tip/63af28fa167374e470c32570b7c955c4d973dda4
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:24 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:21 -0300

perf util: Make file/host_bigendian variable local

They're not used anywhere, just make them local variables.

---
 tools/perf/util/trace-event-read.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
tools/perf/util/trace-event-read.c +2 -3
index 6166294..0dd9fbd 100644
@@ -39,9 +39,6 @@
 
 static int input_fd;
 
-int file_bigendian;
-int host_bigendian;
-
 static ssize_t trace_data_size;
 static bool repipe;
 
@@ -342,6 +339,8 @@ ssize_t trace_report(int fd, struct pevent **ppevent, bool __repipe)
 	int show_funcs = 0;
 	int show_printk = 0;
 	ssize_t size = -1;
+	int file_bigendian;
+	int host_bigendian;
 	int file_long_size;
 	int file_page_size;
 	struct pevent *pevent;
author maintainer
#19 lore raw

PATCH 10/16 perf util: Skip reading header_event file

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

It seems perf does not parse header_event file so we can skip it as we do for header_page file.

---
 tools/perf/util/trace-event-read.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
tools/perf/util/trace-event-read.c +1 -8
index 0dd9fbda88eb..fa45fca2a2d3 100644
@@ -212,7 +212,6 @@ static int read_ftrace_printk(struct pevent *pevent)
 static int read_header_files(struct pevent *pevent)
 {
 	unsigned long long size;
-	char *header_event;
 	char buf[BUFSIZ];
 	int ret = 0;
 
@@ -236,14 +235,8 @@ static int read_header_files(struct pevent *pevent)
 	}
 
 	size = read8(pevent);
-	header_event = malloc(size);
-	if (header_event == NULL)
-		return -1;
-
-	if (do_read(header_event, size) < 0)
-		ret = -1;
+	skip(size);
 
-	free(header_event);
 	return ret;
 }
 
Signature · 1 line
1.7.11.7
#20 lore raw

[tip:perf/core] perf util: Skip reading header_event file

perf util: Skip reading header_event file
Commit-ID:  2b2efc7fb8a3ede936580e870c5f809e491c925c
Gitweb:     http://git.kernel.org/tip/2b2efc7fb8a3ede936580e870c5f809e491c925c
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:25 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:23 -0300

perf util: Skip reading header_event file

It seems perf does not parse header_event file so we can skip it as we do for header_page file.

---
 tools/perf/util/trace-event-read.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
tools/perf/util/trace-event-read.c +1 -8
index 0dd9fbd..fa45fca 100644
@@ -212,7 +212,6 @@ static int read_ftrace_printk(struct pevent *pevent)
 static int read_header_files(struct pevent *pevent)
 {
 	unsigned long long size;
-	char *header_event;
 	char buf[BUFSIZ];
 	int ret = 0;
 
@@ -236,14 +235,8 @@ static int read_header_files(struct pevent *pevent)
 	}
 
 	size = read8(pevent);
-	header_event = malloc(size);
-	if (header_event == NULL)
-		return -1;
-
-	if (do_read(header_event, size) < 0)
-		ret = -1;
+	skip(size);
 
-	free(header_event);
 	return ret;
 }
 
author maintainer
#21 lore raw

PATCH 11/16 perf util: Parse header_page to get proper long size

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

The header_page file describes the format of the ring buffer page which is used by ftrace (not perf). And size of "commit" field (I guess it's older name was 'size') represents the real size of long type used for kernel. So update the pevent's long size.

---
 tools/perf/util/trace-event-read.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
tools/perf/util/trace-event-read.c +21 -1
index fa45fca2a2d3..f2112270c663 100644
@@ -212,6 +212,7 @@ static int read_ftrace_printk(struct pevent *pevent)
 static int read_header_files(struct pevent *pevent)
 {
 	unsigned long long size;
+	char *header_page;
 	char buf[BUFSIZ];
 	int ret = 0;
 
@@ -224,7 +225,26 @@ static int read_header_files(struct pevent *pevent)
 	}
 
 	size = read8(pevent);
-	skip(size);
+
+	header_page = malloc(size);
+	if (header_page == NULL)
+		return -1;
+
+	if (do_read(header_page, size) < 0) {
+		pr_debug("did not read header page");
+		free(header_page);
+		return -1;
+	}
+
+	if (!pevent_parse_header_page(pevent, header_page, size,
+				      pevent_get_long_size(pevent))) {
+		/*
+		 * The commit field in the page is of type long,
+		 * use that instead, since it represents the kernel.
+		 */
+		pevent_set_long_size(pevent, pevent->header_page_size_size);
+	}
+	free(header_page);
 
 	if (do_read(buf, 13) < 0)
 		return -1;
Signature · 1 line
1.7.11.7
#22 lore raw

Re: [PATCH 11/16] perf util: Parse header_page to get proper long size

Quoted 39 lines · Namhyung Kim

From: Namhyung Kim <[email protected]>

The header_page file describes the format of the ring buffer page which is used by ftrace (not perf). And size of "commit" field (I guess it's older name was 'size') represents the real size of long type used for kernel. So update the pevent's long size.

---
 tools/perf/util/trace-event-read.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
tools/perf/util/trace-event-read.c +11 -1
index fa45fca2a2d3..f2112270c663 100644
@@ -212,6 +212,7 @@ static int read_ftrace_printk(struct pevent *pevent)
 static int read_header_files(struct pevent *pevent)
 {
 	unsigned long long size;
+	char *header_page;
 	char buf[BUFSIZ];
 	int ret = 0;
 
@@ -224,7 +225,26 @@ static int read_header_files(struct pevent *pevent)
 	}
 
 	size = read8(pevent);
-	skip(size);
+
+	header_page = malloc(size);
+	if (header_page == NULL)
+		return -1;
+
+	if (do_read(header_page, size) < 0) {
+		pr_debug("did not read header page");
+		free(header_page);
+		return -1;
+	}

tools/perf/util/trace-event-read.c static int read_header_files(struct pevent *pevent) · line 247

Quoted 10 lines
tools/perf/util/trace-event-read.c +10 -0
+
+	if (!pevent_parse_header_page(pevent, header_page, size,
+				      pevent_get_long_size(pevent))) {
+		/*
+		 * The commit field in the page is of type long,
+		 * use that instead, since it represents the kernel.
+		 */
+		pevent_set_long_size(pevent, pevent->header_page_size_size);
+	}
+	free(header_page);

any reason why not merge this one with
83ae6eb perf util: Skip reading header_event file

jirka

author maintainer
#23 lore raw

Re: [PATCH 11/16] perf util: Parse header_page to get proper long size

Hi Jiri,

Quoted 10 lines · Jiri Olsa
Quoted 7 lines · Namhyung Kim

From: Namhyung Kim <[email protected]>

The header_page file describes the format of the ring buffer page which is used by ftrace (not perf). And size of "commit" field (I guess it's older name was 'size') represents the real size of long type used for kernel. So update the pevent's long size.

any reason why not merge this one with
83ae6eb perf util: Skip reading header_event file

Just try to keep it doing one thing in a patch. But if you think it'd better merging it, I'll do it. :)

Thanks,
Namhyung

#24 lore raw

Re: [PATCH 11/16] perf util: Parse header_page to get proper long size

Quoted 11 lines · Namhyung Kim

Hi Jiri,

Quoted 8 lines · Jiri Olsa
Quoted 7 lines · Namhyung Kim

From: Namhyung Kim <[email protected]>

The header_page file describes the format of the ring buffer page which is used by ftrace (not perf). And size of "commit" field (I guess it's older name was 'size') represents the real size of long type used for kernel. So update the pevent's long size.

Quoted 5 lines
Quoted 2 lines

any reason why not merge this one with
83ae6eb perf util: Skip reading header_event file

Just try to keep it doing one thing in a patch. But if you think it'd better merging it, I'll do it. :)

nope, just curious if I missed something ;-) it's ok

jirka

#25 lore raw

[tip:perf/core] perf util: Parse header_page to get proper long size

In reply to Namhyung Kim
perf util: Parse header_page to get proper long size
Commit-ID:  94b4d89e0021fe3e10415feede364a3fccaa2f89
Gitweb:     http://git.kernel.org/tip/94b4d89e0021fe3e10415feede364a3fccaa2f89
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:26 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:24 -0300

perf util: Parse header_page to get proper long size

The header_page file describes the format of the ring buffer page which is used by ftrace (not perf). And size of "commit" field (I guess it's older name was 'size') represents the real size of long type used for kernel. So update the pevent's long size.

---
 tools/perf/util/trace-event-read.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
tools/perf/util/trace-event-read.c +21 -1
index fa45fca..f211227 100644
@@ -212,6 +212,7 @@ static int read_ftrace_printk(struct pevent *pevent)
 static int read_header_files(struct pevent *pevent)
 {
 	unsigned long long size;
+	char *header_page;
 	char buf[BUFSIZ];
 	int ret = 0;
 
@@ -224,7 +225,26 @@ static int read_header_files(struct pevent *pevent)
 	}
 
 	size = read8(pevent);
-	skip(size);
+
+	header_page = malloc(size);
+	if (header_page == NULL)
+		return -1;
+
+	if (do_read(header_page, size) < 0) {
+		pr_debug("did not read header page");
+		free(header_page);
+		return -1;
+	}
+
+	if (!pevent_parse_header_page(pevent, header_page, size,
+				      pevent_get_long_size(pevent))) {
+		/*
+		 * The commit field in the page is of type long,
+		 * use that instead, since it represents the kernel.
+		 */
+		pevent_set_long_size(pevent, pevent->header_page_size_size);
+	}
+	free(header_page);
 
 	if (do_read(buf, 13) < 0)
 		return -1;
author maintainer
#26 lore raw

PATCH 12/16 perf util: Get rid of unused header_page_* variables

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

They're not used anywhere and same information is kept in a pevent already. So let's get rid of them.

---
 tools/perf/util/trace-event-parse.c | 4 ----
 tools/perf/util/trace-event.h       | 4 ----
 2 files changed, 8 deletions(-)
tools/perf/util/trace-event-parse.c +0 -4
index 4454835a9ebc..0deae885c7ba 100644
@@ -28,10 +28,6 @@
 #include "util.h"
 #include "trace-event.h"
 
-int header_page_size_size;
-int header_page_ts_size;
-int header_page_data_offset;
-
 bool latency_format;
 
 struct pevent *read_trace_init(int file_bigendian, int host_bigendian)
tools/perf/util/trace-event.h +0 -4
index 1978c398ad87..10d6e7b202c5 100644
@@ -10,10 +10,6 @@ struct perf_sample;
 union perf_event;
 struct perf_tool;
 
-extern int header_page_size_size;
-extern int header_page_ts_size;
-extern int header_page_data_offset;
-
 extern bool latency_format;
 extern struct pevent *perf_pevent;
 
Signature · 1 line
1.7.11.7
#27 lore raw

[tip:perf/core] perf util: Get rid of unused header_page_* variables

perf util: Get rid of unused header_page_* variables
Commit-ID:  9515b2eb7670a98fb9bdd8ceeefeea6ffb9f53fc
Gitweb:     http://git.kernel.org/tip/9515b2eb7670a98fb9bdd8ceeefeea6ffb9f53fc
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:27 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:26 -0300

perf util: Get rid of unused header_page_* variables

They're not used anywhere and same information is kept in a pevent already. So let's get rid of them.

---
 tools/perf/util/trace-event-parse.c | 4 ----
 tools/perf/util/trace-event.h       | 4 ----
 2 files changed, 8 deletions(-)
tools/perf/util/trace-event-parse.c +0 -4
index 4454835..0deae88 100644
@@ -28,10 +28,6 @@
 #include "util.h"
 #include "trace-event.h"
 
-int header_page_size_size;
-int header_page_ts_size;
-int header_page_data_offset;
-
 bool latency_format;
 
 struct pevent *read_trace_init(int file_bigendian, int host_bigendian)
tools/perf/util/trace-event.h +0 -4
index 11eb7fd..761c484 100644
@@ -10,10 +10,6 @@ struct perf_sample;
 union perf_event;
 struct perf_tool;
 
-extern int header_page_size_size;
-extern int header_page_ts_size;
-extern int header_page_data_offset;
-
 extern bool latency_format;
 extern struct pevent *perf_pevent;
 
author maintainer
#28 lore raw

PATCH 13/16 perf util: Move latency_format variable to builtin-script.c

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

It's the only user of the variable, so move it.

---
 tools/perf/builtin-script.c         | 1 +
 tools/perf/util/trace-event-parse.c | 2 --
 tools/perf/util/trace-event.h       | 1 -
 3 files changed, 1 insertion(+), 3 deletions(-)
tools/perf/builtin-script.c +1 -0
index 92d4658f56fb..3de8979fe87d 100644
@@ -24,6 +24,7 @@ static u64			last_timestamp;
 static u64			nr_unordered;
 extern const struct option	record_options[];
 static bool			no_callchain;
+static bool			latency_format;
 static bool			system_wide;
 static const char		*cpu_list;
 static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
tools/perf/util/trace-event-parse.c +0 -2
index 0deae885c7ba..fe7a27d67d2b 100644
@@ -28,8 +28,6 @@
 #include "util.h"
 #include "trace-event.h"
 
-bool latency_format;
-
 struct pevent *read_trace_init(int file_bigendian, int host_bigendian)
 {
 	struct pevent *pevent = pevent_alloc();
tools/perf/util/trace-event.h +0 -1
index 10d6e7b202c5..96ad22f98726 100644
@@ -10,7 +10,6 @@ struct perf_sample;
 union perf_event;
 struct perf_tool;
 
-extern bool latency_format;
 extern struct pevent *perf_pevent;
 
 enum {
Signature · 1 line
1.7.11.7
#29 lore raw

[tip:perf/core] perf script: Adopt latency_format variable

perf script: Adopt latency_format variable
Commit-ID:  47390ae2afb6695c56810a9fc74fb930266addd0
Gitweb:     http://git.kernel.org/tip/47390ae2afb6695c56810a9fc74fb930266addd0
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:28 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:28 -0300

perf script: Adopt latency_format variable

It's the only user of the variable, so move it.

---
 tools/perf/builtin-script.c         | 1 +
 tools/perf/util/trace-event-parse.c | 2 --
 tools/perf/util/trace-event.h       | 1 -
 3 files changed, 1 insertion(+), 3 deletions(-)
tools/perf/builtin-script.c +1 -0
index 92d4658..3de8979 100644
@@ -24,6 +24,7 @@ static u64			last_timestamp;
 static u64			nr_unordered;
 extern const struct option	record_options[];
 static bool			no_callchain;
+static bool			latency_format;
 static bool			system_wide;
 static const char		*cpu_list;
 static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
tools/perf/util/trace-event-parse.c +0 -2
index 0deae88..fe7a27d 100644
@@ -28,8 +28,6 @@
 #include "util.h"
 #include "trace-event.h"
 
-bool latency_format;
-
 struct pevent *read_trace_init(int file_bigendian, int host_bigendian)
 {
 	struct pevent *pevent = pevent_alloc();
tools/perf/util/trace-event.h +0 -1
index 761c484..ed30c9c 100644
@@ -10,7 +10,6 @@ struct perf_sample;
 union perf_event;
 struct perf_tool;
 
-extern bool latency_format;
 extern struct pevent *perf_pevent;
 
 enum {
author maintainer
#30 lore raw

PATCH 14/16 perf util: Rename read_*() functions in trace-event-info.c

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

It's confusing to have same name for two difference functions which does something opposite way. Since what they do in this file is read *AND* writing some of tracing metadata files, rename them to record_*() looks better to me.

---
 tools/perf/util/trace-event-info.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
tools/perf/util/trace-event-info.c +10 -10
index 3917eb9a8479..9648175e2a1c 100644
@@ -160,7 +160,7 @@ out:
 	return err;
 }
 
-static int read_header_files(void)
+static int record_header_files(void)
 {
 	char *path;
 	struct stat st;
@@ -299,7 +299,7 @@ out:
 	return err;
 }
 
-static int read_ftrace_files(struct tracepoint_path *tps)
+static int record_ftrace_files(struct tracepoint_path *tps)
 {
 	char *path;
 	int ret;
@@ -328,7 +328,7 @@ static bool system_in_tp_list(char *sys, struct tracepoint_path *tps)
 	return false;
 }
 
-static int read_event_files(struct tracepoint_path *tps)
+static int record_event_files(struct tracepoint_path *tps)
 {
 	struct dirent *dent;
 	struct stat st;
@@ -403,7 +403,7 @@ out:
 	return err;
 }
 
-static int read_proc_kallsyms(void)
+static int record_proc_kallsyms(void)
 {
 	unsigned int size;
 	const char *path = "/proc/kallsyms";
@@ -421,7 +421,7 @@ static int read_proc_kallsyms(void)
 	return record_file(path, 4);
 }
 
-static int read_ftrace_printk(void)
+static int record_ftrace_printk(void)
 {
 	unsigned int size;
 	char *path;
@@ -583,19 +583,19 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
 	err = tracing_data_header();
 	if (err)
 		goto out;
-	err = read_header_files();
+	err = record_header_files();
 	if (err)
 		goto out;
-	err = read_ftrace_files(tps);
+	err = record_ftrace_files(tps);
 	if (err)
 		goto out;
-	err = read_event_files(tps);
+	err = record_event_files(tps);
 	if (err)
 		goto out;
-	err = read_proc_kallsyms();
+	err = record_proc_kallsyms();
 	if (err)
 		goto out;
-	err = read_ftrace_printk();
+	err = record_ftrace_printk();
 
 out:
 	/*
Signature · 1 line
1.7.11.7
#31 lore raw

[tip:perf/core] perf util: Rename read_*() functions in trace-event-info.c

perf util: Rename read_*() functions in trace-event-info.c
Commit-ID:  077f159d0402ac90a3ea9975f4089a042e0be065
Gitweb:     http://git.kernel.org/tip/077f159d0402ac90a3ea9975f4089a042e0be065
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:29 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:30 -0300

perf util: Rename read_*() functions in trace-event-info.c

It's confusing to have same name for two difference functions which does something opposite way. Since what they do in this file is read *AND* writing some of tracing metadata files, rename them to record_*() looks better to me.

---
 tools/perf/util/trace-event-info.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
tools/perf/util/trace-event-info.c +10 -10
index a42624a..a800f2b 100644
@@ -101,7 +101,7 @@ out:
 	return err;
 }
 
-static int read_header_files(void)
+static int record_header_files(void)
 {
 	char *path;
 	struct stat st;
@@ -240,7 +240,7 @@ out:
 	return err;
 }
 
-static int read_ftrace_files(struct tracepoint_path *tps)
+static int record_ftrace_files(struct tracepoint_path *tps)
 {
 	char *path;
 	int ret;
@@ -269,7 +269,7 @@ static bool system_in_tp_list(char *sys, struct tracepoint_path *tps)
 	return false;
 }
 
-static int read_event_files(struct tracepoint_path *tps)
+static int record_event_files(struct tracepoint_path *tps)
 {
 	struct dirent *dent;
 	struct stat st;
@@ -344,7 +344,7 @@ out:
 	return err;
 }
 
-static int read_proc_kallsyms(void)
+static int record_proc_kallsyms(void)
 {
 	unsigned int size;
 	const char *path = "/proc/kallsyms";
@@ -362,7 +362,7 @@ static int read_proc_kallsyms(void)
 	return record_file(path, 4);
 }
 
-static int read_ftrace_printk(void)
+static int record_ftrace_printk(void)
 {
 	unsigned int size;
 	char *path;
@@ -539,19 +539,19 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
 	err = tracing_data_header();
 	if (err)
 		goto out;
-	err = read_header_files();
+	err = record_header_files();
 	if (err)
 		goto out;
-	err = read_ftrace_files(tps);
+	err = record_ftrace_files(tps);
 	if (err)
 		goto out;
-	err = read_event_files(tps);
+	err = record_event_files(tps);
 	if (err)
 		goto out;
-	err = read_proc_kallsyms();
+	err = record_proc_kallsyms();
 	if (err)
 		goto out;
-	err = read_ftrace_printk();
+	err = record_ftrace_printk();
 
 out:
 	/*
author maintainer
#32 lore raw

PATCH 15/16 perf util: No need to call read_trace_init() in tracing_data_header()

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

It's useless to call the read_trace_init() function at this time as we don't need a returned pevent and it makes me confusing. :)

---
 tools/perf/util/trace-event-info.c | 2 --
 1 file changed, 2 deletions(-)
tools/perf/util/trace-event-info.c +0 -2
index 9648175e2a1c..e85cbcf298f3 100644
@@ -520,8 +520,6 @@ static int tracing_data_header(void)
 	else
 		buf[0] = 0;
 
-	read_trace_init(buf[0], buf[0]);
-
 	if (write(output_fd, buf, 1) != 1)
 		return -1;
 
Signature · 1 line
1.7.11.7
#33 lore raw

[tip:perf/core] perf util: No need to call read_trace_init() in tracing_data_header()

perf util: No need to call read_trace_init() in tracing_data_header()
Commit-ID:  cfd0e8cf7fe7ad6f6c08e23ca4410bd718eeaf0b
Gitweb:     http://git.kernel.org/tip/cfd0e8cf7fe7ad6f6c08e23ca4410bd718eeaf0b
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:30 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:31 -0300

perf util: No need to call read_trace_init() in tracing_data_header()

It's useless to call the read_trace_init() function at this time as we don't need a returned pevent and it makes me confusing. :)

---
 tools/perf/util/trace-event-info.c | 2 --
 1 file changed, 2 deletions(-)
tools/perf/util/trace-event-info.c +0 -2
index a800f2b..f3c9e55 100644
@@ -476,8 +476,6 @@ static int tracing_data_header(void)
 	else
 		buf[0] = 0;
 
-	read_trace_init(buf[0], buf[0]);
-
 	if (write(output_fd, buf, 1) != 1)
 		return -1;
 
author maintainer
#34 lore raw

PATCH 16/16 perf util: Remove unused enum and macro in trace-event.h

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

They're internals of ftrace ring-buffer and not used in perf code directly. As it now resides on libtraceevent/kbuffer.h, just get rid of them.

---
 tools/perf/util/trace-event.h | 10 ----------
 1 file changed, 10 deletions(-)
tools/perf/util/trace-event.h +0 -10
index 96ad22f98726..929baae82f71 100644
@@ -12,16 +12,6 @@ struct perf_tool;
 
 extern struct pevent *perf_pevent;
 
-enum {
-	RINGBUF_TYPE_PADDING		= 29,
-	RINGBUF_TYPE_TIME_EXTEND	= 30,
-	RINGBUF_TYPE_TIME_STAMP		= 31,
-};
-
-#ifndef TS_SHIFT
-#define TS_SHIFT		27
-#endif
-
 int bigendian(void);
 
 struct pevent *read_trace_init(int file_bigendian, int host_bigendian);
Signature · 1 line
1.7.11.7
#35 lore raw

[tip:perf/core] perf util: Remove unused enum and macro in trace-event.h

perf util: Remove unused enum and macro in trace-event.h
Commit-ID:  45a9ee1b3fa2d8c3fb7a0c7e5a7b77281a4239a6
Gitweb:     http://git.kernel.org/tip/45a9ee1b3fa2d8c3fb7a0c7e5a7b77281a4239a6
Author:     Namhyung Kim <[email protected]>
AuthorDate: Tue, 4 Jun 2013 14:20:31 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 12 Jul 2013 13:52:33 -0300

perf util: Remove unused enum and macro in trace-event.h

They're internals of ftrace ring-buffer and not used in perf code directly. As it now resides on libtraceevent/kbuffer.h, just get rid of them.

---
 tools/perf/util/trace-event.h | 10 ----------
 1 file changed, 10 deletions(-)
tools/perf/util/trace-event.h +0 -10
index ed30c9c..669a64a 100644
@@ -12,16 +12,6 @@ struct perf_tool;
 
 extern struct pevent *perf_pevent;
 
-enum {
-	RINGBUF_TYPE_PADDING		= 29,
-	RINGBUF_TYPE_TIME_EXTEND	= 30,
-	RINGBUF_TYPE_TIME_STAMP		= 31,
-};
-
-#ifndef TS_SHIFT
-#define TS_SHIFT		27
-#endif
-
 int bigendian(void);
 
 struct pevent *read_trace_init(int file_bigendian, int host_bigendian);
#36 lore raw
In reply to Namhyung Kim

Ping!

FYI, I rebased the perf/cleanup branch on top of current acme/perf/core.

Thanks,
Namhyung

Quoted 48 lines · Namhyung Kim

Hello,

This patchset is a resend version of previous work and basis of upcoming perf ftrace patchset. Although I saw no issue on this series when I posted earlier, it'd be great if Steve or others take a look at it again and give comments.

I also updated 'perf/cleanup' branch on my tree at:

git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git

Thanks,
Namhyung

Namhyung Kim (16):
tools lib traceevent: Remove unused install targets
tools lib traceevent: Get rid of unused gui target
tools lib traceevent: Add const qualifier to string arguments tools lib traceevent: Add trace_seq_reset()
tools lib traceevent: Add page_size field to pevent
tools lib traceevent: Port kbuffer parser routines
perf util: Save page size in a trace file to pevent
perf util: Save long size of traced system
perf util: Make file/host_bigendian variable local
perf util: Skip reading header_event file
perf util: Parse header_page to get proper long size
perf util: Get rid of unused header_page_* variables
perf util: Move latency_format variable to builtin-script.c perf util: Rename read_*() functions in trace-event-info.c perf util: No need to call read_trace_init() in tracing_data_header() perf util: Remove unused enum and macro in trace-event.h

  tools/lib/traceevent/Makefile        |  18 +-
  tools/lib/traceevent/event-parse.c   |   7 +-
  tools/lib/traceevent/event-parse.h   |  15 +-
  tools/lib/traceevent/kbuffer-parse.c | 732 +++++++++++++++++++++++++++++++++++
  tools/lib/traceevent/kbuffer.h       |  67 ++++
  tools/lib/traceevent/trace-seq.c     |  13 +
  tools/perf/builtin-script.c          |   1 +
  tools/perf/util/trace-event-info.c   |  22 +-
  tools/perf/util/trace-event-parse.c  |   6 -
  tools/perf/util/trace-event-read.c   |  52 ++-
  tools/perf/util/trace-event.h        |  15 -
  11 files changed, 875 insertions(+), 73 deletions(-)

create mode 100644 tools/lib/traceevent/kbuffer-parse.c create mode 100644 tools/lib/traceevent/kbuffer.h

author maintainer
#37 lore raw
In reply to Namhyung Kim

Ping!

Quoted 47 lines · Namhyung Kim

Hello,

This patchset is a resend version of previous work and basis of upcoming perf ftrace patchset. Although I saw no issue on this series when I posted earlier, it'd be great if Steve or others take a look at it again and give comments.

I also updated 'perf/cleanup' branch on my tree at:

git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git

Thanks,
Namhyung

Namhyung Kim (16):
tools lib traceevent: Remove unused install targets
tools lib traceevent: Get rid of unused gui target
tools lib traceevent: Add const qualifier to string arguments tools lib traceevent: Add trace_seq_reset()
tools lib traceevent: Add page_size field to pevent
tools lib traceevent: Port kbuffer parser routines
perf util: Save page size in a trace file to pevent
perf util: Save long size of traced system
perf util: Make file/host_bigendian variable local
perf util: Skip reading header_event file
perf util: Parse header_page to get proper long size
perf util: Get rid of unused header_page_* variables
perf util: Move latency_format variable to builtin-script.c perf util: Rename read_*() functions in trace-event-info.c perf util: No need to call read_trace_init() in tracing_data_header() perf util: Remove unused enum and macro in trace-event.h

 tools/lib/traceevent/Makefile        |  18 +-
 tools/lib/traceevent/event-parse.c   |   7 +-
 tools/lib/traceevent/event-parse.h   |  15 +-
 tools/lib/traceevent/kbuffer-parse.c | 732 +++++++++++++++++++++++++++++++++++
 tools/lib/traceevent/kbuffer.h       |  67 ++++
 tools/lib/traceevent/trace-seq.c     |  13 +
 tools/perf/builtin-script.c          |   1 +
 tools/perf/util/trace-event-info.c   |  22 +-
 tools/perf/util/trace-event-parse.c  |   6 -
 tools/perf/util/trace-event-read.c   |  52 ++-
 tools/perf/util/trace-event.h        |  15 -
 11 files changed, 875 insertions(+), 73 deletions(-)
 create mode 100644 tools/lib/traceevent/kbuffer-parse.c
 create mode 100644 tools/lib/traceevent/kbuffer.h
#38 lore raw

Em Thu, Jul 04, 2013 at 05:39:06PM +0900, Namhyung Kim escreveu:

Quoted 1 line

Ping!

Pong, should be processing these today,

- Arnaldo

Quoted 48 lines · Namhyung Kim
Quoted 47 lines

Hello,

This patchset is a resend version of previous work and basis of upcoming perf ftrace patchset. Although I saw no issue on this series when I posted earlier, it'd be great if Steve or others take a look at it again and give comments.

I also updated 'perf/cleanup' branch on my tree at:

git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git

Thanks,
Namhyung

Namhyung Kim (16):
tools lib traceevent: Remove unused install targets
tools lib traceevent: Get rid of unused gui target
tools lib traceevent: Add const qualifier to string arguments tools lib traceevent: Add trace_seq_reset()
tools lib traceevent: Add page_size field to pevent
tools lib traceevent: Port kbuffer parser routines
perf util: Save page size in a trace file to pevent
perf util: Save long size of traced system
perf util: Make file/host_bigendian variable local
perf util: Skip reading header_event file
perf util: Parse header_page to get proper long size
perf util: Get rid of unused header_page_* variables
perf util: Move latency_format variable to builtin-script.c perf util: Rename read_*() functions in trace-event-info.c perf util: No need to call read_trace_init() in tracing_data_header() perf util: Remove unused enum and macro in trace-event.h

 tools/lib/traceevent/Makefile        |  18 +-
 tools/lib/traceevent/event-parse.c   |   7 +-
 tools/lib/traceevent/event-parse.h   |  15 +-
 tools/lib/traceevent/kbuffer-parse.c | 732 +++++++++++++++++++++++++++++++++++
 tools/lib/traceevent/kbuffer.h       |  67 ++++
 tools/lib/traceevent/trace-seq.c     |  13 +
 tools/perf/builtin-script.c          |   1 +
 tools/perf/util/trace-event-info.c   |  22 +-
 tools/perf/util/trace-event-parse.c  |   6 -
 tools/perf/util/trace-event-read.c   |  52 ++-
 tools/perf/util/trace-event.h        |  15 -
 11 files changed, 875 insertions(+), 73 deletions(-)
 create mode 100644 tools/lib/traceevent/kbuffer-parse.c
 create mode 100644 tools/lib/traceevent/kbuffer.h
author maintainer
#39 lore raw
Quoted 4 lines · Arnaldo Carvalho de Melo

Em Thu, Jul 04, 2013 at 05:39:06PM +0900, Namhyung Kim escreveu:

Quoted 1 line

Ping!

Pong, should be processing these today,

Great!

Thanks,
Namhyung

#40 lore raw
In reply to Namhyung Kim

Em Tue, Jun 04, 2013 at 02:20:15PM +0900, Namhyung Kim escreveu:

Quoted 6 lines

Hello,

This patchset is a resend version of previous work and basis of upcoming perf ftrace patchset. Although I saw no issue on this series when I posted earlier, it'd be great if Steve or others take a look at it again and give comments.

All seems ok, thanks a lot, applied.

- Arnaldo