perf arm-spe: Add SPE total latency as PERF_SAMPLE_WEIGHT
Use total latency info in the SPE counter packet as sample weight so that we can see it in local_weight and (global) weight sort keys. Maybe we can use PERF_SAMPLE_WEIGHT_STRUCT to support ins_lat as well but I'm not sure which latency it matches. So just adding total latency first. Reviewed-by: Leo Yan <leo.yan@linaro.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Andi Kleen <ak@linux.intel.com> Cc: German Gomez <german.gomez@arm.com> Cc: Ian Rogers <irogers@google.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20211201220855.1260688-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
f0a29c9647
commit
b0fde9c6e2
3 changed files with 7 additions and 1 deletions
|
@ -179,6 +179,8 @@ static int arm_spe_read_record(struct arm_spe_decoder *decoder)
|
||||||
decoder->record.phys_addr = ip;
|
decoder->record.phys_addr = ip;
|
||||||
break;
|
break;
|
||||||
case ARM_SPE_COUNTER:
|
case ARM_SPE_COUNTER:
|
||||||
|
if (idx == SPE_CNT_PKT_HDR_INDEX_TOTAL_LAT)
|
||||||
|
decoder->record.latency = payload;
|
||||||
break;
|
break;
|
||||||
case ARM_SPE_CONTEXT:
|
case ARM_SPE_CONTEXT:
|
||||||
decoder->record.context_id = payload;
|
decoder->record.context_id = payload;
|
||||||
|
|
|
@ -33,6 +33,7 @@ struct arm_spe_record {
|
||||||
enum arm_spe_sample_type type;
|
enum arm_spe_sample_type type;
|
||||||
int err;
|
int err;
|
||||||
u32 op;
|
u32 op;
|
||||||
|
u32 latency;
|
||||||
u64 from_ip;
|
u64 from_ip;
|
||||||
u64 to_ip;
|
u64 to_ip;
|
||||||
u64 timestamp;
|
u64 timestamp;
|
||||||
|
|
|
@ -330,6 +330,7 @@ static int arm_spe__synth_mem_sample(struct arm_spe_queue *speq,
|
||||||
sample.addr = record->virt_addr;
|
sample.addr = record->virt_addr;
|
||||||
sample.phys_addr = record->phys_addr;
|
sample.phys_addr = record->phys_addr;
|
||||||
sample.data_src = data_src;
|
sample.data_src = data_src;
|
||||||
|
sample.weight = record->latency;
|
||||||
|
|
||||||
return arm_spe_deliver_synth_event(spe, speq, event, &sample);
|
return arm_spe_deliver_synth_event(spe, speq, event, &sample);
|
||||||
}
|
}
|
||||||
|
@ -347,6 +348,7 @@ static int arm_spe__synth_branch_sample(struct arm_spe_queue *speq,
|
||||||
sample.id = spe_events_id;
|
sample.id = spe_events_id;
|
||||||
sample.stream_id = spe_events_id;
|
sample.stream_id = spe_events_id;
|
||||||
sample.addr = record->to_ip;
|
sample.addr = record->to_ip;
|
||||||
|
sample.weight = record->latency;
|
||||||
|
|
||||||
return arm_spe_deliver_synth_event(spe, speq, event, &sample);
|
return arm_spe_deliver_synth_event(spe, speq, event, &sample);
|
||||||
}
|
}
|
||||||
|
@ -993,7 +995,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
|
||||||
attr.type = PERF_TYPE_HARDWARE;
|
attr.type = PERF_TYPE_HARDWARE;
|
||||||
attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
|
attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
|
||||||
attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
|
attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
|
||||||
PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC;
|
PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
|
||||||
|
PERF_SAMPLE_WEIGHT;
|
||||||
if (spe->timeless_decoding)
|
if (spe->timeless_decoding)
|
||||||
attr.sample_type &= ~(u64)PERF_SAMPLE_TIME;
|
attr.sample_type &= ~(u64)PERF_SAMPLE_TIME;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue