linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET 00/10] perf util: More cleanups on tracepoint handling
@ 2013-04-15  5:11 Namhyung Kim
  2013-04-15  5:11 ` [PATCH 01/10] perf util: Save page size in a trace file to pevent Namhyung Kim
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-04-15  5:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

Hello,

It seems some code that handle tracepoint events left unchanged when
they were copied from the trace-cmd.  This series tries to cleanup
them by removing unnecessary function calls and variables and filling
up some missing pieces.

It's based on my previous patchset on libtraceevent [1] and contains a
user of the new pevent_set_page_size() API too. :)

You can get this from 'perf/cleanup' branch on my tree at:

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


Any comments are welcome, thanks.
Namhyung


[1] https://lkml.org/lkml/2013/4/11/194


Namhyung Kim (10):
  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/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  | 49 +++++++++++++++++++++----------------
 tools/perf/util/trace-event.h       | 15 ------------
 5 files changed, 39 insertions(+), 54 deletions(-)

-- 
1.7.11.7


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

* [PATCH 01/10] perf util: Save page size in a trace file to pevent
  2013-04-15  5:11 [PATCHSET 00/10] perf util: More cleanups on tracepoint handling Namhyung Kim
@ 2013-04-15  5:11 ` Namhyung Kim
  2013-04-15  5:11 ` [PATCH 02/10] perf util: Save long size of traced system Namhyung Kim
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-04-15  5:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

From: Namhyung Kim <namhyung.kim@lge.com>

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

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/trace-event-read.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index af215c0d2379..c6b491bcb8cd 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -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;
-- 
1.7.11.7


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

* [PATCH 02/10] perf util: Save long size of traced system
  2013-04-15  5:11 [PATCHSET 00/10] perf util: More cleanups on tracepoint handling Namhyung Kim
  2013-04-15  5:11 ` [PATCH 01/10] perf util: Save page size in a trace file to pevent Namhyung Kim
@ 2013-04-15  5:11 ` Namhyung Kim
  2013-04-15  5:11 ` [PATCH 03/10] perf util: Make file/host_bigendian variable local Namhyung Kim
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-04-15  5:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

From: Namhyung Kim <namhyung.kim@lge.com>

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

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/trace-event-read.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index c6b491bcb8cd..6166294d7f22 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -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);
-- 
1.7.11.7


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

* [PATCH 03/10] perf util: Make file/host_bigendian variable local
  2013-04-15  5:11 [PATCHSET 00/10] perf util: More cleanups on tracepoint handling Namhyung Kim
  2013-04-15  5:11 ` [PATCH 01/10] perf util: Save page size in a trace file to pevent Namhyung Kim
  2013-04-15  5:11 ` [PATCH 02/10] perf util: Save long size of traced system Namhyung Kim
@ 2013-04-15  5:11 ` Namhyung Kim
  2013-04-15  5:11 ` [PATCH 04/10] perf util: Skip reading header_event file Namhyung Kim
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-04-15  5:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

From: Namhyung Kim <namhyung.kim@lge.com>

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

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/trace-event-read.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index 6166294d7f22..0dd9fbda88eb 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -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;
-- 
1.7.11.7


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

* [PATCH 04/10] perf util: Skip reading header_event file
  2013-04-15  5:11 [PATCHSET 00/10] perf util: More cleanups on tracepoint handling Namhyung Kim
                   ` (2 preceding siblings ...)
  2013-04-15  5:11 ` [PATCH 03/10] perf util: Make file/host_bigendian variable local Namhyung Kim
@ 2013-04-15  5:11 ` Namhyung Kim
  2013-04-15  5:11 ` [PATCH 05/10] perf util: Parse header_page to get proper long size Namhyung Kim
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-04-15  5:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

From: Namhyung Kim <namhyung.kim@lge.com>

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

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/trace-event-read.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index 0dd9fbda88eb..fa45fca2a2d3 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -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;
 }
 
-- 
1.7.11.7


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

* [PATCH 05/10] perf util: Parse header_page to get proper long size
  2013-04-15  5:11 [PATCHSET 00/10] perf util: More cleanups on tracepoint handling Namhyung Kim
                   ` (3 preceding siblings ...)
  2013-04-15  5:11 ` [PATCH 04/10] perf util: Skip reading header_event file Namhyung Kim
@ 2013-04-15  5:11 ` Namhyung Kim
  2013-04-17  3:59   ` [PATCH v2 " Namhyung Kim
  2013-04-15  5:11 ` [PATCH 06/10] perf util: Get rid of unused header_page_* variables Namhyung Kim
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 12+ messages in thread
From: Namhyung Kim @ 2013-04-15  5:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

From: Namhyung Kim <namhyung.kim@lge.com>

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.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/trace-event-read.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index fa45fca2a2d3..b4e8bdd13671 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -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,23 @@ static int read_header_files(struct pevent *pevent)
 	}
 
 	size = read8(pevent);
-	skip(size);
+
+	if (do_read(buf, size) < 0)
+		return -1;
+
+	header_page = malloc(size);
+	if (header_page == NULL)
+		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;
-- 
1.7.11.7


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

* [PATCH 06/10] perf util: Get rid of unused header_page_* variables
  2013-04-15  5:11 [PATCHSET 00/10] perf util: More cleanups on tracepoint handling Namhyung Kim
                   ` (4 preceding siblings ...)
  2013-04-15  5:11 ` [PATCH 05/10] perf util: Parse header_page to get proper long size Namhyung Kim
@ 2013-04-15  5:11 ` Namhyung Kim
  2013-04-15  5:11 ` [PATCH 07/10] perf util: Move latency_format variable to builtin-script.c Namhyung Kim
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-04-15  5:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

From: Namhyung Kim <namhyung.kim@lge.com>

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

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/trace-event-parse.c | 4 ----
 tools/perf/util/trace-event.h       | 4 ----
 2 files changed, 8 deletions(-)

diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 4454835a9ebc..0deae885c7ba 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -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)
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 1978c398ad87..10d6e7b202c5 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -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;
 
-- 
1.7.11.7


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

* [PATCH 07/10] perf util: Move latency_format variable to builtin-script.c
  2013-04-15  5:11 [PATCHSET 00/10] perf util: More cleanups on tracepoint handling Namhyung Kim
                   ` (5 preceding siblings ...)
  2013-04-15  5:11 ` [PATCH 06/10] perf util: Get rid of unused header_page_* variables Namhyung Kim
@ 2013-04-15  5:11 ` Namhyung Kim
  2013-04-15  5:11 ` [PATCH 08/10] perf util: Rename read_*() functions in trace-event-info.c Namhyung Kim
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-04-15  5:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

From: Namhyung Kim <namhyung.kim@lge.com>

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

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 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(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 92d4658f56fb..3de8979fe87d 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -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);
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 0deae885c7ba..fe7a27d67d2b 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -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();
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 10d6e7b202c5..96ad22f98726 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -10,7 +10,6 @@ struct perf_sample;
 union perf_event;
 struct perf_tool;
 
-extern bool latency_format;
 extern struct pevent *perf_pevent;
 
 enum {
-- 
1.7.11.7


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

* [PATCH 08/10] perf util: Rename read_*() functions in trace-event-info.c
  2013-04-15  5:11 [PATCHSET 00/10] perf util: More cleanups on tracepoint handling Namhyung Kim
                   ` (6 preceding siblings ...)
  2013-04-15  5:11 ` [PATCH 07/10] perf util: Move latency_format variable to builtin-script.c Namhyung Kim
@ 2013-04-15  5:11 ` Namhyung Kim
  2013-04-15  5:11 ` [PATCH 09/10] perf util: No need to call read_trace_init() in tracing_data_header() Namhyung Kim
  2013-04-15  5:11 ` [PATCH 10/10] perf util: Remove unused enum and macro in trace-event.h Namhyung Kim
  9 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-04-15  5:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

From: Namhyung Kim <namhyung.kim@lge.com>

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.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/trace-event-info.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 3917eb9a8479..9648175e2a1c 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -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:
 	/*
-- 
1.7.11.7


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

* [PATCH 09/10] perf util: No need to call read_trace_init() in tracing_data_header()
  2013-04-15  5:11 [PATCHSET 00/10] perf util: More cleanups on tracepoint handling Namhyung Kim
                   ` (7 preceding siblings ...)
  2013-04-15  5:11 ` [PATCH 08/10] perf util: Rename read_*() functions in trace-event-info.c Namhyung Kim
@ 2013-04-15  5:11 ` Namhyung Kim
  2013-04-15  5:11 ` [PATCH 10/10] perf util: Remove unused enum and macro in trace-event.h Namhyung Kim
  9 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-04-15  5:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

From: Namhyung Kim <namhyung.kim@lge.com>

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. :)

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/trace-event-info.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 9648175e2a1c..e85cbcf298f3 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -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;
 
-- 
1.7.11.7


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

* [PATCH 10/10] perf util: Remove unused enum and macro in trace-event.h
  2013-04-15  5:11 [PATCHSET 00/10] perf util: More cleanups on tracepoint handling Namhyung Kim
                   ` (8 preceding siblings ...)
  2013-04-15  5:11 ` [PATCH 09/10] perf util: No need to call read_trace_init() in tracing_data_header() Namhyung Kim
@ 2013-04-15  5:11 ` Namhyung Kim
  9 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-04-15  5:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

From: Namhyung Kim <namhyung.kim@lge.com>

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.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/trace-event.h | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 96ad22f98726..929baae82f71 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -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);
-- 
1.7.11.7


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

* [PATCH v2 05/10] perf util: Parse header_page to get proper long size
  2013-04-15  5:11 ` [PATCH 05/10] perf util: Parse header_page to get proper long size Namhyung Kim
@ 2013-04-17  3:59   ` Namhyung Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2013-04-17  3:59 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
	Steven Rostedt, Frederic Weisbecker

From: Namhyung Kim <namhyung.kim@lge.com>

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.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
It should read into header_page not buf.

 tools/perf/util/trace-event-read.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index fa45fca2a2d3..f2112270c663 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -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;
-- 
1.7.11.7


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

end of thread, other threads:[~2013-04-17  3:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-15  5:11 [PATCHSET 00/10] perf util: More cleanups on tracepoint handling Namhyung Kim
2013-04-15  5:11 ` [PATCH 01/10] perf util: Save page size in a trace file to pevent Namhyung Kim
2013-04-15  5:11 ` [PATCH 02/10] perf util: Save long size of traced system Namhyung Kim
2013-04-15  5:11 ` [PATCH 03/10] perf util: Make file/host_bigendian variable local Namhyung Kim
2013-04-15  5:11 ` [PATCH 04/10] perf util: Skip reading header_event file Namhyung Kim
2013-04-15  5:11 ` [PATCH 05/10] perf util: Parse header_page to get proper long size Namhyung Kim
2013-04-17  3:59   ` [PATCH v2 " Namhyung Kim
2013-04-15  5:11 ` [PATCH 06/10] perf util: Get rid of unused header_page_* variables Namhyung Kim
2013-04-15  5:11 ` [PATCH 07/10] perf util: Move latency_format variable to builtin-script.c Namhyung Kim
2013-04-15  5:11 ` [PATCH 08/10] perf util: Rename read_*() functions in trace-event-info.c Namhyung Kim
2013-04-15  5:11 ` [PATCH 09/10] perf util: No need to call read_trace_init() in tracing_data_header() Namhyung Kim
2013-04-15  5:11 ` [PATCH 10/10] perf util: Remove unused enum and macro in trace-event.h 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).