lkml.org 
[lkml]   [2015]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V6 05/25] perf record: Add basic AUX area tracing support
On Mon, Mar 16, 2015 at 02:41:27PM +0200, Adrian Hunter wrote:
> Amend the perf record tool to read the
> AUX area tracing mmap and synthesize
> AUX area tracing events.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> tools/perf/builtin-record.c | 80 ++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 76 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 5a2ff51..8b3a50e 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -27,6 +27,7 @@
> #include "util/cpumap.h"
> #include "util/thread_map.h"
> #include "util/data.h"
> +#include "util/auxtrace.h"
>
> #include <unistd.h>
> #include <sched.h>
> @@ -38,6 +39,7 @@ struct record {
> struct record_opts opts;
> u64 bytes_written;
> struct perf_data_file file;
> + struct auxtrace_record *itr;
> struct perf_evlist *evlist;
> struct perf_session *session;
> const char *progname;
> @@ -110,6 +112,43 @@ out:
> return rc;
> }
>
> +static int record__process_auxtrace(struct perf_tool *tool,
> + union perf_event *event, void *data1,
> + size_t len1, void *data2, size_t len2)
> +{
> + struct record *rec = container_of(tool, struct record, tool);
> + size_t padding;
> + u8 pad[8] = {0};
> +
> + /* event.auxtrace.size includes padding, see __auxtrace_mmap__read() */
> + padding = (len1 + len2) & 7;
> + if (padding)
> + padding = 8 - padding;
> +
> + record__write(rec, event, event->header.size);
> + record__write(rec, data1, len1);
> + record__write(rec, data2, len2);

record__write goes quite deep down the stack before it realizes
there's nothing to write (len2 == 0) which I'm guessing is the
likely case for data2/len2 (buffer wrap around) ?

maybe you want to check on that before calling that

jirka


\
 
 \ /
  Last update: 2015-03-24 12:21    [W:0.149 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site