aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Leach <mike.leach@linaro.org>2021-09-20 15:02:40 +0100
committerMike Leach <mike.leach@linaro.org>2021-10-10 10:07:15 +0100
commit0076cc63874d4f01495c123ad63b0a4a454d705e (patch)
tree663cf2dc10a27f7e6593414a2854afeaf5456b8d
parent80fe9f9e86133bd3cb35ad3332428600eaee3e92 (diff)
tests: Add printing of CS frame Demux stats to test program.
Signed-off-by: Mike Leach <mike.leach@linaro.org>
-rw-r--r--decoder/tests/source/trc_pkt_lister.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/decoder/tests/source/trc_pkt_lister.cpp b/decoder/tests/source/trc_pkt_lister.cpp
index 2a5490578b6a..9760351c9c7b 100644
--- a/decoder/tests/source/trc_pkt_lister.cpp
+++ b/decoder/tests/source/trc_pkt_lister.cpp
@@ -548,6 +548,8 @@ void PrintDecodeStats(DecodeTree *dcd_tree)
std::ostringstream oss;
ocsd_decode_stats_t *pStats = 0;
ocsd_err_t err;
+ bool gotDemuxStats = false;
+ ocsd_demux_stats_t demux_stats;
oss << "\nReading packet decoder statistics....\n\n";
logger.LogMsg(oss.str());
@@ -562,12 +564,36 @@ void PrintDecodeStats(DecodeTree *dcd_tree)
oss << "Decode stats ID 0x" << std::hex << (uint32_t)elemID << "\n";
oss << "Total Bytes: " << std::dec << pStats->channel_total << "; Unsynced Bytes: " << std::dec << pStats->channel_unsynced << "\n";
oss << "Bad Header Errors: " << std::dec << pStats->bad_header_errs << "; Bad Sequence Errors: " << std::dec << pStats->bad_sequence_errs << "\n";
+
+ // demux stats same for all IDs - grab them at the first opportunity..
+ if (!gotDemuxStats) {
+ memcpy(&demux_stats, &pStats->demux, sizeof(ocsd_demux_stats_t));
+ gotDemuxStats = true;
+ }
+
}
else
oss << "Decode stats unavailable on Trace ID 0x" << std::hex << (uint32_t)elemID << "\n";
+
+
logger.LogMsg(oss.str());
pElement = dcd_tree->getNextElement(elemID);
}
+
+ // if we have copied over the stats and there is at least 1 frame byte (impossible for there to be 0 if demuxing)
+ if (gotDemuxStats && demux_stats.frame_bytes) {
+ uint64_t total = demux_stats.valid_id_bytes + demux_stats.no_id_bytes + demux_stats.unknown_id_bytes +
+ demux_stats.reserved_id_bytes + demux_stats.frame_bytes;
+ oss.str("");
+ oss << "\nFrame Demux Stats\n";
+ oss << "Trace data bytes sent to registered ID decoders: " << std::dec << demux_stats.valid_id_bytes << "\n";
+ oss << "Trace data bytes without registered ID decoders: " << std::dec << demux_stats.no_id_bytes << "\n";
+ oss << "Trace data bytes with unknown ID: " << std::dec << demux_stats.unknown_id_bytes << "\n";
+ oss << "Trace data bytes with reserved ID: " << std::dec << demux_stats.reserved_id_bytes << "\n";
+ oss << "Frame demux bytes, ID bytes and sync bytes: " << std::dec << demux_stats.frame_bytes << "\n";
+ oss << "Total bytes processed by frame demux: " << std::dec << total << "\n\n";
+ logger.LogMsg(oss.str());
+ }
}
void ListTracePackets(ocsdDefaultErrorLogger &err_logger, SnapShotReader &reader, const std::string &trace_buffer_name)