aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2023-08-17 23:17:46 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-08-17 23:17:46 +0000
commitf5b765f4b5d7df2779b633c165890d75456d66d4 (patch)
tree206227736036adca89c831374f03a484ef61e376
parent8a67ed5dfbaa21c097a7caa9ede3f1b10a8d146e (diff)
parentfd783c2543f579a4924de3cd0a21c573c65fc846 (diff)
downloadOpenCSD-master.tar.gz
Upgrade OpenCSD to v1.4.1 am: 27fdda3f1d am: 2a0e3d5110 am: 651d6ea25b am: 11366d7057 am: fd783c2543HEADmastermain
Original change: https://android-review.googlesource.com/c/platform/external/OpenCSD/+/2715922 Change-Id: Iea8c2e7e87a1e1c824b8c4b51808dec29f7ce79b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--.gitignore1
-rw-r--r--METADATA8
-rw-r--r--README.md7
-rw-r--r--decoder/build/linux/ref_trace_decode_lib/makefile3
-rw-r--r--decoder/build/win-vs2022/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj1
-rw-r--r--decoder/build/win-vs2022/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj.filters3
-rw-r--r--decoder/docs/doxygen_config.dox2
-rw-r--r--decoder/include/opencsd/ocsd_if_version.h4
-rw-r--r--decoder/include/pkt_printers/gen_elem_printer.h40
-rw-r--r--decoder/include/pkt_printers/item_printer.h19
-rw-r--r--decoder/include/pkt_printers/pkt_printer_t.h6
-rw-r--r--decoder/source/c_api/ocsd_c_api.cpp8
-rw-r--r--decoder/source/etmv4/trc_etmv4_stack_elem.cpp9
-rw-r--r--decoder/source/ocsd_dcd_tree.cpp2
-rw-r--r--decoder/source/pkt_printers/gen_elem_printer.cpp122
-rw-r--r--decoder/source/pkt_printers/raw_frame_printer.cpp3
-rw-r--r--decoder/tests/build/win-vs2022/c_api_pkt_print_test/x64/Release/c_api_pkt_print_test.exe.recipe11
-rw-r--r--decoder/tests/build/win-vs2022/frame_demux_test/x64/Release/frame_demux_test.exe.recipe11
-rw-r--r--decoder/tests/build/win-vs2022/mem-buffer-eg/x64/Release/mem-buffer-eg.exe.recipe11
-rw-r--r--decoder/tests/build/win-vs2022/trc_pkt_lister/x64/Release/trc_pkt_lister.exe.recipe11
-rw-r--r--decoder/tests/source/trc_pkt_lister.cpp17
21 files changed, 207 insertions, 92 deletions
diff --git a/.gitignore b/.gitignore
index 9908c67..4385ae2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,3 +79,4 @@ decoder/docs/html/*
*.iobj
*.ipdb
decoder/tests/results*
+*.recipe \ No newline at end of file
diff --git a/METADATA b/METADATA
index dc28d14..937792e 100644
--- a/METADATA
+++ b/METADATA
@@ -1,6 +1,6 @@
# This project was upgraded with external_updater.
# Usage: tools/external_updater/updater.sh update OpenCSD
-# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
name: "OpenCSD"
description: "This library provides an API suitable for the decode of ARM(r) CoreSight(tm) trace streams."
@@ -13,11 +13,11 @@ third_party {
type: GIT
value: "https://github.com/Linaro/OpenCSD.git"
}
- version: "v1.4.0"
+ version: "v1.4.1"
license_type: RESTRICTED
last_upgrade_date {
year: 2023
- month: 1
- day: 20
+ month: 8
+ day: 17
}
}
diff --git a/README.md b/README.md
index 450c8e3..ec880be 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@ Releases will appear on the master branch in the git repository with an appropri
CoreSight Trace Component Support.
----------------------------------
-_Current Version 1.4.0_
+_Current Version 1.4.1_
### Current support:
@@ -291,6 +291,11 @@ Version and Modification Information
Adds in new generic output packet type: OCSD_GEN_TRC_ELEM_INSTRUMENTATION.
- __Bugfix__: Fix memory leak in mispredict handling (github issue #52 from yabinc)
+_Version 1.4.1_:
+ - __Update__: Test: Update test program trc_pkt_lister with option to have no logging output - final stats only.
+ - __Bugfix__: ETM4x: ETE: Fix memory leak / use after free (github issues #53, #58 from yabinc)
+ - __Bugfix__: C-API: Fix memory leak with output sink object. (github issue #55)
+
Licence Information
===================
diff --git a/decoder/build/linux/ref_trace_decode_lib/makefile b/decoder/build/linux/ref_trace_decode_lib/makefile
index 58d5c6e..3cdfcfd 100644
--- a/decoder/build/linux/ref_trace_decode_lib/makefile
+++ b/decoder/build/linux/ref_trace_decode_lib/makefile
@@ -86,7 +86,8 @@ STMOBJ= $(BUILD_DIR)/trc_pkt_elem_stm.o \
$(BUILD_DIR)/trc_pkt_decode_stm.o
PKTPRNTOBJ= $(BUILD_DIR)/raw_frame_printer.o \
- $(BUILD_DIR)/trc_print_fact.o
+ $(BUILD_DIR)/trc_print_fact.o \
+ $(BUILD_DIR)/gen_elem_printer.o
OBJECTS=$(BUILD_DIR)/ocsd_code_follower.o \
diff --git a/decoder/build/win-vs2022/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj b/decoder/build/win-vs2022/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj
index 13d34ab..30724aa 100644
--- a/decoder/build/win-vs2022/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj
+++ b/decoder/build/win-vs2022/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj
@@ -440,6 +440,7 @@
<ClCompile Include="..\..\..\source\ocsd_lib_dcd_register.cpp" />
<ClCompile Include="..\..\..\source\ocsd_msg_logger.cpp" />
<ClCompile Include="..\..\..\source\ocsd_version.cpp" />
+ <ClCompile Include="..\..\..\source\pkt_printers\gen_elem_printer.cpp" />
<ClCompile Include="..\..\..\source\pkt_printers\raw_frame_printer.cpp" />
<ClCompile Include="..\..\..\source\pkt_printers\trc_print_fact.cpp" />
<ClCompile Include="..\..\..\source\ptm\trc_cmp_cfg_ptm.cpp" />
diff --git a/decoder/build/win-vs2022/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj.filters b/decoder/build/win-vs2022/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj.filters
index 47e9a3a..4ec5327 100644
--- a/decoder/build/win-vs2022/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj.filters
+++ b/decoder/build/win-vs2022/ref_trace_decode_lib/ref_trace_decode_lib.vcxproj.filters
@@ -511,5 +511,8 @@
<ClCompile Include="..\..\..\source\ete\trc_cmp_cfg_ete.cpp">
<Filter>Source Files\ete</Filter>
</ClCompile>
+ <ClCompile Include="..\..\..\source\pkt_printers\gen_elem_printer.cpp">
+ <Filter>Source Files\pkt_printers</Filter>
+ </ClCompile>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/decoder/docs/doxygen_config.dox b/decoder/docs/doxygen_config.dox
index 7590e47..06ad074 100644
--- a/decoder/docs/doxygen_config.dox
+++ b/decoder/docs/doxygen_config.dox
@@ -38,7 +38,7 @@ PROJECT_NAME = "OpenCSD - CoreSight Trace Decode Library"
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = 1.4.0
+PROJECT_NUMBER = 1.4.1
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
diff --git a/decoder/include/opencsd/ocsd_if_version.h b/decoder/include/opencsd/ocsd_if_version.h
index 41033f0..cefbe6b 100644
--- a/decoder/include/opencsd/ocsd_if_version.h
+++ b/decoder/include/opencsd/ocsd_if_version.h
@@ -44,7 +44,7 @@
@{*/
#define OCSD_VER_MAJOR 0x1 /**< Library Major Version */
#define OCSD_VER_MINOR 0x4 /**< Library Minor Version */
-#define OCSD_VER_PATCH 0x0 /**< Library Patch Version */
+#define OCSD_VER_PATCH 0x1 /**< Library Patch Version */
/** Library version number - MMMMnnpp format.
MMMM = major version,
@@ -53,7 +53,7 @@
*/
#define OCSD_VER_NUM ((OCSD_VER_MAJOR << 16) | (OCSD_VER_MINOR << 8) | OCSD_VER_PATCH)
-#define OCSD_VER_STRING "1.4.0" /**< Library Version string */
+#define OCSD_VER_STRING "1.4.1" /**< Library Version string */
#define OCSD_LIB_NAME "OpenCSD Library" /**< Library name string */
#define OCSD_LIB_SHORT_NAME "OCSD" /**< Library Short name string */
/** @}*/
diff --git a/decoder/include/pkt_printers/gen_elem_printer.h b/decoder/include/pkt_printers/gen_elem_printer.h
index ba3138a..c3fe3aa 100644
--- a/decoder/include/pkt_printers/gen_elem_printer.h
+++ b/decoder/include/pkt_printers/gen_elem_printer.h
@@ -49,47 +49,15 @@ public:
// funtionality to test wait / flush mechanism
void ackWait() { m_needWaitAck = false; };
const bool needAckWait() const { return m_needWaitAck; };
+ void set_collect_stats() { m_collect_stats = true; };
+ void printStats();
protected:
bool m_needWaitAck;
+ bool m_collect_stats; // collect stats on packets processed
+ int m_packet_counts[(int)OCSD_GEN_TRC_ELEM_CUSTOM + 1];
};
-
-inline TrcGenericElementPrinter::TrcGenericElementPrinter() :
- m_needWaitAck(false)
-{
-}
-
-inline ocsd_datapath_resp_t TrcGenericElementPrinter::TraceElemIn(const ocsd_trc_index_t index_sop,
- const uint8_t trc_chan_id,
- const OcsdTraceElement &elem)
-{
- ocsd_datapath_resp_t resp = OCSD_RESP_CONT;
- std::string elemStr;
- std::ostringstream oss;
- oss << "Idx:" << index_sop << "; ID:"<< std::hex << (uint32_t)trc_chan_id << "; ";
- elem.toString(elemStr);
- oss << elemStr << std::endl;
- itemPrintLine(oss.str());
-
- // funtionality to test wait / flush mechanism
- if(m_needWaitAck)
- {
- oss.str("");
- oss << "WARNING: Generic Element Printer; New element without previous _WAIT acknowledged\n";
- itemPrintLine(oss.str());
- m_needWaitAck = false;
- }
-
- if(getTestWaits())
- {
- resp = OCSD_RESP_WAIT; // return _WAIT for the 1st N packets.
- decTestWaits();
- m_needWaitAck = true;
- }
- return resp;
-}
-
#endif // ARM_GEN_ELEM_PRINTER_H_INCLUDED
/* End of File gen_elem_printer.h */
diff --git a/decoder/include/pkt_printers/item_printer.h b/decoder/include/pkt_printers/item_printer.h
index cc3ec37..0f1feeb 100644
--- a/decoder/include/pkt_printers/item_printer.h
+++ b/decoder/include/pkt_printers/item_printer.h
@@ -52,14 +52,21 @@ public:
const int getTestWaits() const;
void decTestWaits();
+ // mute printers when profiling
+ void setMute(bool mute);
+ const bool is_muted() const;
+
+
protected:
ocsdMsgLogger *m_pMsgLogger;
int m_test_waits;
+ bool m_mute;
};
inline ItemPrinter::ItemPrinter() :
m_pMsgLogger(0),
- m_test_waits(0)
+ m_test_waits(0),
+ m_mute(false)
{
}
@@ -89,6 +96,16 @@ inline void ItemPrinter::decTestWaits()
m_test_waits--;
}
+inline void ItemPrinter::setMute(bool mute)
+{
+ m_mute = mute;
+}
+
+inline const bool ItemPrinter::is_muted() const
+{
+ return m_mute;
+}
+
#endif // ARM_ITEM_PRINTER_H_INCLUDED
/* End of File item_printer.h */
diff --git a/decoder/include/pkt_printers/pkt_printer_t.h b/decoder/include/pkt_printers/pkt_printer_t.h
index c00daa1..f2d3e09 100644
--- a/decoder/include/pkt_printers/pkt_printer_t.h
+++ b/decoder/include/pkt_printers/pkt_printer_t.h
@@ -97,6 +97,9 @@ template<class P> ocsd_datapath_resp_t PacketPrinter<P>::PacketDataIn( const ocs
{
std::string pktstr;
ocsd_datapath_resp_t resp = OCSD_RESP_CONT;
+
+ if (is_muted())
+ return resp;
// wait / flush test verification
if(!m_bRawPrint && (m_last_resp == OCSD_RESP_WAIT))
@@ -152,6 +155,9 @@ template<class P> void PacketPrinter<P>::RawPacketDataMon( const ocsd_datapath_o
const uint32_t size,
const uint8_t *p_data)
{
+ if (is_muted())
+ return;
+
switch(op)
{
case OCSD_OP_DATA:
diff --git a/decoder/source/c_api/ocsd_c_api.cpp b/decoder/source/c_api/ocsd_c_api.cpp
index 750c847..2cc2334 100644
--- a/decoder/source/c_api/ocsd_c_api.cpp
+++ b/decoder/source/c_api/ocsd_c_api.cpp
@@ -256,8 +256,16 @@ OCSD_C_API ocsd_err_t ocsd_dt_set_gen_elem_outfn(const dcd_tree_handle_t handle,
{
GenTraceElemCBObj * pCBObj = new (std::nothrow)GenTraceElemCBObj(pFn, p_context);
+ ITrcGenElemIn* pCurrIF;
+
if(pCBObj)
{
+ /* delete any previous element we might have set */
+ pCurrIF = ((DecodeTree*)handle)->getGenTraceElemOutI();
+ if (pCurrIF)
+ delete static_cast<GenTraceElemCBObj*>(pCurrIF);
+
+ /* set the new one */
((DecodeTree *)handle)->setGenTraceElemOutI(pCBObj);
return OCSD_OK;
}
diff --git a/decoder/source/etmv4/trc_etmv4_stack_elem.cpp b/decoder/source/etmv4/trc_etmv4_stack_elem.cpp
index a5d8894..be7221c 100644
--- a/decoder/source/etmv4/trc_etmv4_stack_elem.cpp
+++ b/decoder/source/etmv4/trc_etmv4_stack_elem.cpp
@@ -181,13 +181,18 @@ TrcStackElem *EtmV4P0Stack::from_front_next()
void EtmV4P0Stack::erase_curr_from_front()
{
std::deque<TrcStackElem *>::iterator erase_iter;
+
erase_iter = m_iter;
erase_iter--;
- m_P0_stack.erase(erase_iter);
+ TrcStackElem* pElem = *erase_iter;
+
+ // prevent overrun if we are erasing the last element
+ // - end() returned if no elements after the erased one.
+ m_iter = m_P0_stack.erase(erase_iter);
// explicitly delete the item here as the caller can no longer reference it.
// fixes memory leak from github issue #52
- delete *erase_iter;
+ delete pElem;
}
diff --git a/decoder/source/ocsd_dcd_tree.cpp b/decoder/source/ocsd_dcd_tree.cpp
index 8e29269..49ceb92 100644
--- a/decoder/source/ocsd_dcd_tree.cpp
+++ b/decoder/source/ocsd_dcd_tree.cpp
@@ -174,6 +174,8 @@ void DecodeTree::setGenTraceElemOutI(ITrcGenElemIn *i_gen_trace_elem)
pElem->getDecoderMngr()->attachOutputSink(pElem->getDecoderHandle(),i_gen_trace_elem);
pElem = getNextElement(elemID);
}
+ /* set local copy of interface to return in getGenTraceElemOutI */
+ m_i_gen_elem_out = i_gen_trace_elem;
}
ocsd_err_t DecodeTree::createMemAccMapper(memacc_mapper_t type /* = MEMACC_MAP_GLOBAL*/ )
diff --git a/decoder/source/pkt_printers/gen_elem_printer.cpp b/decoder/source/pkt_printers/gen_elem_printer.cpp
new file mode 100644
index 0000000..ffd9a2d
--- /dev/null
+++ b/decoder/source/pkt_printers/gen_elem_printer.cpp
@@ -0,0 +1,122 @@
+/*
+ * \file gen_elem_printer.cpp
+ * \brief OpenCSD : Generic element printer class.
+ *
+ * \copyright Copyright (c) 2015,2023 ARM Limited. All Rights Reserved.
+ */
+
+ /*
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string>
+#include <sstream>
+#include <iomanip>
+
+#include "opencsd.h"
+
+TrcGenericElementPrinter::TrcGenericElementPrinter() :
+ m_needWaitAck(false),
+ m_collect_stats(false)
+{
+ for (int i = 0; i <= (int)OCSD_GEN_TRC_ELEM_CUSTOM; i++)
+ m_packet_counts[i] = 0;
+}
+
+ocsd_datapath_resp_t TrcGenericElementPrinter::TraceElemIn(const ocsd_trc_index_t index_sop,
+ const uint8_t trc_chan_id,
+ const OcsdTraceElement& elem)
+{
+ ocsd_datapath_resp_t resp = OCSD_RESP_CONT;
+
+ if (m_collect_stats)
+ m_packet_counts[(int)elem.getType()]++;
+
+ if (is_muted())
+ return resp;
+
+ std::string elemStr;
+ std::ostringstream oss;
+ oss << "Idx:" << index_sop << "; ID:" << std::hex << (uint32_t)trc_chan_id << "; ";
+ elem.toString(elemStr);
+ oss << elemStr << std::endl;
+ itemPrintLine(oss.str());
+
+ // funtionality to test wait / flush mechanism
+ if (m_needWaitAck)
+ {
+ oss.str("");
+ oss << "WARNING: Generic Element Printer; New element without previous _WAIT acknowledged\n";
+ itemPrintLine(oss.str());
+ m_needWaitAck = false;
+ }
+
+ if (getTestWaits())
+ {
+ resp = OCSD_RESP_WAIT; // return _WAIT for the 1st N packets.
+ decTestWaits();
+ m_needWaitAck = true;
+ }
+ return resp;
+}
+
+void TrcGenericElementPrinter::printStats()
+{
+ static const char* gen_elem_packet_names[] = {
+ "OCSD_GEN_TRC_ELEM_UNKNOWN",
+ "OCSD_GEN_TRC_ELEM_NO_SYNC",
+ "OCSD_GEN_TRC_ELEM_TRACE_ON",
+ "OCSD_GEN_TRC_ELEM_EO_TRACE",
+ "OCSD_GEN_TRC_ELEM_PE_CONTEXT",
+ "OCSD_GEN_TRC_ELEM_INSTR_RANGE",
+ "OCSD_GEN_TRC_ELEM_I_RANGE_NOPATH",
+ "OCSD_GEN_TRC_ELEM_ADDR_NACC",
+ "OCSD_GEN_TRC_ELEM_ADDR_UNKNOWN",
+ "OCSD_GEN_TRC_ELEM_EXCEPTION",
+ "OCSD_GEN_TRC_ELEM_EXCEPTION_RET",
+ "OCSD_GEN_TRC_ELEM_TIMESTAMP",
+ "OCSD_GEN_TRC_ELEM_CYCLE_COUNT",
+ "OCSD_GEN_TRC_ELEM_EVENT",
+ "OCSD_GEN_TRC_ELEM_SWTRACE",
+ "OCSD_GEN_TRC_ELEM_SYNC_MARKER",
+ "OCSD_GEN_TRC_ELEM_MEMTRANS",
+ "OCSD_GEN_TRC_ELEM_INSTRUMENTATION",
+ "OCSD_GEN_TRC_ELEM_CUSTOM",
+ };
+
+ std::ostringstream oss;
+
+ oss << "Generic Packets processed:-\n";
+ for (int i = 0; i <= OCSD_GEN_TRC_ELEM_CUSTOM; i++)
+ {
+ oss << gen_elem_packet_names[i] << " : " << m_packet_counts[i] << "\n";
+ }
+ oss << "\n\n";
+
+ itemPrintLine(oss.str());
+}
+
+
diff --git a/decoder/source/pkt_printers/raw_frame_printer.cpp b/decoder/source/pkt_printers/raw_frame_printer.cpp
index 7ac2ddf..421d88d 100644
--- a/decoder/source/pkt_printers/raw_frame_printer.cpp
+++ b/decoder/source/pkt_printers/raw_frame_printer.cpp
@@ -47,6 +47,9 @@ ocsd_err_t RawFramePrinter::TraceRawFrameIn( const ocsd_datapath_op_t op,
const uint8_t traceID)
{
+ if (is_muted())
+ return OCSD_OK;
+
if(op == OCSD_OP_DATA) // only interested in actual frame data.
{
std::string strData;
diff --git a/decoder/tests/build/win-vs2022/c_api_pkt_print_test/x64/Release/c_api_pkt_print_test.exe.recipe b/decoder/tests/build/win-vs2022/c_api_pkt_print_test/x64/Release/c_api_pkt_print_test.exe.recipe
deleted file mode 100644
index 6707fc0..0000000
--- a/decoder/tests/build/win-vs2022/c_api_pkt_print_test/x64/Release/c_api_pkt_print_test.exe.recipe
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project>
- <ProjectOutputs>
- <ProjectOutput>
- <FullPath>C:\work\OpenCSD\ocsd-linaro\decoder\tests\bin\win64\rel\c_api_pkt_print_test.exe</FullPath>
- </ProjectOutput>
- </ProjectOutputs>
- <ContentFiles />
- <SatelliteDlls />
- <NonRecipeFileRefs />
-</Project> \ No newline at end of file
diff --git a/decoder/tests/build/win-vs2022/frame_demux_test/x64/Release/frame_demux_test.exe.recipe b/decoder/tests/build/win-vs2022/frame_demux_test/x64/Release/frame_demux_test.exe.recipe
deleted file mode 100644
index c98207c..0000000
--- a/decoder/tests/build/win-vs2022/frame_demux_test/x64/Release/frame_demux_test.exe.recipe
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project>
- <ProjectOutputs>
- <ProjectOutput>
- <FullPath>C:\work\OpenCSD\ocsd-linaro\decoder\tests\bin\win64\rel\frame_demux_test.exe</FullPath>
- </ProjectOutput>
- </ProjectOutputs>
- <ContentFiles />
- <SatelliteDlls />
- <NonRecipeFileRefs />
-</Project> \ No newline at end of file
diff --git a/decoder/tests/build/win-vs2022/mem-buffer-eg/x64/Release/mem-buffer-eg.exe.recipe b/decoder/tests/build/win-vs2022/mem-buffer-eg/x64/Release/mem-buffer-eg.exe.recipe
deleted file mode 100644
index 1f4bcbb..0000000
--- a/decoder/tests/build/win-vs2022/mem-buffer-eg/x64/Release/mem-buffer-eg.exe.recipe
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project>
- <ProjectOutputs>
- <ProjectOutput>
- <FullPath>C:\work\OpenCSD\ocsd-linaro\decoder\tests\bin\win64\rel\mem-buffer-eg.exe</FullPath>
- </ProjectOutput>
- </ProjectOutputs>
- <ContentFiles />
- <SatelliteDlls />
- <NonRecipeFileRefs />
-</Project> \ No newline at end of file
diff --git a/decoder/tests/build/win-vs2022/trc_pkt_lister/x64/Release/trc_pkt_lister.exe.recipe b/decoder/tests/build/win-vs2022/trc_pkt_lister/x64/Release/trc_pkt_lister.exe.recipe
deleted file mode 100644
index 69966dc..0000000
--- a/decoder/tests/build/win-vs2022/trc_pkt_lister/x64/Release/trc_pkt_lister.exe.recipe
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project>
- <ProjectOutputs>
- <ProjectOutput>
- <FullPath>C:\work\OpenCSD\ocsd-linaro\decoder\tests\bin\win64\rel\trc_pkt_lister.exe</FullPath>
- </ProjectOutput>
- </ProjectOutputs>
- <ContentFiles />
- <SatelliteDlls />
- <NonRecipeFileRefs />
-</Project> \ No newline at end of file
diff --git a/decoder/tests/source/trc_pkt_lister.cpp b/decoder/tests/source/trc_pkt_lister.cpp
index 9760351..83f8b85 100644
--- a/decoder/tests/source/trc_pkt_lister.cpp
+++ b/decoder/tests/source/trc_pkt_lister.cpp
@@ -75,6 +75,7 @@ static bool tpiu_format = false;
static bool has_hsync = false;
static bool src_addr_n = false;
static bool stats = false;
+static bool profile = false;
int main(int argc, char* argv[])
{
@@ -197,6 +198,7 @@ void print_help()
oss << "-test_waits <N> Force wait from packet printer for N packets - test the wait/flush mechanisms for the decoder\n";
oss << "-src_addr_n ETE protocol: Split source address ranges on N atoms\n";
oss << "-stats Output packet processing statistics (if available).\n";
+ oss << "-profile Mute logging output while profiling library performance\n";
oss << "\nOutput:\n";
oss << " Setting any of these options cancels the default output to file & stdout,\n using _only_ the options supplied.\n\n";
oss << "-logstdout Output to stdout -> console.\n";
@@ -432,6 +434,10 @@ bool process_cmd_line_opts(int argc, char* argv[])
has_hsync = true;
tpiu_format = true;
}
+ else if (strcmp(argv[optIdx], "-profile") == 0)
+ {
+ profile = true;
+ }
else
{
std::ostringstream errstr;
@@ -505,6 +511,8 @@ void AttachPacketPrinters( DecodeTree *dcd_tree)
else
oss << "Trace Packet Lister : Failed to Protocol printer " << pElement->getDecoderTypeName() << " on Trace ID 0x" << std::hex << (uint32_t)elemID << "\n";
logger.LogMsg(oss.str());
+ if (profile)
+ pPrinter->setMute(true);
}
pElement = dcd_tree->getNextElement(elemID);
@@ -613,6 +621,8 @@ void ListTracePackets(ocsdDefaultErrorLogger &err_logger, SnapShotReader &reader
AttachPacketPrinters(dcd_tree);
ConfigureFrameDeMux(dcd_tree, &framePrinter);
+ if (profile && framePrinter)
+ framePrinter->setMute(true);
// if decoding set the generic element printer to the output interface on the tree.
if(decode)
@@ -623,6 +633,11 @@ void ListTracePackets(ocsdDefaultErrorLogger &err_logger, SnapShotReader &reader
oss << "Trace Packet Lister : Set trace element decode printer\n";
logger.LogMsg(oss.str());
genElemPrinter->setTestWaits(test_waits);
+ if (profile)
+ {
+ genElemPrinter->setMute(true);
+ genElemPrinter->set_collect_stats();
+ }
}
if(decode)
@@ -741,6 +756,8 @@ void ListTracePackets(ocsdDefaultErrorLogger &err_logger, SnapShotReader &reader
logger.LogMsg(oss.str());
if (stats)
PrintDecodeStats(dcd_tree);
+ if (profile)
+ genElemPrinter->printStats();
}
else
{