* [PATCH 1/6] tools lib traceevent: Remove unused install targets
@ 2013-04-11 12:04 Namhyung Kim
2013-04-11 12:04 ` [PATCH 2/6] tools lib traceevent: Get rid of unused gui target Namhyung Kim
` (4 more replies)
0 siblings, 5 replies; 14+ messages in thread
From: Namhyung Kim @ 2013-04-11 12:04 UTC (permalink / raw)
To: Steven Rostedt, Arnaldo Carvalho de Melo
Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, Namhyung Kim,
LKML, Steven Rostedt
From: Namhyung Kim <namhyung.kim@lge.com>
The html_install, img_install, install_plugin and install_python are
unused in the Makefile. Get rid of them.
Cc: Steven Rostedt <rostedt@goodmig.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/traceevent/Makefile | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 0b0a90787db6..fd7510d99583 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -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
--
1.7.11.7
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/6] tools lib traceevent: Get rid of unused gui target
2013-04-11 12:04 [PATCH 1/6] tools lib traceevent: Remove unused install targets Namhyung Kim
@ 2013-04-11 12:04 ` Namhyung Kim
2013-04-11 12:04 ` [PATCH 3/6] tools lib traceevent: Add const qualifier to string arguments Namhyung Kim
` (3 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Namhyung Kim @ 2013-04-11 12:04 UTC (permalink / raw)
To: Steven Rostedt, Arnaldo Carvalho de Melo
Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, Namhyung Kim,
LKML
From: Namhyung Kim <namhyung.kim@lge.com>
It's came from trace-cmd's kernelshark which is not a part of
libtraceevent.
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/traceevent/Makefile | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index fd7510d99583..4505de874929 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -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)
--
1.7.11.7
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/6] tools lib traceevent: Add const qualifier to string arguments
2013-04-11 12:04 [PATCH 1/6] tools lib traceevent: Remove unused install targets Namhyung Kim
2013-04-11 12:04 ` [PATCH 2/6] tools lib traceevent: Get rid of unused gui target Namhyung Kim
@ 2013-04-11 12:04 ` Namhyung Kim
2013-04-11 12:04 ` [PATCH 4/6] tools lib traceevent: Add trace_seq_reset() Namhyung Kim
` (2 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Namhyung Kim @ 2013-04-11 12:04 UTC (permalink / raw)
To: Steven Rostedt, Arnaldo Carvalho de Melo
Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, Namhyung Kim,
LKML
From: Namhyung Kim <namhyung.kim@lge.com>
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 <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/traceevent/event-parse.c | 7 +++----
tools/lib/traceevent/event-parse.h | 3 ++-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 82b0606dcb8a..d1c2a6a4cd32 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -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;
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 7be7e89533e4..bfceab948f22 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -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,
--
1.7.11.7
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/6] tools lib traceevent: Add trace_seq_reset()
2013-04-11 12:04 [PATCH 1/6] tools lib traceevent: Remove unused install targets Namhyung Kim
2013-04-11 12:04 ` [PATCH 2/6] tools lib traceevent: Get rid of unused gui target Namhyung Kim
2013-04-11 12:04 ` [PATCH 3/6] tools lib traceevent: Add const qualifier to string arguments Namhyung Kim
@ 2013-04-11 12:04 ` Namhyung Kim
2013-04-11 12:04 ` [PATCH 5/6] tools lib traceevent: Add page_size field to pevent Namhyung Kim
2013-04-11 12:04 ` [PATCH 6/6] tools lib traceevent: Port kbuffer parser routines Namhyung Kim
4 siblings, 0 replies; 14+ messages in thread
From: Namhyung Kim @ 2013-04-11 12:04 UTC (permalink / raw)
To: Steven Rostedt, Arnaldo Carvalho de Melo
Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, Namhyung Kim,
LKML
From: Namhyung Kim <namhyung.kim@lge.com>
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 <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/traceevent/event-parse.h | 1 +
tools/lib/traceevent/trace-seq.c | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index bfceab948f22..39f0c1dca915 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -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, ...)
diff --git a/tools/lib/traceevent/trace-seq.c b/tools/lib/traceevent/trace-seq.c
index a57db805136a..d7f2e68bc5b9 100644
--- a/tools/lib/traceevent/trace-seq.c
+++ b/tools/lib/traceevent/trace-seq.c
@@ -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
*
--
1.7.11.7
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/6] tools lib traceevent: Add page_size field to pevent
2013-04-11 12:04 [PATCH 1/6] tools lib traceevent: Remove unused install targets Namhyung Kim
` (2 preceding siblings ...)
2013-04-11 12:04 ` [PATCH 4/6] tools lib traceevent: Add trace_seq_reset() Namhyung Kim
@ 2013-04-11 12:04 ` Namhyung Kim
2013-04-11 14:39 ` Steven Rostedt
2013-04-11 12:04 ` [PATCH 6/6] tools lib traceevent: Port kbuffer parser routines Namhyung Kim
4 siblings, 1 reply; 14+ messages in thread
From: Namhyung Kim @ 2013-04-11 12:04 UTC (permalink / raw)
To: Steven Rostedt, Arnaldo Carvalho de Melo
Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, Namhyung Kim,
LKML
From: Namhyung Kim <namhyung.kim@lge.com>
It's for saving the page size of traced system.
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/traceevent/event-parse.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 39f0c1dca915..c37b2026d04a 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -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;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 6/6] tools lib traceevent: Port kbuffer parser routines
2013-04-11 12:04 [PATCH 1/6] tools lib traceevent: Remove unused install targets Namhyung Kim
` (3 preceding siblings ...)
2013-04-11 12:04 ` [PATCH 5/6] tools lib traceevent: Add page_size field to pevent Namhyung Kim
@ 2013-04-11 12:04 ` Namhyung Kim
4 siblings, 0 replies; 14+ messages in thread
From: Namhyung Kim @ 2013-04-11 12:04 UTC (permalink / raw)
To: Steven Rostedt, Arnaldo Carvalho de Melo
Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, Namhyung Kim,
LKML
From: Namhyung Kim <namhyung.kim@lge.com>
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.
Original-patch-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
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
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 4505de874929..0794acca46a3 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -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)
diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c
new file mode 100644
index 000000000000..dcc665228c71
--- /dev/null
+++ b/tools/lib/traceevent/kbuffer-parse.c
@@ -0,0 +1,732 @@
+/*
+ * Copyright (C) 2009, 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License (not later!)
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "kbuffer.h"
+
+#define MISSING_EVENTS (1 << 31)
+#define MISSING_STORED (1 << 30)
+
+#define COMMIT_MASK ((1 << 27) - 1)
+
+enum {
+ KBUFFER_FL_HOST_BIG_ENDIAN = (1<<0),
+ KBUFFER_FL_BIG_ENDIAN = (1<<1),
+ KBUFFER_FL_LONG_8 = (1<<2),
+ KBUFFER_FL_OLD_FORMAT = (1<<3),
+};
+
+#define ENDIAN_MASK (KBUFFER_FL_HOST_BIG_ENDIAN | KBUFFER_FL_BIG_ENDIAN)
+
+/** kbuffer
+ * @timestamp - timestamp of current event
+ * @lost_events - # of lost events between this subbuffer and previous
+ * @flags - special flags of the kbuffer
+ * @subbuffer - pointer to the sub-buffer page
+ * @data - pointer to the start of data on the sub-buffer page
+ * @index - index from @data to the @curr event data
+ * @curr - offset from @data to the start of current event
+ * (includes metadata)
+ * @next - offset from @data to the start of next event
+ * @size - The size of data on @data
+ * @start - The offset from @subbuffer where @data lives
+ *
+ * @read_4 - Function to read 4 raw bytes (may swap)
+ * @read_8 - Function to read 8 raw bytes (may swap)
+ * @read_long - Function to read a long word (4 or 8 bytes with needed swap)
+ */
+struct kbuffer {
+ unsigned long long timestamp;
+ long long lost_events;
+ unsigned long flags;
+ void *subbuffer;
+ void *data;
+ unsigned int index;
+ unsigned int curr;
+ unsigned int next;
+ unsigned int size;
+ unsigned int start;
+
+ unsigned int (*read_4)(void *ptr);
+ unsigned long long (*read_8)(void *ptr);
+ unsigned long long (*read_long)(struct kbuffer *kbuf, void *ptr);
+ int (*next_event)(struct kbuffer *kbuf);
+};
+
+static void *zmalloc(size_t size)
+{
+ return calloc(1, size);
+}
+
+static int host_is_bigendian(void)
+{
+ unsigned char str[] = { 0x1, 0x2, 0x3, 0x4 };
+ unsigned int *ptr;
+
+ ptr = (unsigned int *)str;
+ return *ptr == 0x01020304;
+}
+
+static int do_swap(struct kbuffer *kbuf)
+{
+ return ((kbuf->flags & KBUFFER_FL_HOST_BIG_ENDIAN) + kbuf->flags) &
+ ENDIAN_MASK;
+}
+
+static unsigned long long __read_8(void *ptr)
+{
+ unsigned long long data = *(unsigned long long *)ptr;
+
+ return data;
+}
+
+static unsigned long long __read_8_sw(void *ptr)
+{
+ unsigned long long data = *(unsigned long long *)ptr;
+ unsigned long long swap;
+
+ swap = ((data & 0xffULL) << 56) |
+ ((data & (0xffULL << 8)) << 40) |
+ ((data & (0xffULL << 16)) << 24) |
+ ((data & (0xffULL << 24)) << 8) |
+ ((data & (0xffULL << 32)) >> 8) |
+ ((data & (0xffULL << 40)) >> 24) |
+ ((data & (0xffULL << 48)) >> 40) |
+ ((data & (0xffULL << 56)) >> 56);
+
+ return swap;
+}
+
+static unsigned int __read_4(void *ptr)
+{
+ unsigned int data = *(unsigned int *)ptr;
+
+ return data;
+}
+
+static unsigned int __read_4_sw(void *ptr)
+{
+ unsigned int data = *(unsigned int *)ptr;
+ unsigned int swap;
+
+ swap = ((data & 0xffULL) << 24) |
+ ((data & (0xffULL << 8)) << 8) |
+ ((data & (0xffULL << 16)) >> 8) |
+ ((data & (0xffULL << 24)) >> 24);
+
+ return swap;
+}
+
+static unsigned long long read_8(struct kbuffer *kbuf, void *ptr)
+{
+ return kbuf->read_8(ptr);
+}
+
+static unsigned int read_4(struct kbuffer *kbuf, void *ptr)
+{
+ return kbuf->read_4(ptr);
+}
+
+static unsigned long long __read_long_8(struct kbuffer *kbuf, void *ptr)
+{
+ return kbuf->read_8(ptr);
+}
+
+static unsigned long long __read_long_4(struct kbuffer *kbuf, void *ptr)
+{
+ return kbuf->read_4(ptr);
+}
+
+static unsigned long long read_long(struct kbuffer *kbuf, void *ptr)
+{
+ return kbuf->read_long(kbuf, ptr);
+}
+
+static int calc_index(struct kbuffer *kbuf, void *ptr)
+{
+ return (unsigned long)ptr - (unsigned long)kbuf->data;
+}
+
+static int __next_event(struct kbuffer *kbuf);
+
+/**
+ * kbuffer_alloc - allocat a new kbuffer
+ * @size; enum to denote size of word
+ * @endian: enum to denote endianness
+ *
+ * Allocates and returns a new kbuffer.
+ */
+struct kbuffer *
+kbuffer_alloc(enum kbuffer_long_size size, enum kbuffer_endian endian)
+{
+ struct kbuffer *kbuf;
+ int flags = 0;
+
+ switch (size) {
+ case KBUFFER_LSIZE_4:
+ break;
+ case KBUFFER_LSIZE_8:
+ flags |= KBUFFER_FL_LONG_8;
+ break;
+ default:
+ return NULL;
+ }
+
+ switch (endian) {
+ case KBUFFER_ENDIAN_LITTLE:
+ break;
+ case KBUFFER_ENDIAN_BIG:
+ flags |= KBUFFER_FL_BIG_ENDIAN;
+ break;
+ default:
+ return NULL;
+ }
+
+ kbuf = zmalloc(sizeof(*kbuf));
+ if (!kbuf)
+ return NULL;
+
+ kbuf->flags = flags;
+
+ if (host_is_bigendian())
+ kbuf->flags |= KBUFFER_FL_HOST_BIG_ENDIAN;
+
+ if (do_swap(kbuf)) {
+ kbuf->read_8 = __read_8_sw;
+ kbuf->read_4 = __read_4_sw;
+ } else {
+ kbuf->read_8 = __read_8;
+ kbuf->read_4 = __read_4;
+ }
+
+ if (kbuf->flags & KBUFFER_FL_LONG_8)
+ kbuf->read_long = __read_long_8;
+ else
+ kbuf->read_long = __read_long_4;
+
+ /* May be changed by kbuffer_set_old_format() */
+ kbuf->next_event = __next_event;
+
+ return kbuf;
+}
+
+/** kbuffer_free - free an allocated kbuffer
+ * @kbuf: The kbuffer to free
+ *
+ * Can take NULL as a parameter.
+ */
+void kbuffer_free(struct kbuffer *kbuf)
+{
+ free(kbuf);
+}
+
+static unsigned int type4host(struct kbuffer *kbuf,
+ unsigned int type_len_ts)
+{
+ if (kbuf->flags & KBUFFER_FL_BIG_ENDIAN)
+ return (type_len_ts >> 29) & 3;
+ else
+ return type_len_ts & 3;
+}
+
+static unsigned int len4host(struct kbuffer *kbuf,
+ unsigned int type_len_ts)
+{
+ if (kbuf->flags & KBUFFER_FL_BIG_ENDIAN)
+ return (type_len_ts >> 27) & 7;
+ else
+ return (type_len_ts >> 2) & 7;
+}
+
+static unsigned int type_len4host(struct kbuffer *kbuf,
+ unsigned int type_len_ts)
+{
+ if (kbuf->flags & KBUFFER_FL_BIG_ENDIAN)
+ return (type_len_ts >> 27) & ((1 << 5) - 1);
+ else
+ return type_len_ts & ((1 << 5) - 1);
+}
+
+static unsigned int ts4host(struct kbuffer *kbuf,
+ unsigned int type_len_ts)
+{
+ if (kbuf->flags & KBUFFER_FL_BIG_ENDIAN)
+ return type_len_ts & ((1 << 27) - 1);
+ else
+ return type_len_ts >> 5;
+}
+
+/*
+ * Linux 2.6.30 and earlier (not much ealier) had a different
+ * ring buffer format. It should be obsolete, but we handle it anyway.
+ */
+enum old_ring_buffer_type {
+ OLD_RINGBUF_TYPE_PADDING,
+ OLD_RINGBUF_TYPE_TIME_EXTEND,
+ OLD_RINGBUF_TYPE_TIME_STAMP,
+ OLD_RINGBUF_TYPE_DATA,
+};
+
+static unsigned int old_update_pointers(struct kbuffer *kbuf)
+{
+ unsigned long long extend;
+ unsigned int type_len_ts;
+ unsigned int type;
+ unsigned int len;
+ unsigned int delta;
+ unsigned int length;
+ void *ptr = kbuf->data + kbuf->curr;
+
+ type_len_ts = read_4(kbuf, ptr);
+ ptr += 4;
+
+ type = type4host(kbuf, type_len_ts);
+ len = len4host(kbuf, type_len_ts);
+ delta = ts4host(kbuf, type_len_ts);
+
+ switch (type) {
+ case OLD_RINGBUF_TYPE_PADDING:
+ kbuf->next = kbuf->size;
+ return 0;
+
+ case OLD_RINGBUF_TYPE_TIME_EXTEND:
+ extend = read_4(kbuf, ptr);
+ extend <<= TS_SHIFT;
+ extend += delta;
+ delta = extend;
+ ptr += 4;
+ break;
+
+ case OLD_RINGBUF_TYPE_TIME_STAMP:
+ /* should never happen! */
+ kbuf->curr = kbuf->size;
+ kbuf->next = kbuf->size;
+ kbuf->index = kbuf->size;
+ return -1;
+ default:
+ if (len)
+ length = len * 4;
+ else {
+ length = read_4(kbuf, ptr);
+ length -= 4;
+ ptr += 4;
+ }
+ break;
+ }
+
+ kbuf->timestamp += delta;
+ kbuf->index = calc_index(kbuf, ptr);
+ kbuf->next = kbuf->index + length;
+
+ return type;
+}
+
+static int __old_next_event(struct kbuffer *kbuf)
+{
+ int type;
+
+ do {
+ kbuf->curr = kbuf->next;
+ if (kbuf->next >= kbuf->size)
+ return -1;
+ type = old_update_pointers(kbuf);
+ } while (type == OLD_RINGBUF_TYPE_TIME_EXTEND || type == OLD_RINGBUF_TYPE_PADDING);
+
+ return 0;
+}
+
+static unsigned int
+translate_data(struct kbuffer *kbuf, void *data, void **rptr,
+ unsigned long long *delta, int *length)
+{
+ unsigned long long extend;
+ unsigned int type_len_ts;
+ unsigned int type_len;
+
+ type_len_ts = read_4(kbuf, data);
+ data += 4;
+
+ type_len = type_len4host(kbuf, type_len_ts);
+ *delta = ts4host(kbuf, type_len_ts);
+
+ switch (type_len) {
+ case KBUFFER_TYPE_PADDING:
+ *length = read_4(kbuf, data);
+ data += *length;
+ break;
+
+ case KBUFFER_TYPE_TIME_EXTEND:
+ extend = read_4(kbuf, data);
+ data += 4;
+ extend <<= TS_SHIFT;
+ extend += *delta;
+ *delta = extend;
+ *length = 0;
+ break;
+
+ case KBUFFER_TYPE_TIME_STAMP:
+ data += 12;
+ *length = 0;
+ break;
+ case 0:
+ *length = read_4(kbuf, data) - 4;
+ *length = (*length + 3) & ~3;
+ data += 4;
+ break;
+ default:
+ *length = type_len * 4;
+ break;
+ }
+
+ *rptr = data;
+
+ return type_len;
+}
+
+static unsigned int update_pointers(struct kbuffer *kbuf)
+{
+ unsigned long long delta;
+ unsigned int type_len;
+ int length;
+ void *ptr = kbuf->data + kbuf->curr;
+
+ type_len = translate_data(kbuf, ptr, &ptr, &delta, &length);
+
+ kbuf->timestamp += delta;
+ kbuf->index = calc_index(kbuf, ptr);
+ kbuf->next = kbuf->index + length;
+
+ return type_len;
+}
+
+/**
+ * kbuffer_translate_data - read raw data to get a record
+ * @swap: Set to 1 if bytes in words need to be swapped when read
+ * @data: The raw data to read
+ * @size: Address to store the size of the event data.
+ *
+ * Returns a pointer to the event data. To determine the entire
+ * record size (record metadata + data) just add the difference between
+ * @data and the returned value to @size.
+ */
+void *kbuffer_translate_data(int swap, void *data, unsigned int *size)
+{
+ unsigned long long delta;
+ struct kbuffer kbuf;
+ int type_len;
+ int length;
+ void *ptr;
+
+ if (swap) {
+ kbuf.read_8 = __read_8_sw;
+ kbuf.read_4 = __read_4_sw;
+ kbuf.flags = host_is_bigendian() ? 0 : KBUFFER_FL_BIG_ENDIAN;
+ } else {
+ kbuf.read_8 = __read_8;
+ kbuf.read_4 = __read_4;
+ kbuf.flags = host_is_bigendian() ? KBUFFER_FL_BIG_ENDIAN: 0;
+ }
+
+ type_len = translate_data(&kbuf, data, &ptr, &delta, &length);
+ switch (type_len) {
+ case KBUFFER_TYPE_PADDING:
+ case KBUFFER_TYPE_TIME_EXTEND:
+ case KBUFFER_TYPE_TIME_STAMP:
+ return NULL;
+ };
+
+ *size = length;
+
+ return ptr;
+}
+
+static int __next_event(struct kbuffer *kbuf)
+{
+ int type;
+
+ do {
+ kbuf->curr = kbuf->next;
+ if (kbuf->next >= kbuf->size)
+ return -1;
+ type = update_pointers(kbuf);
+ } while (type == KBUFFER_TYPE_TIME_EXTEND || type == KBUFFER_TYPE_PADDING);
+
+ return 0;
+}
+
+static int next_event(struct kbuffer *kbuf)
+{
+ return kbuf->next_event(kbuf);
+}
+
+/**
+ * kbuffer_next_event - increment the current pointer
+ * @kbuf: The kbuffer to read
+ * @ts: Address to store the next record's timestamp (may be NULL to ignore)
+ *
+ * Increments the pointers into the subbuffer of the kbuffer to point to the
+ * next event so that the next kbuffer_read_event() will return a
+ * new event.
+ *
+ * Returns the data of the next event if a new event exists on the subbuffer,
+ * NULL otherwise.
+ */
+void *kbuffer_next_event(struct kbuffer *kbuf, unsigned long long *ts)
+{
+ int ret;
+
+ if (!kbuf || !kbuf->subbuffer)
+ return NULL;
+
+ ret = next_event(kbuf);
+ if (ret < 0)
+ return NULL;
+
+ if (ts)
+ *ts = kbuf->timestamp;
+
+ return kbuf->data + kbuf->index;
+}
+
+/**
+ * kbuffer_load_subbuffer - load a new subbuffer into the kbuffer
+ * @kbuf: The kbuffer to load
+ * @subbuffer: The subbuffer to load into @kbuf.
+ *
+ * Load a new subbuffer (page) into @kbuf. This will reset all
+ * the pointers and update the @kbuf timestamp. The next read will
+ * return the first event on @subbuffer.
+ *
+ * Returns 0 on succes, -1 otherwise.
+ */
+int kbuffer_load_subbuffer(struct kbuffer *kbuf, void *subbuffer)
+{
+ unsigned long long flags;
+ void *ptr = subbuffer;
+
+ if (!kbuf || !subbuffer)
+ return -1;
+
+ kbuf->subbuffer = subbuffer;
+
+ kbuf->timestamp = read_8(kbuf, ptr);
+ ptr += 8;
+
+ kbuf->curr = 0;
+
+ if (kbuf->flags & KBUFFER_FL_LONG_8)
+ kbuf->start = 16;
+ else
+ kbuf->start = 12;
+
+ kbuf->data = subbuffer + kbuf->start;
+
+ flags = read_long(kbuf, ptr);
+ kbuf->size = (unsigned int)flags & COMMIT_MASK;
+
+ if (flags & MISSING_EVENTS) {
+ if (flags & MISSING_STORED) {
+ ptr = kbuf->data + kbuf->size;
+ kbuf->lost_events = read_long(kbuf, ptr);
+ } else
+ kbuf->lost_events = -1;
+ } else
+ kbuf->lost_events = 0;
+
+ kbuf->index = 0;
+ kbuf->next = 0;
+
+ next_event(kbuf);
+
+ return 0;
+}
+
+/**
+ * kbuffer_read_event - read the next event in the kbuffer subbuffer
+ * @kbuf: The kbuffer to read from
+ * @ts: The address to store the timestamp of the event (may be NULL to ignore)
+ *
+ * Returns a pointer to the data part of the current event.
+ * NULL if no event is left on the subbuffer.
+ */
+void *kbuffer_read_event(struct kbuffer *kbuf, unsigned long long *ts)
+{
+ if (!kbuf || !kbuf->subbuffer)
+ return NULL;
+
+ if (kbuf->curr >= kbuf->size)
+ return NULL;
+
+ if (ts)
+ *ts = kbuf->timestamp;
+ return kbuf->data + kbuf->index;
+}
+
+/**
+ * kbuffer_timestamp - Return the timestamp of the current event
+ * @kbuf: The kbuffer to read from
+ *
+ * Returns the timestamp of the current (next) event.
+ */
+unsigned long long kbuffer_timestamp(struct kbuffer *kbuf)
+{
+ return kbuf->timestamp;
+}
+
+/**
+ * kbuffer_read_at_offset - read the event that is at offset
+ * @kbuf: The kbuffer to read from
+ * @offset: The offset into the subbuffer
+ * @ts: The address to store the timestamp of the event (may be NULL to ignore)
+ *
+ * The @offset must be an index from the @kbuf subbuffer beginning.
+ * If @offset is bigger than the stored subbuffer, NULL will be returned.
+ *
+ * Returns the data of the record that is at @offset. Note, @offset does
+ * not need to be the start of the record, the offset just needs to be
+ * in the record (or beginning of it).
+ *
+ * Note, the kbuf timestamp and pointers are updated to the
+ * returned record. That is, kbuffer_read_event() will return the same
+ * data and timestamp, and kbuffer_next_event() will increment from
+ * this record.
+ */
+void *kbuffer_read_at_offset(struct kbuffer *kbuf, int offset,
+ unsigned long long *ts)
+{
+ void *data;
+
+ if (offset < kbuf->start)
+ offset = 0;
+ else
+ offset -= kbuf->start;
+
+ /* Reset the buffer */
+ kbuffer_load_subbuffer(kbuf, kbuf->subbuffer);
+
+ while (kbuf->curr < offset) {
+ data = kbuffer_next_event(kbuf, ts);
+ if (!data)
+ break;
+ }
+
+ return data;
+}
+
+/**
+ * kbuffer_subbuffer_size - the size of the loaded subbuffer
+ * @kbuf: The kbuffer to read from
+ *
+ * Returns the size of the subbuffer. Note, this size is
+ * where the last event resides. The stored subbuffer may actually be
+ * bigger due to padding and such.
+ */
+int kbuffer_subbuffer_size(struct kbuffer *kbuf)
+{
+ return kbuf->size;
+}
+
+/**
+ * kbuffer_curr_index - Return the index of the record
+ * @kbuf: The kbuffer to read from
+ *
+ * Returns the index from the start of the data part of
+ * the subbuffer to the current location. Note this is not
+ * from the start of the subbuffer. An index of zero will
+ * point to the first record. Use kbuffer_curr_offset() for
+ * the actually offset (that can be used by kbuffer_read_at_offset())
+ */
+int kbuffer_curr_index(struct kbuffer *kbuf)
+{
+ return kbuf->curr;
+}
+
+/**
+ * kbuffer_curr_offset - Return the offset of the record
+ * @kbuf: The kbuffer to read from
+ *
+ * Returns the offset from the start of the subbuffer to the
+ * current location.
+ */
+int kbuffer_curr_offset(struct kbuffer *kbuf)
+{
+ return kbuf->curr + kbuf->start;
+}
+
+/**
+ * kbuffer_event_size - return the size of the event data
+ * @kbuf: The kbuffer to read
+ *
+ * Returns the size of the event data (the payload not counting
+ * the meta data of the record) of the current event.
+ */
+int kbuffer_event_size(struct kbuffer *kbuf)
+{
+ return kbuf->next - kbuf->index;
+}
+
+/**
+ * kbuffer_curr_size - return the size of the entire record
+ * @kbuf: The kbuffer to read
+ *
+ * Returns the size of the entire record (meta data and payload)
+ * of the current event.
+ */
+int kbuffer_curr_size(struct kbuffer *kbuf)
+{
+ return kbuf->next - kbuf->curr;
+}
+
+/**
+ * kbuffer_missed_events - return the # of missed events from last event.
+ * @kbuf: The kbuffer to read from
+ *
+ * Returns the # of missed events (if recorded) before the current
+ * event. Note, only events on the beginning of a subbuffer can
+ * have missed events, all other events within the buffer will be
+ * zero.
+ */
+int kbuffer_missed_events(struct kbuffer *kbuf)
+{
+ /* Only the first event can have missed events */
+ if (kbuf->curr)
+ return 0;
+
+ return kbuf->lost_events;
+}
+
+/**
+ * kbuffer_set_old_forma - set the kbuffer to use the old format parsing
+ * @kbuf: The kbuffer to set
+ *
+ * This is obsolete (or should be). The first kernels to use the
+ * new ring buffer had a slightly different ring buffer format
+ * (2.6.30 and earlier). It is still somewhat supported by kbuffer,
+ * but should not be counted on in the future.
+ */
+void kbuffer_set_old_format(struct kbuffer *kbuf)
+{
+ kbuf->flags |= KBUFFER_FL_OLD_FORMAT;
+
+ kbuf->next_event = __old_next_event;
+}
diff --git a/tools/lib/traceevent/kbuffer.h b/tools/lib/traceevent/kbuffer.h
new file mode 100644
index 000000000000..c831f64b17a0
--- /dev/null
+++ b/tools/lib/traceevent/kbuffer.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License (not later!)
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+#ifndef _KBUFFER_H
+#define _KBUFFER_H
+
+#ifndef TS_SHIFT
+#define TS_SHIFT 27
+#endif
+
+enum kbuffer_endian {
+ KBUFFER_ENDIAN_BIG,
+ KBUFFER_ENDIAN_LITTLE,
+};
+
+enum kbuffer_long_size {
+ KBUFFER_LSIZE_4,
+ KBUFFER_LSIZE_8,
+};
+
+enum {
+ KBUFFER_TYPE_PADDING = 29,
+ KBUFFER_TYPE_TIME_EXTEND = 30,
+ KBUFFER_TYPE_TIME_STAMP = 31,
+};
+
+struct kbuffer;
+
+struct kbuffer *kbuffer_alloc(enum kbuffer_long_size size, enum kbuffer_endian endian);
+void kbuffer_free(struct kbuffer *kbuf);
+int kbuffer_load_subbuffer(struct kbuffer *kbuf, void *subbuffer);
+void *kbuffer_read_event(struct kbuffer *kbuf, unsigned long long *ts);
+void *kbuffer_next_event(struct kbuffer *kbuf, unsigned long long *ts);
+unsigned long long kbuffer_timestamp(struct kbuffer *kbuf);
+
+void *kbuffer_translate_data(int swap, void *data, unsigned int *size);
+
+void *kbuffer_read_at_offset(struct kbuffer *kbuf, int offset, unsigned long long *ts);
+
+int kbuffer_curr_index(struct kbuffer *kbuf);
+
+int kbuffer_curr_offset(struct kbuffer *kbuf);
+int kbuffer_curr_size(struct kbuffer *kbuf);
+int kbuffer_event_size(struct kbuffer *kbuf);
+int kbuffer_missed_events(struct kbuffer *kbuf);
+int kbuffer_subbuffer_size(struct kbuffer *kbuf);
+
+void kbuffer_set_old_format(struct kbuffer *kbuf);
+
+#endif /* _K_BUFFER_H */
--
1.7.11.7
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent
2013-04-11 12:04 ` [PATCH 5/6] tools lib traceevent: Add page_size field to pevent Namhyung Kim
@ 2013-04-11 14:39 ` Steven Rostedt
2013-04-11 14:40 ` Steven Rostedt
0 siblings, 1 reply; 14+ messages in thread
From: Steven Rostedt @ 2013-04-11 14:39 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Frederic Weisbecker, Peter Zijlstra,
Ingo Molnar, Namhyung Kim, LKML
On Thu, 2013-04-11 at 21:04 +0900, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@lge.com>
>
> 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
>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/lib/traceevent/event-parse.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
> index 39f0c1dca915..c37b2026d04a 100644
> --- a/tools/lib/traceevent/event-parse.h
> +++ b/tools/lib/traceevent/event-parse.h
> @@ -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;
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent
2013-04-11 14:39 ` Steven Rostedt
@ 2013-04-11 14:40 ` Steven Rostedt
2013-04-13 1:17 ` Namhyung Kim
0 siblings, 1 reply; 14+ messages in thread
From: Steven Rostedt @ 2013-04-11 14:40 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Frederic Weisbecker, Peter Zijlstra,
Ingo Molnar, Namhyung Kim, LKML
On Thu, 2013-04-11 at 10:39 -0400, Steven Rostedt wrote:
> On Thu, 2013-04-11 at 21:04 +0900, Namhyung Kim wrote:
> > From: Namhyung Kim <namhyung.kim@lge.com>
> >
> > 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
Acked-by: Steven Rostedt <rostedt@goodmis.org>
for all but this patch.
I just want to know more about this patch before I ack it.
Thanks,
-- Steve
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent
2013-04-11 14:40 ` Steven Rostedt
@ 2013-04-13 1:17 ` Namhyung Kim
2013-04-13 1:26 ` Steven Rostedt
2013-04-13 1:27 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 14+ messages in thread
From: Namhyung Kim @ 2013-04-13 1:17 UTC (permalink / raw)
To: Steven Rostedt
Cc: Arnaldo Carvalho de Melo, Frederic Weisbecker, Peter Zijlstra,
Ingo Molnar, Namhyung Kim, LKML
Hi Steve,
2013-04-11 (목), 10:40 -0400, Steven Rostedt:
> On Thu, 2013-04-11 at 10:39 -0400, Steven Rostedt wrote:
> > On Thu, 2013-04-11 at 21:04 +0900, Namhyung Kim wrote:
> > > From: Namhyung Kim <namhyung.kim@lge.com>
> > >
> > > 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
>
> Acked-by: Steven Rostedt <rostedt@goodmis.org>
>
> for all but this patch.
Thanks!
>
> 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent
2013-04-13 1:17 ` Namhyung Kim
@ 2013-04-13 1:26 ` Steven Rostedt
2013-04-13 2:08 ` Namhyung Kim
2013-04-13 1:27 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 14+ messages in thread
From: Steven Rostedt @ 2013-04-13 1:26 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Frederic Weisbecker, Peter Zijlstra,
Ingo Molnar, Namhyung Kim, LKML
On Sat, 2013-04-13 at 10:17 +0900, Namhyung Kim wrote:
> >
> > 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent
2013-04-13 1:17 ` Namhyung Kim
2013-04-13 1:26 ` Steven Rostedt
@ 2013-04-13 1:27 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 14+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-04-13 1:27 UTC (permalink / raw)
To: Namhyung Kim
Cc: Steven Rostedt, Frederic Weisbecker, Peter Zijlstra, Ingo Molnar,
Namhyung Kim, LKML
Em Sat, Apr 13, 2013 at 10:17:26AM +0900, Namhyung Kim escreveu:
> > 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent
2013-04-13 1:26 ` Steven Rostedt
@ 2013-04-13 2:08 ` Namhyung Kim
2013-04-13 2:14 ` Steven Rostedt
0 siblings, 1 reply; 14+ messages in thread
From: Namhyung Kim @ 2013-04-13 2:08 UTC (permalink / raw)
To: Steven Rostedt
Cc: Arnaldo Carvalho de Melo, Frederic Weisbecker, Peter Zijlstra,
Ingo Molnar, Namhyung Kim, LKML
2013-04-12 (금), 21:26 -0400, Steven Rostedt:
> On Sat, 2013-04-13 at 10:17 +0900, Namhyung Kim wrote:
>
> > >
> > > 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.
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent
2013-04-13 2:08 ` Namhyung Kim
@ 2013-04-13 2:14 ` Steven Rostedt
2013-04-13 2:40 ` Namhyung Kim
0 siblings, 1 reply; 14+ messages in thread
From: Steven Rostedt @ 2013-04-13 2:14 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Frederic Weisbecker, Peter Zijlstra,
Ingo Molnar, Namhyung Kim, LKML
On Sat, 2013-04-13 at 11:08 +0900, Namhyung Kim wrote:
> 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/6] tools lib traceevent: Add page_size field to pevent
2013-04-13 2:14 ` Steven Rostedt
@ 2013-04-13 2:40 ` Namhyung Kim
0 siblings, 0 replies; 14+ messages in thread
From: Namhyung Kim @ 2013-04-13 2:40 UTC (permalink / raw)
To: Steven Rostedt
Cc: Arnaldo Carvalho de Melo, Frederic Weisbecker, Peter Zijlstra,
Ingo Molnar, Namhyung Kim, LKML
2013-04-12 (금), 22:14 -0400, Steven Rostedt:
> On Sat, 2013-04-13 at 11:08 +0900, Namhyung Kim wrote:
> > 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.
Fair enough.
Arnaldo, what do you think? Do you want me to resend it with new
description now?
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2013-04-13 2:40 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-11 12:04 [PATCH 1/6] tools lib traceevent: Remove unused install targets Namhyung Kim
2013-04-11 12:04 ` [PATCH 2/6] tools lib traceevent: Get rid of unused gui target Namhyung Kim
2013-04-11 12:04 ` [PATCH 3/6] tools lib traceevent: Add const qualifier to string arguments Namhyung Kim
2013-04-11 12:04 ` [PATCH 4/6] tools lib traceevent: Add trace_seq_reset() Namhyung Kim
2013-04-11 12:04 ` [PATCH 5/6] tools lib traceevent: Add page_size field to pevent Namhyung Kim
2013-04-11 14:39 ` Steven Rostedt
2013-04-11 14:40 ` Steven Rostedt
2013-04-13 1:17 ` Namhyung Kim
2013-04-13 1:26 ` Steven Rostedt
2013-04-13 2:08 ` Namhyung Kim
2013-04-13 2:14 ` Steven Rostedt
2013-04-13 2:40 ` Namhyung Kim
2013-04-13 1:27 ` Arnaldo Carvalho de Melo
2013-04-11 12:04 ` [PATCH 6/6] tools lib traceevent: Port kbuffer parser routines Namhyung Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.