All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>, lkml <linux-kernel@vger.kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Andi Kleen <ak@linux.intel.com>, David Ahern <dsahern@gmail.com>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 01/26] perf tools: Change thread_map::map into struct
Date: Sat, 20 Jun 2015 00:05:31 +0200	[thread overview]
Message-ID: <20150619220531.GA1389@krava.redhat.com> (raw)
In-Reply-To: <20150619210713.GA28405@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 <jolsa@kernel.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/

  reply	other threads:[~2015-06-19 22:05 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18 21:48 [PATCHv3 00/26] perf stat: Introduce --per-thread option Jiri Olsa
2015-06-18 21:48 ` [PATCH 01/26] perf tools: Change thread_map::map into struct Jiri Olsa
2015-06-19 21:07   ` Arnaldo Carvalho de Melo
2015-06-19 22:05     ` Jiri Olsa [this message]
2015-06-22 14:40       ` Arnaldo Carvalho de Melo
2015-06-22 17:37         ` Jiri Olsa
2015-06-22 17:48           ` Arnaldo Carvalho de Melo
2015-06-18 21:48 ` [PATCH 02/26] perf tools: Add comm string into struct thread_map Jiri Olsa
2015-06-18 21:48 ` [PATCH 03/26] perf tools: Add reference counting for cpu_map object Jiri Olsa
2015-06-18 21:48 ` [PATCH 04/26] perf tools: Add reference counting for thread_map object Jiri Olsa
2015-06-18 21:48 ` [PATCH 05/26] perf tools: Propagate cpu maps through the evlist Jiri Olsa
2015-06-18 21:48 ` [PATCH 06/26] perf tools: Propagate thread " Jiri Olsa
2015-06-18 21:48 ` [PATCH 07/26] perf tools: Make perf_evsel__(nr_)cpus generic Jiri Olsa
2015-06-18 21:48 ` [PATCH 08/26] perf tests: Add thread_map object tests Jiri Olsa
2015-06-18 21:48 ` [PATCH 09/26] perf stat: Introduce perf_counts function Jiri Olsa
2015-06-18 21:48 ` [PATCH 10/26] perf stat: Use xyarray for cpu evsel counts Jiri Olsa
2015-06-18 21:48 ` [PATCH 11/26] perf stat: Make stats work over the thread dimension Jiri Olsa
2015-06-18 21:48 ` [PATCH 12/26] perf stat: Rename struct perf_counts::cpu member to values Jiri Olsa
2015-06-18 21:48 ` [PATCH 13/26] perf stat: Move perf_evsel__(alloc|free|reset)_stat_priv into stat object Jiri Olsa
2015-06-18 21:48 ` [PATCH 14/26] perf stat: Move perf_evsel__(alloc|free)_prev_raw_counts " Jiri Olsa
2015-06-18 21:48 ` [PATCH 15/26] perf stat: Move perf_evlist__(alloc|free)_stats into evlist object Jiri Olsa
2015-06-18 21:48 ` [PATCH 16/26] perf stat: Introduce perf_evsel__alloc_stats function Jiri Olsa
2015-06-18 21:48 ` [PATCH 17/26] perf stat: Introduce perf_evsel__read function Jiri Olsa
2015-06-18 21:48 ` [PATCH 18/26] perf stat: Introduce read_counters function Jiri Olsa
2015-06-18 21:48 ` [PATCH 19/26] perf stat: Separate counters reading and processing Jiri Olsa
2015-06-18 21:48 ` [PATCH 20/26] perf stat: Move zero_per_pkg into counter process code Jiri Olsa
2015-06-18 21:49 ` [PATCH 21/26] perf stat: Move perf_stat initialization " Jiri Olsa
2015-06-18 21:49 ` [PATCH 22/26] perf stat: Remove perf_evsel__read_cb function Jiri Olsa
2015-06-18 21:49 ` [PATCH 23/26] perf stat: Rename print_interval to process_interval Jiri Olsa
2015-06-18 21:49 ` [PATCH 24/26] perf stat: Using init_stats instead of memset Jiri Olsa
2015-06-18 21:49 ` [PATCH 25/26] perf stat: Introduce print_counters function Jiri Olsa
2015-06-18 21:49 ` [PATCH 26/26] perf stat: Introduce --per-thread option Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150619220531.GA1389@krava.redhat.com \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.