summaryrefslogtreecommitdiff
path: root/tools/perf/util/db-export.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/db-export.c')
-rw-r--r--tools/perf/util/db-export.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/perf/util/db-export.c b/tools/perf/util/db-export.c
index 50f916374d87..ba54b1119ee6 100644
--- a/tools/perf/util/db-export.c
+++ b/tools/perf/util/db-export.c
@@ -19,7 +19,6 @@
#include "callchain.h"
#include "call-path.h"
#include "db-export.h"
-#include <linux/zalloc.h>
int db_export__init(struct db_export *dbe)
{
@@ -181,7 +180,7 @@ static int db_ids_from_al(struct db_export *dbe, struct addr_location *al,
if (al->map) {
struct dso *dso = map__dso(al->map);
- err = db_export__dso(dbe, dso, maps__machine(al->maps));
+ err = db_export__dso(dbe, dso, maps__machine(thread__maps(al->thread)));
if (err)
return err;
*dso_db_id = dso__db_id(dso);
@@ -209,8 +208,7 @@ static int db_ids_from_al(struct db_export *dbe, struct addr_location *al,
static struct call_path *call_path_from_sample(struct db_export *dbe,
struct machine *machine,
struct thread *thread,
- struct perf_sample *sample,
- struct evsel *evsel)
+ struct perf_sample *sample)
{
u64 kernel_start = machine__kernel_start(machine);
struct call_path *current = &dbe->cpr->call_path;
@@ -228,7 +226,7 @@ static struct call_path *call_path_from_sample(struct db_export *dbe,
*/
callchain_param.order = ORDER_CALLER;
cursor = get_tls_callchain_cursor();
- err = thread__resolve_callchain(thread, cursor, evsel,
+ err = thread__resolve_callchain(thread, cursor,
sample, NULL, NULL, PERF_MAX_STACK_DEPTH);
if (err) {
callchain_param.order = saved_order;
@@ -254,8 +252,8 @@ static struct call_path *call_path_from_sample(struct db_export *dbe,
addr_location__init(&al);
al.sym = node->ms.sym;
al.map = map__get(node->ms.map);
- al.maps = maps__get(thread__maps(thread));
al.addr = node->ip;
+ al.thread = thread__get(thread);
if (al.map && !al.sym)
al.sym = dso__find_symbol(map__dso(al.map), al.addr);
@@ -346,26 +344,29 @@ static int db_export__threads(struct db_export *dbe, struct thread *thread,
}
int db_export__sample(struct db_export *dbe, union perf_event *event,
- struct perf_sample *sample, struct evsel *evsel,
+ struct perf_sample *sample,
struct addr_location *al, struct addr_location *addr_al)
{
struct thread *thread = al->thread;
struct export_sample es = {
.event = event,
.sample = sample,
- .evsel = evsel,
.al = al,
};
struct thread *main_thread;
struct comm *comm = NULL;
- struct machine *machine;
+ struct machine *machine = NULL;
int err;
- err = db_export__evsel(dbe, evsel);
+ if (thread__maps(thread))
+ machine = maps__machine(thread__maps(thread));
+ if (!machine)
+ return -1;
+
+ err = db_export__evsel(dbe, sample->evsel);
if (err)
return err;
- machine = maps__machine(al->maps);
err = db_export__machine(dbe, machine);
if (err)
return err;
@@ -387,8 +388,7 @@ int db_export__sample(struct db_export *dbe, union perf_event *event,
if (dbe->cpr) {
struct call_path *cp = call_path_from_sample(dbe, machine,
- thread, sample,
- evsel);
+ thread, sample);
if (cp) {
db_export__call_path(dbe, cp);
es.call_path_id = cp->db_id;