diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2019-07-10 04:57:50 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-10 11:07:40 -0400 |
commit | fead24e52383c3f8eb25b5426d52b430b84a8194 (patch) | |
tree | e8c4ad2a924c542b481f9231f38ee8cd7484a1b3 | |
parent | c3e78a3403dabcb7115c2fb7b538a1095d168cd5 (diff) |
perf db-export: Get rid of db_export__deferred()
db_export__deferred() deferred the export of comms if the comm string
had not been "set" (changed from :<pid>) however that problem was fixed
a long time ago by commit e803cf97a4f9 ("perf record: Synthesize COMM
event for a command line workload"), so get rid of
db_export__deferred().
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20190710085810.1650-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/db-export.c | 61 | ||||
-rw-r--r-- | tools/perf/util/db-export.h | 2 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 4 |
3 files changed, 2 insertions, 65 deletions
diff --git a/tools/perf/util/db-export.c b/tools/perf/util/db-export.c index 2394c7506abe..34cf197fe74f 100644 --- a/tools/perf/util/db-export.c +++ b/tools/perf/util/db-export.c | |||
@@ -20,70 +20,14 @@ | |||
20 | #include "db-export.h" | 20 | #include "db-export.h" |
21 | #include <linux/zalloc.h> | 21 | #include <linux/zalloc.h> |
22 | 22 | ||
23 | struct deferred_export { | ||
24 | struct list_head node; | ||
25 | struct comm *comm; | ||
26 | }; | ||
27 | |||
28 | static int db_export__deferred(struct db_export *dbe) | ||
29 | { | ||
30 | struct deferred_export *de; | ||
31 | int err; | ||
32 | |||
33 | while (!list_empty(&dbe->deferred)) { | ||
34 | de = list_entry(dbe->deferred.next, struct deferred_export, | ||
35 | node); | ||
36 | err = dbe->export_comm(dbe, de->comm); | ||
37 | list_del_init(&de->node); | ||
38 | free(de); | ||
39 | if (err) | ||
40 | return err; | ||
41 | } | ||
42 | |||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static void db_export__free_deferred(struct db_export *dbe) | ||
47 | { | ||
48 | struct deferred_export *de; | ||
49 | |||
50 | while (!list_empty(&dbe->deferred)) { | ||
51 | de = list_entry(dbe->deferred.next, struct deferred_export, | ||
52 | node); | ||
53 | list_del_init(&de->node); | ||
54 | free(de); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | static int db_export__defer_comm(struct db_export *dbe, struct comm *comm) | ||
59 | { | ||
60 | struct deferred_export *de; | ||
61 | |||
62 | de = zalloc(sizeof(struct deferred_export)); | ||
63 | if (!de) | ||
64 | return -ENOMEM; | ||
65 | |||
66 | de->comm = comm; | ||
67 | list_add_tail(&de->node, &dbe->deferred); | ||
68 | |||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | int db_export__init(struct db_export *dbe) | 23 | int db_export__init(struct db_export *dbe) |
73 | { | 24 | { |
74 | memset(dbe, 0, sizeof(struct db_export)); | 25 | memset(dbe, 0, sizeof(struct db_export)); |
75 | INIT_LIST_HEAD(&dbe->deferred); | ||
76 | return 0; | 26 | return 0; |
77 | } | 27 | } |
78 | 28 | ||
79 | int db_export__flush(struct db_export *dbe) | ||
80 | { | ||
81 | return db_export__deferred(dbe); | ||
82 | } | ||
83 | |||
84 | void db_export__exit(struct db_export *dbe) | 29 | void db_export__exit(struct db_export *dbe) |
85 | { | 30 | { |
86 | db_export__free_deferred(dbe); | ||
87 | call_return_processor__free(dbe->crp); | 31 | call_return_processor__free(dbe->crp); |
88 | dbe->crp = NULL; | 32 | dbe->crp = NULL; |
89 | } | 33 | } |
@@ -172,10 +116,7 @@ int db_export__comm(struct db_export *dbe, struct comm *comm, | |||
172 | comm->db_id = ++dbe->comm_last_db_id; | 116 | comm->db_id = ++dbe->comm_last_db_id; |
173 | 117 | ||
174 | if (dbe->export_comm) { | 118 | if (dbe->export_comm) { |
175 | if (main_thread->comm_set) | 119 | err = dbe->export_comm(dbe, comm); |
176 | err = dbe->export_comm(dbe, comm); | ||
177 | else | ||
178 | err = db_export__defer_comm(dbe, comm); | ||
179 | if (err) | 120 | if (err) |
180 | return err; | 121 | return err; |
181 | } | 122 | } |
diff --git a/tools/perf/util/db-export.h b/tools/perf/util/db-export.h index e8a64028a386..261cfece8dee 100644 --- a/tools/perf/util/db-export.h +++ b/tools/perf/util/db-export.h | |||
@@ -68,11 +68,9 @@ struct db_export { | |||
68 | u64 sample_last_db_id; | 68 | u64 sample_last_db_id; |
69 | u64 call_path_last_db_id; | 69 | u64 call_path_last_db_id; |
70 | u64 call_return_last_db_id; | 70 | u64 call_return_last_db_id; |
71 | struct list_head deferred; | ||
72 | }; | 71 | }; |
73 | 72 | ||
74 | int db_export__init(struct db_export *dbe); | 73 | int db_export__init(struct db_export *dbe); |
75 | int db_export__flush(struct db_export *dbe); | ||
76 | void db_export__exit(struct db_export *dbe); | 74 | void db_export__exit(struct db_export *dbe); |
77 | int db_export__evsel(struct db_export *dbe, struct perf_evsel *evsel); | 75 | int db_export__evsel(struct db_export *dbe, struct perf_evsel *evsel); |
78 | int db_export__machine(struct db_export *dbe, struct machine *machine); | 76 | int db_export__machine(struct db_export *dbe, struct machine *machine); |
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 112bed65232f..c9837f0f0fd6 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -1620,9 +1620,7 @@ error: | |||
1620 | 1620 | ||
1621 | static int python_flush_script(void) | 1621 | static int python_flush_script(void) |
1622 | { | 1622 | { |
1623 | struct tables *tables = &tables_global; | 1623 | return 0; |
1624 | |||
1625 | return db_export__flush(&tables->dbe); | ||
1626 | } | 1624 | } |
1627 | 1625 | ||
1628 | /* | 1626 | /* |