Skip to content

ctrace initial development - #2548

Open
thorstendb-ARM wants to merge 37 commits into
mainfrom
ctrace-dev1
Open

ctrace initial development#2548
thorstendb-ARM wants to merge 37 commits into
mainfrom
ctrace-dev1

Conversation

@thorstendb-ARM

Copy link
Copy Markdown
Contributor

Implements

  • Adds the initial ctrace implementation for decoding SWO streams containing ITM and DWT data.
  • Provides CSV and CTF/Trace Compass output.
  • Includes unit and integration tests, documentation, and cross-platform build and release support.

Limitations

  • Trace Bus input, PMU events, event counters, and PC sampling are not supported in the initial release.

Checklist

  • 🤖 This change is covered by unit tests (if applicable).
  • 🤹 Manual testing has been performed (if necessary).
  • 🛡️ Security impacts have been considered (if relevant).
  • 📖 Documentation updates are complete (if required).
  • 🧠 Third-party dependencies and TPIP updated (if required).

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Test Results

  2 files   -    39   14 suites   - 111   11m 45s ⏱️ - 6m 46s
477 tests  -   454  477 ✅  - 437  0 💤  - 17  0 ❌ ±0 
954 runs   - 1 047  954 ✅  - 996  0 💤  - 51  0 ❌ ±0 

Results for commit 6fbf7f9. ± Comparison against base commit fba299a.

This pull request removes 454 tests.
AuxCmdTests ‑ MkdirCmdTest
AuxCmdTests ‑ RmdirCmdTest
AuxCmdTests ‑ TouchCmdTest
BuildSystemGeneratorTests ‑ GenAuditFile
BuildSystemGeneratorTests ‑ GenAuditFile_WithOut_Existing_Audit_File
BuildSystemGeneratorTests ‑ GenAuditFile_With_Existing_Audit_File
BuildSystemGeneratorTests ‑ GetString
BuildSystemGeneratorTests ‑ StrConv
BuildSystemGeneratorTests ‑ StrNorm
CBuildGCCTests ‑ Asm
…

♻️ This comment has been updated with latest results.

Comment thread tools/ctrace/src/decode/OpenCsdErrorController.cpp Fixed
Comment thread tools/ctrace/src/output/OutputRequirements.cpp Fixed
Comment thread tools/ctrace/src/output/ctf/CtfMetadataWriter.cpp Fixed
Comment thread tools/ctrace/src/output/ctf/TraceCompassXmlWriter.cpp Fixed
Comment thread tools/ctrace/src/tracerun/YmlTraceRunConfigReader.cpp Fixed
Comment thread tools/ctrace/test/unit/src/cli/CliParserTests.cpp Fixed
Comment thread tools/ctrace/test/unit/src/output/OutputRequirementsTests.cpp Fixed
Comment thread tools/ctrace/test/unit/src/decode/OpenCsdPacketCollectorTests.cpp Fixed

@thorstendb-ARM thorstendb-ARM left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added unit tests

@jreineckearm jreineckearm left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had a look at the first few files in this PR (the GH workflows). You may want to review those first. I think some of them will impact more than ctrace.
Also, why do you make workflows sensitive to changes in subfolders of external? I don't think GitHub actions are clever enough to detect changes in git submodules. But I might be wrong.

Comment thread .github/workflows/ctrace.yml Outdated
Comment thread .github/workflows/ctrace.yml Outdated
Comment thread .github/workflows/ctrace.yml Outdated
Comment thread .github/workflows/ctrace.yml Outdated
Comment thread .github/workflows/ctrace.yml Outdated
Comment thread tools/ctrace/src/control/DecodeConsumers.cpp Outdated
Comment thread tools/ctrace/src/control/FileDecodeJob.cpp
Comment thread tools/ctrace/src/decode/CortexMStreamDecoder.cpp Outdated
Comment thread tools/ctrace/src/decode/DwtPacketDecoder.cpp Outdated
Comment thread tools/ctrace/src/decode/OpenCsdErrorController.cpp Outdated
@thorstendb-ARM thorstendb-ARM changed the title Ctrace dev1 Ctrace initial development Aug 3, 2026
@thorstendb-ARM thorstendb-ARM changed the title Ctrace initial development ctrace initial development Aug 3, 2026

@edriouk edriouk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all ctrace* project files must have Header File directory => changes in CMakeLists.txt files are required:

SET(PROJMGR_HEADER_FILES ...

@edriouk edriouk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All classes and their public methods must have DOXYGEN-style comments

@edriouk

edriouk commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

test/data folders contain *.license files. They probably should be removed.

Comment thread tools/ctrace/src/cli/CliParser.cpp Fixed
Comment thread tools/ctrace/src/decode/OpenCsdItmSession.cpp Fixed
edriouk
edriouk previously approved these changes Aug 4, 2026

@edriouk edriouk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
successfully compiled and run tests locally on Windows

edriouk
edriouk previously approved these changes Aug 4, 2026

@edriouk edriouk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Simplify diagnostics and trace metadata handling, remove stale APIs and schema entries, and align output selection behavior.

Refresh platform test support, documentation, and release-facing validation.
Comment thread tools/ctrace/src/tracerun/CtraceRunMeta.cpp Fixed

@jreineckearm jreineckearm left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Light-weight review of all but the ctrace test subfolder. See comments.
Overall massive improvement since initial push. No more systematic flaws like the LCOV excludes or use of #pragma once.

Comment thread .github/workflows/ctrace.yml Outdated

- name: Archive unit tests results
# Keep the report available when test execution fails.
if: always() && (matrix.arch != 'arm64')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just learnt what always() is: makes a step execute even if previous ones failed.
I think both "run" and "archive" steps should have it or remove it. As is, "run" has it removed, "archive" has it and depends on "run" results.

endif()

set_property(TARGET opencsd_options PROPERTY INTERFACE_COMPILE_OPTIONS)
target_compile_options(opencsd PRIVATE /EHsc /W0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we want to show some warnings? /W0 hides them all. I think msvc has couple of /W levels/

@@ -0,0 +1,288 @@
# ctrace Architecture

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe split internal engineering docs from later end user docs, i.e. introduce a folder internal-docs or developer-docs.

#include <stdexcept>

/** @brief Provides checked saturating arithmetic for trace timestamps. */
class SaturatingArithmetic final {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread tools/ctrace/src/tracerun/TraceRunDiscovery.cpp
Comment thread tools/ctrace/src/tracerun/YmlTraceRunConfigReader.cpp
Comment thread tools/ctrace/README.md
@@ -0,0 +1,123 @@
# ctrace

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good for now, consider split into README ("landing page" on GH) and developer docs.

Comment thread CMakeLists.txt Outdated
apply_patch(${CMAKE_CURRENT_SOURCE_DIR}/external/xerces-c)
apply_patch(${CMAKE_CURRENT_SOURCE_DIR}/external/yaml-cpp)

# OpenCSD is a private build dependency of ctrace.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would probably do just to call it a build dependency unless "private" has a special meaning here (which I didn't get if so).

Comment thread LICENSE.md Outdated
|Google C++ Testing Framework|1.11.0|[BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)|https://github.com/google/googletest.git| Testing |
|cxxopts|2.2.1|[MIT](https://opensource.org/licenses/MIT)|https://github.com/jarro2783/cxxopts.git| packgen |
|yaml-cpp|0.7.0|[MIT](https://opensource.org/licenses/MIT)|https://github.com/jbeder/yaml-cpp.git| packgen |
|cxxopts|3.0.0|[MIT](https://opensource.org/licenses/MIT)|https://github.com/jarro2783/cxxopts.git| packgen, ctrace (statically incorporated) |

@jreineckearm jreineckearm Aug 6, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't have the parts in parenthesis before. Probably should keep it that way, i.e. remove them. Same for the next two entries.

Comment thread LICENSE.md Outdated

<!-- markdownlint-restore -->

Dependency modifications incorporated into ctrace are documented in its

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you removed dependency modifications for ctrace? Would remove the entire paragraph.

@@ -0,0 +1,54 @@
# Copyright (c) 2026 Arm Limited. All rights reserved.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is cmake used to run tests? How do we do this for other tools in the repo?

Comment thread tools/ctrace/test/unit/src/control/DecodeConsumersTests.cpp Outdated
Comment thread AGENTS.md Outdated
@@ -0,0 +1,10 @@
# Repository Instructions

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding an AGENTS.md should be discussed with the main repository maintainers. Was it already there when you reviewed this PR, @edriouk ?

Comment thread LICENSE.md Outdated
|Google C++ Testing Framework|1.11.0|[BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)|https://github.com/google/googletest.git| Testing |
|cxxopts|2.2.1|[MIT](https://opensource.org/licenses/MIT)|https://github.com/jarro2783/cxxopts.git| packgen |
|yaml-cpp|0.7.0|[MIT](https://opensource.org/licenses/MIT)|https://github.com/jbeder/yaml-cpp.git| packgen |
|cxxopts|3.0.0|[MIT](https://opensource.org/licenses/MIT)|https://github.com/jarro2783/cxxopts.git| packgen, ctrace |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing dependencies seem to be updated to newer versions. One even a major version change. Does this also apply to the other libraries/tools? And have they been successfully tested?

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.48102% with 127 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.71%. Comparing base (fba299a) to head (6fbf7f9).

Files with missing lines Patch % Lines
...ls/ctrace/src/tracerun/YmlTraceRunConfigReader.cpp 66.55% 103 Missing ⚠️
tools/ctrace/src/cli/CliParser.cpp 80.16% 24 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2548      +/-   ##
==========================================
+ Coverage   68.34%   71.71%   +3.36%     
==========================================
  Files         141      185      +44     
  Lines       26511    30117    +3606     
  Branches    16022    17769    +1747     
==========================================
+ Hits        18119    21598    +3479     
- Misses       6090     6214     +124     
- Partials     2302     2305       +3     
Flag Coverage Δ
buildmgr-cov 79.87% <ø> (ø)
ctrace-cov 96.48% <96.48%> (-3.52%) ⬇️
packchk-cov 69.81% <ø> (ø)
packgen-cov 82.02% <ø> (ø)
projmgr-cov 88.06% <ø> (ø)
svdconv-cov 46.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
tools/ctrace/src/CtraceMain.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/control/DecodeConsumers.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/control/FileDecodeJob.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/control/TraceDirectoryJob.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/decode/CortexMPostDecoder.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/decode/CortexMStreamDecoder.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/decode/DecodePipeline.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/decode/DecodePipeline.h 100.00% <100.00%> (ø)
tools/ctrace/src/decode/DwtPacketDecoder.cpp 100.00% <100.00%> (ø)
tools/ctrace/src/decode/OpenCsdErrorController.cpp 100.00% <100.00%> (ø)
... and 35 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants