From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932522AbbFSWFp (ORCPT ); Fri, 19 Jun 2015 18:05:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58305 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753561AbbFSWFh (ORCPT ); Fri, 19 Jun 2015 18:05:37 -0400 Date: Sat, 20 Jun 2015 00:05:31 +0200 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , lkml , Adrian Hunter , Andi Kleen , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra , Stephane Eranian Subject: Re: [PATCH 01/26] perf tools: Change thread_map::map into struct Message-ID: <20150619220531.GA1389@krava.redhat.com> References: <1434664145-26951-1-git-send-email-jolsa@kernel.org> <1434664145-26951-2-git-send-email-jolsa@kernel.org> <20150619210713.GA28405@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150619210713.GA28405@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > --- > > 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/