Inspiration

QNX has a kernel event tracer, tracelogger, and a printer, traceprinter. The graphical view of those traces, the System Profiler, lives in the Momentics IDE. The author works on a Mac, and QNX SDP 8.0 has no macOS host tools. A trace could be captured but not looked at from the machine the code was written on.

A kernel trace is the best view of a real-time system. Perfetto's web UI runs in any browser and opens Trace Event JSON. A converter gives any host OS a timeline view, and gives scripts a way to ask questions about a trace.

What it does

kevscope reads the text that traceprinter prints from a tracelogger capture of QNX SDP 8.0. It has four commands:

  • convert writes Trace Event JSON for ui.perfetto.dev.
  • view converts, serves the file once on 127.0.0.1:9001, and opens the Perfetto UI pointed at it.
  • stats prints per-thread CPU time, run counts and Ready-to-Running latency.
  • blame takes one thread and shows which threads ran on the CPU it was waiting for while it was Ready or Mutex-blocked. This finds priority inversions. --shares prints shares without durations.
  • convert --from/--to exports only a time window, for looking at one event up close.

In Perfetto, each CPU has a track of which thread ran and a track of interrupts. Each QNX process is a group. Each thread has a state track (Running, Ready, Receive-blocked, Reply-blocked, Mutex-blocked and so on) and a kernel-calls track. Message passing is drawn as flow arrows. User trace events from trace_logf appear as markers.

The repository also has rtdemo, a QNX 8.0 C program that creates a classic priority inversion on purpose and can fix it with PTHREAD_PRIO_INHERIT. It is the test subject, and the demo runs it on QNX 8.0 in QEMU.

On the real run, without priority inheritance most of inv-high's mutex wait is spent with inv-mid on the CPU. With inheritance only the lock holder inv-low runs. No numbers from QNX are published, because the QNX Development License does not allow it. The examples in the repository come from a hand-written test fixture and are labelled that way.

How I built it

  • Python 3.9+, standard library only. The pipeline is: text decoder, event model, timeline, then exporter and analyses.
  • The decoder handles the QNX 8.0 traceprinter forms found on a real capture: 64-bit cycle counts, INT_DELIVER interrupts, USREVENT text and data words, and thread states that differ from the older public samples.
  • The workload workload/rtdemo.c uses channels, MsgSend, MsgReceive, MsgReply, timer pulses, run masks, trace_logf and mutex protocols. It is built with qcc -Vgcc_ntoaarch64le (QNX SDP 8.0, gcc 12.2.0).
  • The Mac toolchain route: SDP 8.0 has no macOS host tools, so the Linux build of QNX Software Center and the SDP run in a linux/amd64 container (Docker Desktop with Rosetta). docker/sdp.sh wraps it. A fixed hostname and MAC keep the licence activation stable. The built mkqnximage aarch64le image boots in Homebrew QEMU on the QEMU virt machine, using TCG. tools/trace-run.sh runs tracelogger -w on the target and traceprinter in the container.
  • Claude Code (Anthropic) wrote most of the code under the author's direction. The author ran it, checked the results on QNX 8.0 in QEMU, and wrote the decisions about scope.
  • 52 unit tests, using hand-written fixtures.

Challenges I ran into

  • QNX SDP 8.0 has no macOS host tools. Solved with the Linux tools in an x86-64 container.
  • mkqnximage failed with "Host file 'startup-qemu-virt' not available" until the target.qemuvirt package was installed.
  • HVF acceleration did not work. QNX's startup-qemu-virt asserts in gic_v3.c, and QEMU 11 refuses GICv2 under HVF. The demo runs under TCG, which is slow.
  • QEMU 11 has no virt-4.2 machine, which mkqnximage's runner requests. We use virt-8.2.
  • QNX does not publish the binary .kev layout, so kevscope does not decode raw .kev files. It reads traceprinter text.
  • The QNX 8.0 trace text differs from the old public samples. We found the differences on a real capture.
  • The Software Center login rejected passwords with a non-alphanumeric character.
  • The licence forbids publishing measurements made on QNX, so every example in the docs is synthetic or qualitative.

Accomplishments that I'm proud of

  • A Mac-hosted route from licence to a running QNX 8.0 system in QEMU, written down step by step in docs/codelab.md.
  • A real QNX 8.0 trace opened in ui.perfetto.dev. Perfetto's SQL counts matched what the exporter wrote for states, kernel calls, interrupts and flows.
  • A priority inversion caught by blame and removed with one line of code, with the difference visible in both the report and the timeline.
  • 52 passing tests.

What I learned

  • A priority inversion is easy to describe and easy to miss. It is plain in a timeline: a high-priority thread Mutex-blocked while an unrelated thread runs.
  • QNX's tracing tools are good. The missing piece for a Mac was the viewer, not the data.
  • Emulated QNX is slow but good enough to show scheduling behaviour. We did not use it to judge speed.

What's next for kevscope

  • Decode raw .kev files once the layout can be confirmed against real captures.
  • Confirm the view local-server path on more browsers.
  • Test on more than one machine, and on x86-64 QNX targets.
  • Add more analyses, such as message round-trip time.

Where to find the QNX evidence

  • workload/rtdemo.c: ChannelCreate, ConnectAttach(_NTO_SIDE_CHANNEL), MsgSend, MsgReceive, MsgReply, MsgError, MsgSendPulse, timer_create with SIGEV_PULSE_INIT, ThreadCtl(_NTO_TCTL_RUNMASK), pthread_setname_np, trace_logf, PTHREAD_PRIO_NONE and PTHREAD_PRIO_INHERIT. Functions: server_thread, client_thread, inv_low_thread, inv_mid_thread, inv_high_thread, main.
  • workload/Makefile: qcc -Vgcc_ntoaarch64le.
  • docker/Dockerfile, docker/sdp.sh: installs QNX Software Center and SDP 8.0, runs mkqnximage.
  • tools/qemu-run.sh, tools/target.sh, tools/trace-run.sh, tools/demo.sh: boot, reach, trace and analyse a QNX 8.0 target.
  • kevscope/textparse.py: parser for QNX 8.0 traceprinter output.
  • The demo: QNX 8.0.0 in QEMU, console line QNX qnx-a64 8.0.0 2026/10/30-09:09:47EDT QEMU_virt aarch64le, and rtdemo printing rtdemo: ran 2 s on QNX, 7 threads, mutex without priority inheritance.

Build and run instructions name the version (QNX SDP 8.0, 8.0.0), the target (QEMU virt, aarch64le) and the toolchain (qcc -Vgcc_ntoaarch64le, gcc 12.2.0). They are in README.md and docs/codelab.md.

Links

Notices

  • Built with help from Claude Code (Anthropic). The narration in the video is a synthesised voice.
  • The project was started on 19 Nov 2026, inside the submission period.
  • QNX is a trademark of BlackBerry Limited. kevscope is an independent project, not affiliated with or endorsed by BlackBerry.
  • Limitations: no raw .kev decoding; HVF acceleration does not work (TCG is used); the view local-server path was not confirmed end to end; tested on one Mac only.

Built With

Share this project:

Updates

Submission history