summaryrefslogtreecommitdiff
path: root/tools/perf/util/db-export.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2019-07-10 11:58:00 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-07-10 12:13:51 -0300
commit80859c947a1eb170927d03e713abf7550a3d8766 (patch)
tree940bdd39f27541ec918f6a85d49e8a64475fb959 /tools/perf/util/db-export.c
parent8534b5de81802a82b13fe05acc3e749e3baf980e (diff)
perf db-export: Factor out db_export__comm()
In preparation for exporting the current comm for a thread, factor out db_export__comm(). Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/20190710085810.1650-12-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/db-export.c')
-rw-r--r--tools/perf/util/db-export.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/tools/perf/util/db-export.c b/tools/perf/util/db-export.c
index b0504d3eb130..b1e581c13963 100644
--- a/tools/perf/util/db-export.c
+++ b/tools/perf/util/db-export.c
@@ -78,6 +78,26 @@ int db_export__thread(struct db_export *dbe, struct thread *thread,
return 0;
}
+static int __db_export__comm(struct db_export *dbe, struct comm *comm,
+ struct thread *thread)
+{
+ comm->db_id = ++dbe->comm_last_db_id;
+
+ if (dbe->export_comm)
+ return dbe->export_comm(dbe, comm, thread);
+
+ return 0;
+}
+
+int db_export__comm(struct db_export *dbe, struct comm *comm,
+ struct thread *thread)
+{
+ if (comm->db_id)
+ return 0;
+
+ return __db_export__comm(dbe, comm, thread);
+}
+
/*
* Export the "exec" comm. The "exec" comm is the program / application command
* name at the time it first executes. It is used to group threads for the same
@@ -92,13 +112,9 @@ int db_export__exec_comm(struct db_export *dbe, struct comm *comm,
if (comm->db_id)
return 0;
- comm->db_id = ++dbe->comm_last_db_id;
-
- if (dbe->export_comm) {
- err = dbe->export_comm(dbe, comm, main_thread);
- if (err)
- return err;
- }
+ err = __db_export__comm(dbe, comm, main_thread);
+ if (err)
+ return err;
/*
* Record the main thread for this comm. Note that the main thread can