The decoder is quite noisy when being reset. Now that dump-raw-trace
uses a code path that resets the decoder rather than creating a new
one, printing has to be suppressed to not flood the output.

Signed-off-by: James Clark <[email protected]>
---
 tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 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 3f4bc4050477..e0d530d94e1e 100644
--- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
+++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
@@ -32,6 +32,7 @@
 struct cs_etm_decoder {
        void *data;
        void (*packet_printer)(const char *msg);
+       bool suppress_printing;
        dcd_tree_handle_t dcd_tree;
        cs_etm_mem_cb_type mem_access;
        ocsd_datapath_resp_t prev_return;
@@ -71,9 +72,10 @@ int cs_etm_decoder__reset(struct cs_etm_decoder *decoder)
        ocsd_datapath_resp_t dp_ret;
 
        decoder->prev_return = OCSD_RESP_CONT;
-
+       decoder->suppress_printing = true;
        dp_ret = ocsd_dt_process_data(decoder->dcd_tree, OCSD_OP_RESET,
                                      0, 0, NULL, NULL);
+       decoder->suppress_printing = false;
        if (OCSD_DATA_RESP_IS_FATAL(dp_ret))
                return -1;
 
@@ -143,8 +145,10 @@ static void cs_etm_decoder__print_str_cb(const void 
*p_context,
                                         const char *msg,
                                         const int str_len)
 {
-       if (p_context && str_len)
-               ((struct cs_etm_decoder *)p_context)->packet_printer(msg);
+       const struct cs_etm_decoder *decoder = p_context;
+
+       if (p_context && str_len && !decoder->suppress_printing)
+               decoder->packet_printer(msg);
 }
 
 static int
-- 
2.28.0

Reply via email to