OpenCSD v0.4 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.
Removes the deprecated protocol specific C API function calls used to create decoders, replacing them with the general create by protocol name API introduced in OpenCSD v0.4
Fix typename move 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 | 31 +++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 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..a76109c 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -253,6 +253,7 @@ 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,6 +287,8 @@ 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); @@ -284,9 +296,13 @@ static int cs_etm_decoder__create_etmv4i_packet_decoder(struct cs_etm_decoder_pa if (ret != 0) return -1;
- ret = ocsd_dt_create_etmv4i_decoder(decoder->dcd_tree,&trace_config); + ret = ocsd_dt_create_decoder(decoder->dcd_tree, + OCSD_BUILTIN_DCD_ETMV4I, + OCSD_CREATE_FLG_FULL_DECODER, + (void *)&trace_config, + &CSID);
- if (ret != OCSD_OK) + if (ret != 0) return -1;
ret = ocsd_dt_set_gen_elem_outfn(decoder->dcd_tree, @@ -294,6 +310,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 +329,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 12 August 2016 at 05:39, Mike Leach mike.leach@linaro.org wrote:
OpenCSD v0.4 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.
Removes the deprecated protocol specific C API function calls used to create decoders, replacing them with the general create by protocol name API introduced in OpenCSD v0.4
Fix typename move 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 | 31 +++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 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..a76109c 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -253,6 +253,7 @@ 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 */
By convention variable names in capital letters are generally reserved for #defines - in this case please use lower caps.
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,6 +287,8 @@ 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 */
Same comment as above.
decoder->packet_printer = d_params->packet_printer; ret = cs_etm_decoder__gen_etmv4_config(t_params,&trace_config);
@@ -284,9 +296,13 @@ static int cs_etm_decoder__create_etmv4i_packet_decoder(struct cs_etm_decoder_pa if (ret != 0) return -1;
ret = ocsd_dt_create_etmv4i_decoder(decoder->dcd_tree,&trace_config);
ret = ocsd_dt_create_decoder(decoder->dcd_tree,
OCSD_BUILTIN_DCD_ETMV4I,
OCSD_CREATE_FLG_FULL_DECODER,
(void *)&trace_config,
&CSID);
if (ret != OCSD_OK)
if (ret != 0) return -1; ret = ocsd_dt_set_gen_elem_outfn(decoder->dcd_tree,
@@ -294,6 +310,7 @@ static int cs_etm_decoder__create_etmv4i_packet_decoder(struct cs_etm_decoder_pa return ret; }
Spurious newline.
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 +329,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
With the above modifications,
Acked-by: Mathieu Poirier mathieu.poirier@linaro.org