OpenCSD 0v004 provides a more scaleable and generic API for decoder creation. This patch fixes the cs-etm-decoder in perf report to use the new API.
Mike Leach (1): cs-etm: Update to perf cs-etm decode for new C API
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 34 +++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-)
Removes the deprecated protocol specific C API function calls used to create decoders, replacing them with the general create by protocol name API.
Fix typename moved from C API to more global ocsd_ API types.
Signed-off-by: Mike Leach mike.leach@linaro.org --- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 34 +++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index ef36f02..7c4d27a 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -253,7 +253,8 @@ static int cs_etm_decoder__create_etmv4i_packet_printer(struct cs_etm_decoder_pa { ocsd_etmv4_cfg trace_config; int ret = 0; - + unsigned char CSID; /* CSID extracted from the config data */ + if (d_params->packet_printer == NULL) return -1;
@@ -264,11 +265,20 @@ static int cs_etm_decoder__create_etmv4i_packet_printer(struct cs_etm_decoder_pa
decoder->packet_printer = d_params->packet_printer;
- ret = ocsd_dt_create_etmv4i_pkt_proc(decoder->dcd_tree, - &trace_config, - cs_etm_decoder__etmv4i_packet_printer, - decoder); + ret = ocsd_dt_create_decoder(decoder->dcd_tree, + OCSD_BUILTIN_DCD_ETMV4I, + OCSD_CREATE_FLG_PACKET_PROC, + (void *)&trace_config, + &CSID); + + if(ret != 0) + return -1;
+ ret = ocsd_dt_attach_packet_callback(decoder->dcd_tree, + CSID, + OCSD_C_API_CB_PKT_SINK, + cs_etm_decoder__etmv4i_packet_printer, + decoder); return ret; }
@@ -277,16 +287,19 @@ static int cs_etm_decoder__create_etmv4i_packet_decoder(struct cs_etm_decoder_pa { ocsd_etmv4_cfg trace_config; int ret = 0; + unsigned char CSID; /* CSID extracted from the config data */ + decoder->packet_printer = d_params->packet_printer;
ret = cs_etm_decoder__gen_etmv4_config(t_params,&trace_config);
if (ret != 0) return -1; - - ret = ocsd_dt_create_etmv4i_decoder(decoder->dcd_tree,&trace_config); - - if (ret != OCSD_OK) + + ret = ocsd_dt_create_decoder(decoder->dcd_tree,OCSD_BUILTIN_DCD_ETMV4I, + OCSD_CREATE_FLG_FULL_DECODER,(void *)&trace_config, &CSID); + + if (ret != 0) return -1;
ret = ocsd_dt_set_gen_elem_outfn(decoder->dcd_tree, @@ -294,6 +307,7 @@ static int cs_etm_decoder__create_etmv4i_packet_decoder(struct cs_etm_decoder_pa return ret; }
+ int cs_etm_decoder__add_mem_access_cb(struct cs_etm_decoder *decoder, uint64_t address, uint64_t len, cs_etm_mem_cb_type cb_func) { int err; @@ -312,7 +326,7 @@ int cs_etm_decoder__add_mem_access_cb(struct cs_etm_decoder *decoder, uint64_t a int cs_etm_decoder__add_bin_file(struct cs_etm_decoder *decoder, uint64_t offset, uint64_t address, uint64_t len, const char *fname) { int err = 0; - file_mem_region_t region; + ocsd_file_mem_region_t region;
(void) len; if (NULL == decoder)
On 1 August 2016 at 08:57, Mike Leach mike.leach@linaro.org wrote:
Removes the deprecated protocol specific C API function calls used to create decoders, replacing them with the general create by protocol name API.
Fix typename moved from C API to more global ocsd_ API types.
Since this patch is going to the kernel tree, please run checkpatch.pl on it.
Signed-off-by: Mike Leach mike.leach@linaro.org
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 34 +++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index ef36f02..7c4d27a 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -253,7 +253,8 @@ static int cs_etm_decoder__create_etmv4i_packet_printer(struct cs_etm_decoder_pa { ocsd_etmv4_cfg trace_config; int ret = 0;
unsigned char CSID; /* CSID extracted from the config data */
if (d_params->packet_printer == NULL) return -1;
@@ -264,11 +265,20 @@ static int cs_etm_decoder__create_etmv4i_packet_printer(struct cs_etm_decoder_pa
decoder->packet_printer = d_params->packet_printer;
ret = ocsd_dt_create_etmv4i_pkt_proc(decoder->dcd_tree,
&trace_config,
cs_etm_decoder__etmv4i_packet_printer,
decoder);
ret = ocsd_dt_create_decoder(decoder->dcd_tree,
OCSD_BUILTIN_DCD_ETMV4I,
OCSD_CREATE_FLG_PACKET_PROC,
(void *)&trace_config,
&CSID);
if(ret != 0)
return -1;
ret = ocsd_dt_attach_packet_callback(decoder->dcd_tree,
CSID,
OCSD_C_API_CB_PKT_SINK,
cs_etm_decoder__etmv4i_packet_printer,
decoder); return ret;
}
@@ -277,16 +287,19 @@ static int cs_etm_decoder__create_etmv4i_packet_decoder(struct cs_etm_decoder_pa { ocsd_etmv4_cfg trace_config; int ret = 0;
unsigned char CSID; /* CSID extracted from the config data */
decoder->packet_printer = d_params->packet_printer; ret = cs_etm_decoder__gen_etmv4_config(t_params,&trace_config); if (ret != 0) return -1;
ret = ocsd_dt_create_etmv4i_decoder(decoder->dcd_tree,&trace_config);
if (ret != OCSD_OK)
ret = ocsd_dt_create_decoder(decoder->dcd_tree,OCSD_BUILTIN_DCD_ETMV4I,
OCSD_CREATE_FLG_FULL_DECODER,(void *)&trace_config, &CSID);
if (ret != 0) return -1; ret = ocsd_dt_set_gen_elem_outfn(decoder->dcd_tree,
@@ -294,6 +307,7 @@ static int cs_etm_decoder__create_etmv4i_packet_decoder(struct cs_etm_decoder_pa return ret; }
int cs_etm_decoder__add_mem_access_cb(struct cs_etm_decoder *decoder, uint64_t address, uint64_t len, cs_etm_mem_cb_type cb_func) { int err; @@ -312,7 +326,7 @@ int cs_etm_decoder__add_mem_access_cb(struct cs_etm_decoder *decoder, uint64_t a int cs_etm_decoder__add_bin_file(struct cs_etm_decoder *decoder, uint64_t offset, uint64_t address, uint64_t len, const char *fname) { int err = 0;
file_mem_region_t region;
ocsd_file_mem_region_t region; (void) len; if (NULL == decoder)
-- 2.7.4