lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150619220531.GA1389@krava.redhat.com>
Date:	Sat, 20 Jun 2015 00:05:31 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:	Jiri Olsa <jolsa@...nel.org>, lkml <linux-kernel@...r.kernel.org>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Andi Kleen <ak@...ux.intel.com>,
	David Ahern <dsahern@...il.com>,
	Ingo Molnar <mingo@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 01/26] perf tools: Change thread_map::map into struct

On Fri, Jun 19, 2015 at 06:07:13PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jun 18, 2015 at 11:48:40PM +0200, Jiri Olsa escreveu:
> > We need to store command names with the pid. Changing
> > map to be struct holding pid. Process name is coming
> > in shortly.
> > 
> > Link: http://lkml.kernel.org/n/tip-z4zuyvcxa6glzqm8qubk6vg7@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> > ---
> >  tools/perf/builtin-trace.c                  |  4 ++--
> >  tools/perf/tests/openat-syscall-tp-fields.c |  2 +-
> >  tools/perf/util/auxtrace.c                  |  4 ++--
> >  tools/perf/util/event.c                     |  6 +++---
> >  tools/perf/util/evlist.c                    |  4 ++--
> >  tools/perf/util/evsel.c                     |  2 +-
> >  tools/perf/util/thread_map.c                | 22 +++++++++++-----------
> >  tools/perf/util/thread_map.h                |  8 +++++++-
> >  8 files changed, 29 insertions(+), 23 deletions(-)
> > 
> > diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> > index 4bf805b2fbf6..b75a68c385ea 100644
> > --- a/tools/perf/builtin-trace.c
> > +++ b/tools/perf/builtin-trace.c
> > @@ -2324,7 +2324,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
> >  	 */
> >  	if (trace->filter_pids.nr > 0)
> >  		err = perf_evlist__set_filter_pids(evlist, trace->filter_pids.nr, trace->filter_pids.entries);
> > -	else if (evlist->threads->map[0] == -1)
> > +	else if (thread_map__pid(evlist->threads, 0) == -1)
> >  		err = perf_evlist__set_filter_pid(evlist, getpid());
> >  
> >  	if (err < 0) {
> > @@ -2342,7 +2342,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
> >  	if (forks)
> >  		perf_evlist__start_workload(evlist);
> >  
> > -	trace->multiple_threads = evlist->threads->map[0] == -1 ||
> > +	trace->multiple_threads = thread_map__pid(evlist->threads, 0) == -1 ||
> >  				  evlist->threads->nr > 1 ||
> >  				  perf_evlist__first(evlist)->attr.inherit;
> >  again:
> > diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c
> > index 6245221479d7..ebc6e7938c9a 100644
> > --- a/tools/perf/tests/openat-syscall-tp-fields.c
> > +++ b/tools/perf/tests/openat-syscall-tp-fields.c
> > @@ -45,7 +45,7 @@ int test__syscall_openat_tp_fields(void)
> >  
> >  	perf_evsel__config(evsel, &opts);
> >  
> > -	evlist->threads->map[0] = getpid();
> > +	thread_map__pid(evlist->threads, 0) = getpid();
> 
> So this 'function(parms) = something' idiom looks ugly/unfamiliar, can't
> we keep using:
> 
> 	evlist->thread->map[0].pid = getpid();

hum, I like it more than above line.. what's ugly about that assignment?

I'm adding thread_map__comm to access new 'comm' member,
so I wanted to introduce easy accessors for both members

get/set functions seem like overkill..  we could use upper case to state
that it's a macro:

  THREAD_MAP__PID(evlist->threads, 0) = getpid();

anyway I can keep the original way if you insist ;-)

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ