summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r--tools/perf/builtin-script.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index a792214d1af8..006f522d0e7f 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1011,12 +1011,12 @@ static int perf_sample__fprintf_brstackoff(struct perf_sample *sample,
to = entries[i].to;
if (thread__find_map_fb(thread, sample->cpumode, from, &alf) &&
- !alf.map->dso->adjust_symbols)
- from = map__map_ip(alf.map, from);
+ !map__dso(alf.map)->adjust_symbols)
+ from = map__dso_map_ip(alf.map, from);
if (thread__find_map_fb(thread, sample->cpumode, to, &alt) &&
- !alt.map->dso->adjust_symbols)
- to = map__map_ip(alt.map, to);
+ !map__dso(alt.map)->adjust_symbols)
+ to = map__dso_map_ip(alt.map, to);
printed += fprintf(fp, " 0x%"PRIx64, from);
if (PRINT_FIELD(DSO)) {
@@ -1044,6 +1044,7 @@ static int grab_bb(u8 *buffer, u64 start, u64 end,
long offset, len;
struct addr_location al;
bool kernel;
+ struct dso *dso;
if (!start || !end)
return 0;
@@ -1074,11 +1075,11 @@ static int grab_bb(u8 *buffer, u64 start, u64 end,
return 0;
}
- if (!thread__find_map(thread, *cpumode, start, &al) || !al.map->dso) {
+ if (!thread__find_map(thread, *cpumode, start, &al) || (dso = map__dso(al.map)) == NULL) {
pr_debug("\tcannot resolve %" PRIx64 "-%" PRIx64 "\n", start, end);
return 0;
}
- if (al.map->dso->data.status == DSO_DATA_STATUS_ERROR) {
+ if (dso->data.status == DSO_DATA_STATUS_ERROR) {
pr_debug("\tcannot resolve %" PRIx64 "-%" PRIx64 "\n", start, end);
return 0;
}
@@ -1086,11 +1087,11 @@ static int grab_bb(u8 *buffer, u64 start, u64 end,
/* Load maps to ensure dso->is_64_bit has been updated */
map__load(al.map);
- offset = al.map->map_ip(al.map, start);
- len = dso__data_read_offset(al.map->dso, machine, offset, (u8 *)buffer,
+ offset = map__map_ip(al.map, start);
+ len = dso__data_read_offset(dso, machine, offset, (u8 *)buffer,
end - start + MAXINSN);
- *is64bit = al.map->dso->is_64_bit;
+ *is64bit = dso->is_64_bit;
if (len <= 0)
pr_debug("\tcannot fetch code for block at %" PRIx64 "-%" PRIx64 "\n",
start, end);
@@ -1104,10 +1105,11 @@ static int map__fprintf_srccode(struct map *map, u64 addr, FILE *fp, struct srcc
unsigned line;
int len;
char *srccode;
+ struct dso *dso;
- if (!map || !map->dso)
+ if (!map || (dso = map__dso(map)) == NULL)
return 0;
- srcfile = get_srcline_split(map->dso,
+ srcfile = get_srcline_split(dso,
map__rip_2objdump(map, addr),
&line);
if (!srcfile)
@@ -1206,7 +1208,7 @@ static int ip__fprintf_sym(uint64_t addr, struct thread *thread,
if (al.addr < al.sym->end)
off = al.addr - al.sym->start;
else
- off = al.addr - al.map->start - al.sym->start;
+ off = al.addr - map__start(al.map) - al.sym->start;
printed += fprintf(fp, "\t%s", al.sym->name);
if (off)
printed += fprintf(fp, "%+d", off);
@@ -1906,7 +1908,7 @@ static int perf_sample__fprintf_synth_evt(struct perf_sample *sample, FILE *fp)
struct perf_synth_intel_evt *data = perf_sample__synth_ptr(sample);
const char *cfe[32] = {NULL, "INTR", "IRET", "SMI", "RSM", "SIPI",
"INIT", "VMENTRY", "VMEXIT", "VMEXIT_INTR",
- "SHUTDOWN"};
+ "SHUTDOWN", NULL, "UINTR", "UIRET"};
const char *evd[64] = {"PFA", "VMXQ", "VMXR"};
const char *s;
int len, i;
@@ -2072,10 +2074,6 @@ static void perf_sample__fprint_metric(struct perf_script *script,
if (evsel_script(leader)->gnum++ == 0)
perf_stat__reset_shadow_stats();
val = sample->period * evsel->scale;
- perf_stat__update_shadow_stats(evsel,
- val,
- sample->cpu,
- &rt_stat);
evsel_script(evsel)->val = val;
if (evsel_script(leader)->gnum == leader->core.nr_members) {
for_each_group_member (ev2, leader) {
@@ -2083,8 +2081,7 @@ static void perf_sample__fprint_metric(struct perf_script *script,
evsel_script(ev2)->val,
sample->cpu,
&ctx,
- NULL,
- &rt_stat);
+ NULL);
}
evsel_script(leader)->gnum = 0;
}
@@ -2318,8 +2315,8 @@ static void setup_scripting(void)
{
#ifdef HAVE_LIBTRACEEVENT
setup_perl_scripting();
- setup_python_scripting();
#endif
+ setup_python_scripting();
}
static int flush_scripting(void)
@@ -2794,8 +2791,6 @@ static int __cmd_script(struct perf_script *script)
signal(SIGINT, sig_handler);
- perf_stat__init_shadow_stats();
-
/* override event processing functions */
if (script->show_task_events) {
script->tool.comm = process_comm_event;