Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf cs-etm: Print the decoder name

Use the real name of the decoder instead of hard-coding "ETM" to avoid
confusion when the trace is ETE. This also now distinguishes between
ETMv3 and ETMv4.

Reviewed-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Suzuki Poulouse <suzuki.poulose@arm.com>
Signed-off-by: James Clark <james.clark@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Link: https //lore.kernel.org/r/20210806134109.1182235-9-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

James Clark and committed by
Arnaldo Carvalho de Melo
56c62f52 779f414a

+14 -8
+11 -6
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
··· 37 37 dcd_tree_handle_t dcd_tree; 38 38 cs_etm_mem_cb_type mem_access; 39 39 ocsd_datapath_resp_t prev_return; 40 + const char *decoder_name; 40 41 }; 41 42 42 43 static u32 ··· 616 615 struct cs_etm_trace_params *t_params, 617 616 struct cs_etm_decoder *decoder) 618 617 { 619 - const char *decoder_name; 620 618 ocsd_etmv3_cfg config_etmv3; 621 619 ocsd_etmv4_cfg trace_config_etmv4; 622 620 ocsd_ete_cfg trace_config_ete; ··· 626 626 case CS_ETM_PROTO_ETMV3: 627 627 case CS_ETM_PROTO_PTM: 628 628 cs_etm_decoder__gen_etmv3_config(t_params, &config_etmv3); 629 - decoder_name = (t_params->protocol == CS_ETM_PROTO_ETMV3) ? 629 + decoder->decoder_name = (t_params->protocol == CS_ETM_PROTO_ETMV3) ? 630 630 OCSD_BUILTIN_DCD_ETMV3 : 631 631 OCSD_BUILTIN_DCD_PTM; 632 632 trace_config = &config_etmv3; 633 633 break; 634 634 case CS_ETM_PROTO_ETMV4i: 635 635 cs_etm_decoder__gen_etmv4_config(t_params, &trace_config_etmv4); 636 - decoder_name = OCSD_BUILTIN_DCD_ETMV4I; 636 + decoder->decoder_name = OCSD_BUILTIN_DCD_ETMV4I; 637 637 trace_config = &trace_config_etmv4; 638 638 break; 639 639 case CS_ETM_PROTO_ETE: 640 640 cs_etm_decoder__gen_ete_config(t_params, &trace_config_ete); 641 - decoder_name = OCSD_BUILTIN_DCD_ETE; 641 + decoder->decoder_name = OCSD_BUILTIN_DCD_ETE; 642 642 trace_config = &trace_config_ete; 643 643 break; 644 644 default: ··· 647 647 648 648 if (d_params->operation == CS_ETM_OPERATION_DECODE) { 649 649 if (ocsd_dt_create_decoder(decoder->dcd_tree, 650 - decoder_name, 650 + decoder->decoder_name, 651 651 OCSD_CREATE_FLG_FULL_DECODER, 652 652 trace_config, &csid)) 653 653 return -1; ··· 659 659 660 660 return 0; 661 661 } else if (d_params->operation == CS_ETM_OPERATION_PRINT) { 662 - if (ocsd_dt_create_decoder(decoder->dcd_tree, decoder_name, 662 + if (ocsd_dt_create_decoder(decoder->dcd_tree, decoder->decoder_name, 663 663 OCSD_CREATE_FLG_PACKET_PROC, 664 664 trace_config, &csid)) 665 665 return -1; ··· 790 790 ocsd_destroy_dcd_tree(decoder->dcd_tree); 791 791 decoder->dcd_tree = NULL; 792 792 free(decoder); 793 + } 794 + 795 + const char *cs_etm_decoder__get_name(struct cs_etm_decoder *decoder) 796 + { 797 + return decoder->decoder_name; 793 798 }
+1
tools/perf/util/cs-etm-decoder/cs-etm-decoder.h
··· 104 104 struct cs_etm_packet *packet); 105 105 106 106 int cs_etm_decoder__reset(struct cs_etm_decoder *decoder); 107 + const char *cs_etm_decoder__get_name(struct cs_etm_decoder *decoder); 107 108 108 109 #endif /* INCLUDE__CS_ETM_DECODER_H__ */
+2 -2
tools/perf/util/cs-etm.c
··· 537 537 538 538 fprintf(stdout, "\n"); 539 539 color_fprintf(stdout, color, 540 - ". ... CoreSight ETM Trace data: size %zu bytes\n", 541 - buffer->size); 540 + ". ... CoreSight %s Trace data: size %zu bytes\n", 541 + cs_etm_decoder__get_name(etmq->decoder), buffer->size); 542 542 543 543 do { 544 544 size_t consumed;