[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20130718142641.GA4406@krava.brq.redhat.com>
Date: Thu, 18 Jul 2013 16:26:41 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: linux-kernel@...r.kernel.org,
Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...e.hu>,
Namhyung Kim <namhyung@...nel.org>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Andi Kleen <ak@...ux.intel.com>,
David Ahern <dsahern@...il.com>
Subject: Re: [PATCH 05/23] perf tests: Add simple session read/write test
On Wed, Jul 17, 2013 at 04:33:13PM -0300, Arnaldo Carvalho de Melo wrote:
SNIP
> > +
> > +static union perf_event *get_event_MMAP(void)
> > +{
> > + static union perf_event event;
> > + size_t size;
> > +
> > + size = snprintf(event.mmap.filename, sizeof(event.mmap.filename),
> > + "krava") + 1;
> > + size = PERF_ALIGN(size, sizeof(u64));
> > +
> > + event.header.type = PERF_RECORD_MMAP;
> > + event.header.misc = PERF_RECORD_MISC_KERNEL;
> > + event.header.size = sizeof(event.mmap) -
> > + (sizeof(event.mmap.filename) - size);
> > +
> > + event.mmap.pgoff = 10;
> > + event.mmap.start = 0;
> > + event.mmap.len = 10;
> > + event.mmap.pid = 123;
> > +
> > + return &event;
> > +}
>
> Don't use statics, here perhaps we can have another general purpose
> helper:
>
> void perf_event__init_mmap(union perf_event *event)
well, the thing is that it makes the test simple, I can use it like:
TEST_ASSERT_VAL("failed to store MMAP event",
!store_event(fd, get_event_MMAP(), &size));
no need to call extra functions, just get the single event
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists