{"id":18635526,"url":"https://github.com/jonlamb-gh/trace-recorder-to-ctf","last_synced_at":"2025-05-07T20:42:20.547Z","repository":{"id":243381800,"uuid":"811830973","full_name":"jonlamb-gh/trace-recorder-to-ctf","owner":"jonlamb-gh","description":"Convert FreeRTOS trace-recorder traces to LTTng-shaped CTF","archived":false,"fork":false,"pushed_at":"2024-12-24T14:41:29.000Z","size":540,"stargazers_count":9,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-07T20:42:00.721Z","etag":null,"topics":["ctf","freertos","trace-compass","tracing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonlamb-gh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-07T11:45:23.000Z","updated_at":"2025-05-01T07:39:55.000Z","dependencies_parsed_at":"2024-06-11T19:56:35.297Z","dependency_job_id":null,"html_url":"https://github.com/jonlamb-gh/trace-recorder-to-ctf","commit_stats":null,"previous_names":["jonlamb-gh/trace-recorder-to-ctf"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlamb-gh%2Ftrace-recorder-to-ctf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlamb-gh%2Ftrace-recorder-to-ctf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlamb-gh%2Ftrace-recorder-to-ctf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonlamb-gh%2Ftrace-recorder-to-ctf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonlamb-gh","download_url":"https://codeload.github.com/jonlamb-gh/trace-recorder-to-ctf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252954127,"owners_count":21830893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ctf","freertos","trace-compass","tracing"],"created_at":"2024-11-07T05:25:26.086Z","updated_at":"2025-05-07T20:42:20.525Z","avatar_url":"https://github.com/jonlamb-gh.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trace-recorder-to-ctf\n\nConvert FreeRTOS [trace recorder](https://github.com/percepio/TraceRecorderSource) traces to LTTng-shaped [CTF](https://diamon.org/ctf/v1.8.3/).\n\n![trace-compass](assets/trace_compass_freertos.png)\n\n## Getting Started\n\n1. Collect streaming protocol trace recorder data from your device (i.e. using the RTT or TCP stream port)\n1. Install `trace-recorder-to-ctf` from github Releases or build from source (`cargo install --path .`)\n1. Convert to CTF\n1. View the trace data in [Trace Compass](https://eclipse.dev/tracecompass/) or with [babeltrace2](https://babeltrace.org/)\n\n```bash\ntrace-recorder-to-ctf trc.psf\n\n# Default output directory is ./ctf_trace\ntree ctf_trace/\nctf_trace/\n├── metadata\n└── stream\n```\n\n```\n# Inspect the metadata\nbabeltrace2 ./ctf_trace --output-format=ctf-metadata\n\nbabeltrace2 --clock-seconds ./ctf_trace\n```\n\n```text\n[0.000231544] (+?.?????????) trace-recorder TRACE_START: { cpu_id = 0 }, { id = 0x1, event_count = 6, timer = 41678 }, { task_handle = 2, task = \"(startup)\" }\n[0.000237850] (+0.000006306) trace-recorder OBJECT_NAME: { cpu_id = 0 }, { id = 0x3, event_count = 7, timer = 42813 }\n[0.000245077] (+0.000007227) trace-recorder OBJECT_NAME: { cpu_id = 0 }, { id = 0x3, event_count = 8, timer = 44114 }\n[0.000252305] (+0.000007228) trace-recorder OBJECT_NAME: { cpu_id = 0 }, { id = 0x3, event_count = 9, timer = 45415 }\n[0.000260338] (+0.000008033) trace-recorder MEMORY_ALLOC: { cpu_id = 0 }, { id = 0x38, event_count = 10, timer = 46861 }\n[0.000269688] (+0.000009350) trace-recorder QUEUE_CREATE: { cpu_id = 0 }, { id = 0x11, event_count = 11, timer = 48544 }\n[0.000280583] (+0.000010895) trace-recorder OBJECT_NAME: { cpu_id = 0 }, { id = 0x3, event_count = 12, timer = 50505 }\n[0.000291166] (+0.000010583) trace-recorder OBJECT_NAME: { cpu_id = 0 }, { id = 0x3, event_count = 13, timer = 52410 }\n[0.000297744] (+0.000006578) trace-recorder UNKNOWN: { cpu_id = 0 }, { id = 0x14, event_count = 14, timer = 53594 }, { type = \"TIMER_CREATE\" }\n[0.000303427] (+0.000005683) trace-recorder QUEUE_SEND: { cpu_id = 0 }, { id = 0x50, event_count = 15, timer = 54617 }\n[0.000307061] (+0.000003634) trace-recorder UNKNOWN: { cpu_id = 0 }, { id = 0xA0, event_count = 16, timer = 55271 }, { type = \"TIMER_START\" }\n[0.000319888] (+0.000012827) trace-recorder MEMORY_ALLOC: { cpu_id = 0 }, { id = 0x38, event_count = 17, timer = 57580 }\n[0.000328116] (+0.000008228) trace-recorder MEMORY_ALLOC: { cpu_id = 0 }, { id = 0x38, event_count = 18, timer = 59061 }\n[0.000336655] (+0.000008539) trace-recorder MESSAGEBUFFER_CREATE: { cpu_id = 0 }, { id = 0x19, event_count = 19, timer = 60598 }\n[0.000346344] (+0.000009689) trace-recorder OBJECT_NAME: { cpu_id = 0 }, { id = 0x3, event_count = 20, timer = 62342 }\n[0.000355266] (+0.000008922) trace-recorder MEMORY_ALLOC: { cpu_id = 0 }, { id = 0x38, event_count = 21, timer = 63948 }\n[0.000362450] (+0.000007184) trace-recorder MEMORY_ALLOC: { cpu_id = 0 }, { id = 0x38, event_count = 22, timer = 65241 }\n[0.000389055] (+0.000026605) trace-recorder OBJECT_NAME: { cpu_id = 0 }, { id = 0x3, event_count = 23, timer = 70030 }\n[0.000395288] (+0.000006233) trace-recorder TASK_CREATE: { cpu_id = 0 }, { id = 0x10, event_count = 24, timer = 71152 }\n[0.000535150] (+0.000139862) trace-recorder sched_wakeup: { cpu_id = 0 }, { id = 0x30, event_count = 25, timer = 96327 }, { src_event_type = \"TASK_READY\", comm = \"CLI\", tid = 536904392, prio = 1, target_cpu = 0 }\n```\n\n## Docker\n\nYou can also use the Docker image `ghcr.io/jonlamb-gh/trace-recorder-to-ctf:latest`:\n\n```bash\nmkdir -p /tmp/output\n\n# Volumes:\n# * input file test_system.psf at /test_system.psf\n# * output directory /tmp/output at /output\ndocker run -u $(id -u):$(id -g) -it -v /tmp/test_system.psf:/test_system.psf:ro -v /tmp/output:/output:rw ghcr.io/jonlamb-gh/trace-recorder-to-ctf:latest -o /output/test_system /test_system.psf\n\ntree /tmp/output/\n/tmp/output/\n└── test_system\n    ├── metadata\n    └── stream\n```\n\n## Concept Mapping\n\nThe converter produces CTF data that integrates with several of the out-of-box trace-compass LTTng kernel analyses.\n\nIt does this by adding well-known metadata environment key/value pairs and mapping a handful of\nscheduling and ISR related events.\n\n### Environment Key/Value Pairs\n\n| Key | Value |\n| :--- | ---: |\n| tracer_name | lttng-modules |\n| tracer_major | 2 |\n| tracer_minor | 12 |\n| tracer_patchlevel | 5 |\n| trace_buffering_scheme | global |\n| trace_creation_datetime | `\u003cconversion-datetime\u003e` |\n\nExample `metadata` section:\n```\nenv {\n    hostname = \"trace-recorder\";\n    domain = \"kernel\";\n    tracer_name = \"lttng-modules\";\n    tracer_major = 2;\n    tracer_minor = 12;\n    tracer_patchlevel = 5;\n    trace_buffering_scheme = \"global\";\n    trc_endianness = \"little-endian\";\n    trc_format_version = 14;\n    trc_kernel_version = \"KernelVersion([A1, 1A])\";\n    trc_kernel_port = \"FreeRTOS\";\n    trc_platform_cfg = \"FreeRTOS\";\n    trc_platform_cfg_version = \"1.2.0\";\n    input_file = \"trc.psf\";\n    trace_creation_datetime = \"20240609T113144+0000\";\n    trace_creation_datetime_utc = \"2024-06-09 11:31:44.264757838 UTC\";\n};\n```\n\n### Event Types\n\n| Trace Recorder Event | CTF Event |\n| :--- | :--- |\n| TASK_READY | sched_wakeup |\n| TASK_ACTIVATE | sched_switch when starting/resuming from a task\u003cbr/\u003eirq_handler_exit when exiting an ISR |  \n| TASK_RESUME | sched_switch when starting/resuming from a task\u003cbr/\u003eirq_handler_exit when exiting an ISR |  \n| TASK_SWITCH_ISR_BEGIN | irq_handler_entry |\n| TASK_SWITCH_ISR_RESUME | irq_handler_exit |\n\n## License\n\nSee [LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonlamb-gh%2Ftrace-recorder-to-ctf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonlamb-gh%2Ftrace-recorder-to-ctf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonlamb-gh%2Ftrace-recorder-to-ctf/lists"}