All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Borislav Petkov <bp@suse.de>, David Ahern <dsahern@gmail.com>,
	Don Zickus <dzickus@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jean Pihet <jean.pihet@linaro.org>, Jiri Olsa <jolsa@redhat.com>,
	Mike Galbraith <efault@gmx.de>,
	Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>
Subject: [PATCH 05/25] perf callchains: Use thread->mg->machine
Date: Wed, 29 Oct 2014 12:06:17 -0200	[thread overview]
Message-ID: <1414591597-2763-6-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1414591597-2763-1-git-send-email-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

The unwind__get_entries() already receives the thread parameter, from where it can
obtain the matching machine structure, shorten the signature.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-isjc6bm8mv4612mhi6af64go@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/dwarf-unwind.c    | 18 +++++++++---------
 tools/perf/util/machine.c          |  2 +-
 tools/perf/util/unwind-libdw.c     |  4 ++--
 tools/perf/util/unwind-libunwind.c |  4 ++--
 tools/perf/util/unwind.h           |  2 --
 5 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c
index fc25e57f4a5d..ab28cca2cb97 100644
--- a/tools/perf/tests/dwarf-unwind.c
+++ b/tools/perf/tests/dwarf-unwind.c
@@ -59,7 +59,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg)
 }
 
 __attribute__ ((noinline))
-static int unwind_thread(struct thread *thread, struct machine *machine)
+static int unwind_thread(struct thread *thread)
 {
 	struct perf_sample sample;
 	unsigned long cnt = 0;
@@ -72,7 +72,7 @@ static int unwind_thread(struct thread *thread, struct machine *machine)
 		goto out;
 	}
 
-	err = unwind__get_entries(unwind_entry, &cnt, machine, thread,
+	err = unwind__get_entries(unwind_entry, &cnt, thread,
 				  &sample, MAX_STACK);
 	if (err)
 		pr_debug("unwind failed\n");
@@ -89,21 +89,21 @@ static int unwind_thread(struct thread *thread, struct machine *machine)
 }
 
 __attribute__ ((noinline))
-static int krava_3(struct thread *thread, struct machine *machine)
+static int krava_3(struct thread *thread)
 {
-	return unwind_thread(thread, machine);
+	return unwind_thread(thread);
 }
 
 __attribute__ ((noinline))
-static int krava_2(struct thread *thread, struct machine *machine)
+static int krava_2(struct thread *thread)
 {
-	return krava_3(thread, machine);
+	return krava_3(thread);
 }
 
 __attribute__ ((noinline))
-static int krava_1(struct thread *thread, struct machine *machine)
+static int krava_1(struct thread *thread)
 {
-	return krava_2(thread, machine);
+	return krava_2(thread);
 }
 
 int test__dwarf_unwind(void)
@@ -137,7 +137,7 @@ int test__dwarf_unwind(void)
 		goto out;
 	}
 
-	err = krava_1(thread, machine);
+	err = krava_1(thread);
 
  out:
 	machine__delete_threads(machine);
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index fd192e4885cc..51a630301afa 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1486,7 +1486,7 @@ int thread__resolve_callchain(struct thread *thread,
 	    (!sample->user_stack.size))
 		return 0;
 
-	return unwind__get_entries(unwind_entry, &callchain_cursor, thread->mg->machine,
+	return unwind__get_entries(unwind_entry, &callchain_cursor,
 				   thread, sample, max_stack);
 
 }
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c
index f24b350ab192..2dcfe9a7c8d0 100644
--- a/tools/perf/util/unwind-libdw.c
+++ b/tools/perf/util/unwind-libdw.c
@@ -164,14 +164,14 @@ frame_callback(Dwfl_Frame *state, void *arg)
 }
 
 int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
-			struct machine *machine, struct thread *thread,
+			struct thread *thread,
 			struct perf_sample *data,
 			int max_stack)
 {
 	struct unwind_info ui = {
 		.sample		= data,
 		.thread		= thread,
-		.machine	= machine,
+		.machine	= thread->mg->machine,
 		.cb		= cb,
 		.arg		= arg,
 		.max_stack	= max_stack,
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index 29acc8cccb56..371219a6daf1 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -592,14 +592,14 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
 }
 
 int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
-			struct machine *machine, struct thread *thread,
+			struct thread *thread,
 			struct perf_sample *data, int max_stack)
 {
 	u64 ip;
 	struct unwind_info ui = {
 		.sample       = data,
 		.thread       = thread,
-		.machine      = machine,
+		.machine      = thread->mg->machine,
 	};
 	int ret;
 
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index f50b737235eb..12790cf94618 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -16,7 +16,6 @@ typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
 
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
-			struct machine *machine,
 			struct thread *thread,
 			struct perf_sample *data, int max_stack);
 /* libunwind specific */
@@ -38,7 +37,6 @@ static inline void unwind__finish_access(struct thread *thread __maybe_unused) {
 static inline int
 unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
 		    void *arg __maybe_unused,
-		    struct machine *machine __maybe_unused,
 		    struct thread *thread __maybe_unused,
 		    struct perf_sample *data __maybe_unused,
 		    int max_stack __maybe_unused)
-- 
1.9.3


  parent reply	other threads:[~2014-10-29 14:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29 14:06 [GIT PULL 00/25] perf/core improvements Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 01/25] perf tools powerpc: Cache the DWARF debug info Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 02/25] perf tools: Set thread->mg.machine in all places Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 03/25] perf tools: A thread's machine can be found via thread->mg->machine Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 04/25] perf thread: Adopt resolve_callchain method from machine Arnaldo Carvalho de Melo
2014-10-29 14:06 ` Arnaldo Carvalho de Melo [this message]
2014-10-29 14:06 ` [PATCH 06/25] perf tests: Remove misplaced __maybe_unused Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 07/25] perf tests: Use thread->mg->machine Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 08/25] perf tools: Add PARSE_OPT_DISABLED flag Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 09/25] perf tools: Export usage string and option table of perf record Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 10/25] perf kvm: Print kvm specific --help output Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 11/25] perf tools: Add support for exclusive option Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 12/25] perf probe: Use PARSE_OPT_EXCLUSIVE flag Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 13/25] perf tools: Ensure return negative value when write header error Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 14/25] perf pmu: Let pmu's with no events show up on perf list Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 15/25] perf tools: Build programs to copy 32-bit compatibility Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 16/25] perf tools: Add support for 32-bit compatibility VDSOs Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 17/25] perf tools: Do not attempt to run perf-read-vdso32 if it wasn't built Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 18/25] perf pmu: Add proper error handling to print_pmu_events() Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 19/25] perf tools: Add facility to export data in database-friendly way Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 20/25] perf scripting python: Extend interface to export data in a " Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 21/25] perf script: Add Python script to export to postgresql Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 22/25] perf probe: Add --quiet option to suppress output result message Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 23/25] perf tools: Add id index Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 24/25] perf tools: Use evlist__for_each in a few remaining places Arnaldo Carvalho de Melo
2014-10-29 14:06 ` [PATCH 25/25] perf session: Add perf_session__deliver_synth_event() Arnaldo Carvalho de Melo
2014-10-30  6:35 ` [GIT PULL 00/25] perf/core improvements Ingo Molnar

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=1414591597-2763-6-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=bp@suse.de \
    --cc=dsahern@gmail.com \
    --cc=dzickus@redhat.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jean.pihet@linaro.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.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.