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;
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,