Commit d9ae9c97 authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf script: Factor out script_fetch_insn()

Factor out script_fetch_insn() so it can be reused.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lore.kernel.org/r/20210530192308.7382-7-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent cf9bfa6c
...@@ -1417,6 +1417,13 @@ __weak void arch_fetch_insn(struct perf_sample *sample __maybe_unused, ...@@ -1417,6 +1417,13 @@ __weak void arch_fetch_insn(struct perf_sample *sample __maybe_unused,
{ {
} }
void script_fetch_insn(struct perf_sample *sample, struct thread *thread,
struct machine *machine)
{
if (sample->insn_len == 0 && native_arch)
arch_fetch_insn(sample, thread, machine);
}
static int perf_sample__fprintf_insn(struct perf_sample *sample, static int perf_sample__fprintf_insn(struct perf_sample *sample,
struct perf_event_attr *attr, struct perf_event_attr *attr,
struct thread *thread, struct thread *thread,
...@@ -1424,8 +1431,7 @@ static int perf_sample__fprintf_insn(struct perf_sample *sample, ...@@ -1424,8 +1431,7 @@ static int perf_sample__fprintf_insn(struct perf_sample *sample,
{ {
int printed = 0; int printed = 0;
if (sample->insn_len == 0 && native_arch) script_fetch_insn(sample, thread, machine);
arch_fetch_insn(sample, thread, machine);
if (PRINT_FIELD(INSNLEN)) if (PRINT_FIELD(INSNLEN))
printed += fprintf(fp, " ilen: %d", sample->insn_len); printed += fprintf(fp, " ilen: %d", sample->insn_len);
......
...@@ -97,6 +97,9 @@ extern unsigned int scripting_max_stack; ...@@ -97,6 +97,9 @@ extern unsigned int scripting_max_stack;
int script_spec_register(const char *spec, struct scripting_ops *ops); int script_spec_register(const char *spec, struct scripting_ops *ops);
void script_fetch_insn(struct perf_sample *sample, struct thread *thread,
struct machine *machine);
void setup_perl_scripting(void); void setup_perl_scripting(void);
void setup_python_scripting(void); void setup_python_scripting(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment