Skip to contentSkip to conversation

tools lib traceevent: Remove unused install targets

PATCH In review Namhyung Kim 3 participants 14 messages Apr 11, 2013 – Apr 13, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 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.

Cc Steven Rostedt <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
#1 lore raw

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

From: Namhyung Kim <[email protected]>

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

Cc Steven Rostedt <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
#2 lore raw

PATCH 3/6 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.

Cc Steven Rostedt <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
#3 lore raw

PATCH 4/6 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.

Cc Steven Rostedt <[email protected]>
Cc Frederic Weisbecker <[email protected]>
---
 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
#4 lore raw

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

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

It's for saving the page size of traced system.

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
#5 lore raw

Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent

Quoted 3 lines · Namhyung Kim

From: Namhyung Kim <[email protected]>

It's for saving the page size of traced system.

Can you add a bit more detail in the change log about why this patch is necessary.

Thanks,

-- Steve

Quoted 37 lines
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;
#6 lore raw

Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent

Quoted 7 lines · Steven Rostedt
Quoted 3 lines · Namhyung Kim

From: Namhyung Kim <[email protected]>

It's for saving the page size of traced system.

Can you add a bit more detail in the change log about why this patch is necessary.

For now, you can add my

for all but this patch.

I just want to know more about this patch before I ack it.

Thanks,

-- Steve

#7 lore raw

Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent

Hi Steve,

2013-04-11 (목), 10:40 -0400, Steven Rostedt:

Quoted 6 lines · Steven Rostedt
Quoted 5 lines · Namhyung Kim
Quoted 3 lines

From: Namhyung Kim <[email protected]>

It's for saving the page size of traced system.

Quoted 8 lines
Quoted 2 lines

Can you add a bit more detail in the change log about why this patch is necessary.

For now, you can add my

for all but this patch.

Thanks!

Quoted 2 lines

I just want to know more about this patch before I ack it.

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.

Thanks,
Namhyung

#8 lore raw

Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent

Quoted 7 lines · Namhyung Kim
Quoted 2 lines

I just want to know more about this patch before I ack it.

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.

I understand that, it's just strange that it's not used anywhere in the library, or the patch series (that I can find).

It would make more sense if another patch used this new interface. I'm sure new code will, but the patch should be part of a patch series that needs it.

Thanks,

-- Steve

#9 lore raw

Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent

2013-04-12 (금), 21:26 -0400, Steven Rostedt:

Quoted 10 lines · Namhyung Kim
Quoted 8 lines
Quoted 3 lines

I just want to know more about this patch before I ack it.

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.

Quoted 6 lines

I understand that, it's just strange that it's not used anywhere in the library, or the patch series (that I can find).

It would make more sense if another patch used this new interface. I'm sure new code will, but the patch should be part of a patch series that needs it.

I know you knew that already. :)

I think it only affects trace-cmd as it's the only user that accesses raw ring-buffer contents for now. I found it during writing code also accesses the ring buffer (with kbuffer code) - perf ftrace. :)

But the code is in a very early stage and needs to handle so many things before posting to the list. So I just wanted to post a part of the preparation first.

Thanks,
Namhyung

#10 lore raw

Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent

Quoted 9 lines · Namhyung Kim

2013-04-12 (금), 21:26 -0400, Steven Rostedt:

I think it only affects trace-cmd as it's the only user that accesses raw ring-buffer contents for now. I found it during writing code also accesses the ring buffer (with kbuffer code) - perf ftrace. :)

But the code is in a very early stage and needs to handle so many things before posting to the list. So I just wanted to post a part of the preparation first.

I understand. But people tend to not like things in upstream that has no user. If Arnaldo wants to include it, that's his decision. I'm just worried that if it takes a while before your other work gets mainline, people might start sending patches to remove that code and your stuff will suddenly break.

-- Steve

#11 lore raw

Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent

2013-04-12 (금), 22:14 -0400, Steven Rostedt:

Quoted 11 lines · Namhyung Kim
Quoted 9 lines

2013-04-12 (금), 21:26 -0400, Steven Rostedt:

I think it only affects trace-cmd as it's the only user that accesses raw ring-buffer contents for now. I found it during writing code also accesses the ring buffer (with kbuffer code) - perf ftrace. :)

But the code is in a very early stage and needs to handle so many things before posting to the list. So I just wanted to post a part of the preparation first.

Quoted 5 lines

I understand. But people tend to not like things in upstream that has no user. If Arnaldo wants to include it, that's his decision. I'm just worried that if it takes a while before your other work gets mainline, people might start sending patches to remove that code and your stuff will suddenly break.

Fair enough.

Arnaldo, what do you think? Do you want me to resend it with new description now?

Thanks,
Namhyung

#12 lore raw

Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent

In reply to Namhyung Kim

Em Sat, Apr 13, 2013 at 10:17:26AM +0900, Namhyung Kim escreveu:

Quoted 6 lines
Quoted 1 line

I just want to know more about this patch before I ack it.

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.

Excellent explanation! So good it deserves being in the changelog commit!

8-)

- Arnaldo

#13 lore raw

PATCH 6/6 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