diff options
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r-- | tools/perf/builtin-script.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index daf73832743e..04913136bac9 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -566,30 +566,10 @@ out: return 0; } -static int perf_sample__fprintf_iregs(struct perf_sample *sample, - struct perf_event_attr *attr, FILE *fp) -{ - struct regs_dump *regs = &sample->intr_regs; - uint64_t mask = attr->sample_regs_intr; - unsigned i = 0, r; - int printed = 0; - - if (!regs) - return 0; - - for_each_set_bit(r, (unsigned long *) &mask, sizeof(mask) * 8) { - u64 val = regs->regs[i++]; - printed += fprintf(fp, "%5s:0x%"PRIx64" ", perf_reg_name(r), val); - } - - return printed; -} - -static int perf_sample__fprintf_uregs(struct perf_sample *sample, - struct perf_event_attr *attr, FILE *fp) +static int perf_sample__fprintf_regs(struct regs_dump *regs, uint64_t mask, + FILE *fp +) { - struct regs_dump *regs = &sample->user_regs; - uint64_t mask = attr->sample_regs_user; unsigned i = 0, r; int printed = 0; @@ -608,6 +588,20 @@ static int perf_sample__fprintf_uregs(struct perf_sample *sample, return printed; } +static int perf_sample__fprintf_iregs(struct perf_sample *sample, + struct perf_event_attr *attr, FILE *fp) +{ + return perf_sample__fprintf_regs(&sample->intr_regs, + attr->sample_regs_intr, fp); +} + +static int perf_sample__fprintf_uregs(struct perf_sample *sample, + struct perf_event_attr *attr, FILE *fp) +{ + return perf_sample__fprintf_regs(&sample->user_regs, + attr->sample_regs_user, fp); +} + static int perf_sample__fprintf_start(struct perf_sample *sample, struct thread *thread, struct perf_evsel *evsel, |