lkml.org 
[lkml]   [2015]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 03/52] perf tools: Add thread_map event
Em Mon, Oct 26, 2015 at 02:42:06PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Sun, Oct 25, 2015 at 03:51:19PM +0100, Jiri Olsa escreveu:
> > Adding thread_map event to pass/store thread maps
> > as data in pipe/perf.data.
> >
> > Storing thread ID along with the standard comm[16]
> > thread name string.
> >
> > Link: http://lkml.kernel.org/n/tip-2l07qyf3buhnt83q4ezqz5sj@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/perf/util/event.c | 1 +
> > tools/perf/util/event.h | 13 +++++++++++++
> > tools/perf/util/session.c | 26 ++++++++++++++++++++++++++
> > tools/perf/util/tool.h | 3 ++-
> > 4 files changed, 42 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> > index 8b10621b415c..771545a27b9b 100644
> > --- a/tools/perf/util/event.c
> > +++ b/tools/perf/util/event.c
> > @@ -37,6 +37,7 @@ static const char *perf_event__names[] = {
> > [PERF_RECORD_AUXTRACE_INFO] = "AUXTRACE_INFO",
> > [PERF_RECORD_AUXTRACE] = "AUXTRACE",
> > [PERF_RECORD_AUXTRACE_ERROR] = "AUXTRACE_ERROR",
> > + [PERF_RECORD_THREAD_MAP] = "THREAD_MAP",
> > };
> >
> > const char *perf_event__name(unsigned int id)
> > diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> > index a0dbcbd4f6d8..f075f9ed0051 100644
> > --- a/tools/perf/util/event.h
> > +++ b/tools/perf/util/event.h
> > @@ -226,6 +226,7 @@ enum perf_user_event_type { /* above any possible kernel type */
> > PERF_RECORD_AUXTRACE_INFO = 70,
> > PERF_RECORD_AUXTRACE = 71,
> > PERF_RECORD_AUXTRACE_ERROR = 72,
> > + PERF_RECORD_THREAD_MAP = 73,
> > PERF_RECORD_HEADER_MAX
> > };
> >
> > @@ -356,6 +357,17 @@ struct context_switch_event {
> > u32 next_prev_tid;
> > };
> >
> > +struct thread_map_data_event {
>
> Humm, I think "data" here is way too vague here, how about
> "thread_map_event_entry"?
>
> Moving of "entry" to the end also helps in understanding that this is
> not an "event" per se, it doesn't have the perv_event_header, etc, its
> just an entry in a 'struct thread_map_event'.
>
> I'm tentatively doing this change in my local branch, please let me know
> if you have any reason to object to such a change,

The resulting patch, that I'm merging with this one:

diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index f075f9ed0051..66f303e69c4d 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -357,7 +357,7 @@ struct context_switch_event {
u32 next_prev_tid;
};

-struct thread_map_data_event {
+struct thread_map_event_entry {
u64 pid;
char comm[16];
};
@@ -365,7 +365,7 @@ struct thread_map_data_event {
struct thread_map_event {
struct perf_event_header header;
u64 nr;
- struct thread_map_data_event data[];
+ struct thread_map_event_entry entries[];
};

union perf_event {
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index ec1ecd31003b..0aedce61f930 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -636,7 +636,7 @@ static void perf_event__thread_map_swap(union perf_event *event,
event->thread_map.nr = bswap_64(event->thread_map.nr);

for (i = 0; i < event->thread_map.nr; i++)
- event->thread_map.data[i].pid = bswap_64(event->thread_map.data[i].pid);
+ event->thread_map.entries[i].pid = bswap_64(event->thread_map.entries[i].pid);
}

typedef void (*perf_event__swap_op)(union perf_event *event,

\
 
 \ /
  Last update: 2015-10-26 19:01    [W:0.150 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site