[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-19207d86940db9dad5f2e0a270a2490f7da451e3@git.kernel.org>
Date: Wed, 17 Jul 2019 15:53:25 -0700
From: tip-bot for Adrian Hunter <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: mingo@...nel.org, adrian.hunter@...el.com, hpa@...or.com,
acme@...hat.com, jolsa@...hat.com, linux-kernel@...r.kernel.org,
tglx@...utronix.de
Subject: [tip:perf/urgent] perf db-export: Export main_thread in
db_export__sample()
Commit-ID: 19207d86940db9dad5f2e0a270a2490f7da451e3
Gitweb: https://git.kernel.org/tip/19207d86940db9dad5f2e0a270a2490f7da451e3
Author: Adrian Hunter <adrian.hunter@...el.com>
AuthorDate: Wed, 10 Jul 2019 11:57:53 +0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 10 Jul 2019 12:12:05 -0300
perf db-export: Export main_thread in db_export__sample()
Export main_thread in db_export__sample() because it makes the code
easier to understand, and prepares db_export__thread() for further
simplification.
Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Link: http://lkml.kernel.org/r/20190710085810.1650-5-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/db-export.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/tools/perf/util/db-export.c b/tools/perf/util/db-export.c
index 14501236c046..63f9edf65eee 100644
--- a/tools/perf/util/db-export.c
+++ b/tools/perf/util/db-export.c
@@ -71,16 +71,10 @@ int db_export__thread(struct db_export *dbe, struct thread *thread,
thread->db_id = ++dbe->thread_last_db_id;
if (main_thread) {
- if (main_thread != thread) {
- err = db_export__thread(dbe, main_thread, machine,
- comm, main_thread);
+ if (main_thread != thread && comm) {
+ err = db_export__comm_thread(dbe, comm, thread);
if (err)
return err;
- if (comm) {
- err = db_export__comm_thread(dbe, comm, thread);
- if (err)
- return err;
- }
}
main_thread_db_id = main_thread->db_id;
}
@@ -308,12 +302,24 @@ int db_export__sample(struct db_export *dbe, union perf_event *event,
return err;
main_thread = thread__main_thread(al->machine, thread);
- if (main_thread)
+ if (main_thread) {
comm = machine__thread_exec_comm(al->machine, main_thread);
+ /*
+ * A thread has a reference to the main thread, so export the
+ * main thread first.
+ */
+ err = db_export__thread(dbe, main_thread, al->machine, comm,
+ main_thread);
+ if (err)
+ goto out_put;
+ }
- err = db_export__thread(dbe, thread, al->machine, comm, main_thread);
- if (err)
- goto out_put;
+ if (thread != main_thread) {
+ err = db_export__thread(dbe, thread, al->machine, comm,
+ main_thread);
+ if (err)
+ goto out_put;
+ }
if (comm) {
err = db_export__exec_comm(dbe, comm, main_thread);
Powered by blists - more mailing lists