Skip to content

Conversation

Copy link

Copilot AI commented Nov 8, 2025

The bt2 library is difficult to install on Mac and Windows (requires system packages, not available via pip), making zaru.py unnecessarily platform-specific.

Changes

Added scripts/instrumentation/ctf_parser.py (239 lines)

  • Pure Python CTF 1.8 binary parser using only struct from stdlib
  • Parses all Zephyr event types: entry/exit with context, profile, scheduler switch events
  • API-compatible with bt2: TraceCollectionMessageIterator, _EventMessageConst

Updated scripts/instrumentation/zaru.py

  • Removed bt2 import and error message
  • Replaced bt2 references with native parser imports

Binary Format Parsed

Context events (41 bytes): event_id(1) + callee(4) + caller(4) + timestamp(8) + bitfield(1) + thread_id(4) + thread_name(20)

Profile events (12 bytes): event_id(1) + callee(4) + delta_t(8)

API Compatibility

# Original bt2 code works unchanged
msg_it = TraceCollectionMessageIterator(tmpdir)
for msg in msg_it:
    if isinstance(msg, _EventMessageConst):
        callee = msg.event.payload_field.get('callee').real

The tool now works on any platform with standard Python 3.

Original prompt

is the bt2 dependency of zaru.py something that can be replaced? this makes the tool difficult to use on Mac and windows and requires a puthon3 version with bt2 bindings which seems unnecessary?

ideally you use another native python library?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Remove bt2 dependency from zaru.py Replace bt2 (babeltrace2) dependency with native Python CTF parser Nov 8, 2025
Copilot AI requested a review from kartben November 8, 2025 10:46
Copilot finished work on behalf of kartben November 8, 2025 10:46
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.

2 participants