@@ -283,6 +283,9 @@ OPTIONS
--phys-data::
Record the sample physical addresses.
+--hazard::
+ Record processor pipeline hazard and stall information.
+
-T::
--timestamp::
Record the sample timestamps. Use it with 'perf report -D' to see the
@@ -2301,6 +2301,7 @@ static struct option __record_options[] = {
OPT_BOOLEAN('s', "stat", &record.opts.inherit_stat,
"per thread counts"),
OPT_BOOLEAN('d', "data", &record.opts.sample_address, "Record the sample addresses"),
+ OPT_BOOLEAN(0, "hazard", &record.opts.hazard, "Record processor pipeline hazard and stall information"),
OPT_BOOLEAN(0, "phys-data", &record.opts.sample_phys_addr,
"Record the sample physical addresses"),
OPT_BOOLEAN(0, "sample-cpu", &record.opts.sample_cpu, "Record the sample cpu"),
@@ -148,6 +148,7 @@ struct perf_sample {
struct stack_dump user_stack;
struct sample_read read;
struct aux_sample aux_sample;
+ struct perf_pipeline_haz_data *pipeline_haz;
};
#define PERF_MEM_DATA_SRC_NONE \
@@ -1080,6 +1080,9 @@ void perf_evsel__config(struct evsel *evsel, struct record_opts *opts,
if (opts->sample_phys_addr)
perf_evsel__set_sample_bit(evsel, PHYS_ADDR);
+ if (opts->hazard)
+ perf_evsel__set_sample_bit(evsel, PIPELINE_HAZ);
+
if (opts->no_buffering) {
attr->watermark = 0;
attr->wakeup_events = 1;
@@ -2265,6 +2268,13 @@ int perf_evsel__parse_sample(struct evsel *evsel, union perf_event *event,
array = (void *)array + sz;
}
+ if (type & PERF_SAMPLE_PIPELINE_HAZ) {
+ sz = sizeof(struct perf_pipeline_haz_data);
+ OVERFLOW_CHECK(array, sz, max_size);
+ data->pipeline_haz = (struct perf_pipeline_haz_data *)array;
+ array = (void *)array + sz;
+ }
+
return 0;
}
@@ -35,6 +35,7 @@ static void __p_sample_type(char *buf, size_t size, u64 value)
bit_name(BRANCH_STACK), bit_name(REGS_USER), bit_name(STACK_USER),
bit_name(IDENTIFIER), bit_name(REGS_INTR), bit_name(DATA_SRC),
bit_name(WEIGHT), bit_name(PHYS_ADDR), bit_name(AUX),
+ bit_name(PIPELINE_HAZ),
{ .name = NULL, }
};
#undef bit_name
@@ -67,6 +67,7 @@ struct record_opts {
int affinity;
int mmap_flush;
unsigned int comp_level;
+ bool hazard;
};
extern const char * const *record_usage;
@@ -1153,6 +1153,19 @@ static void stack_user__printf(struct stack_dump *dump)
dump->size, dump->offset);
}
+static void pipeline_hazard__printf(struct perf_sample *sample)
+{
+ struct perf_pipeline_haz_data *haz = sample->pipeline_haz;
+
+ printf("... hazard information:\n");
+ printf(".... Inst Type 0x%" PRIx32 "\n", haz->itype);
+ printf(".... Inst Cache 0x%" PRIx32 "\n", haz->icache);
+ printf(".... Hazard Stage 0x%" PRIx32 "\n", haz->hazard_stage);
+ printf(".... Hazard Reason 0x%" PRIx32 "\n", haz->hazard_reason);
+ printf(".... Stall Stage 0x%" PRIx32 "\n", haz->stall_stage);
+ printf(".... Stall Reason 0x%" PRIx32 "\n", haz->stall_reason);
+}
+
static void perf_evlist__print_tstamp(struct evlist *evlist,
union perf_event *event,
struct perf_sample *sample)
@@ -1251,6 +1264,9 @@ static void dump_sample(struct evsel *evsel, union perf_event *event,
if (sample_type & PERF_SAMPLE_STACK_USER)
stack_user__printf(&sample->user_stack);
+ if (sample_type & PERF_SAMPLE_PIPELINE_HAZ)
+ pipeline_hazard__printf(sample);
+
if (sample_type & PERF_SAMPLE_WEIGHT)
printf("... weight: %" PRIu64 "\n", sample->weight);