{"id":19599908,"url":"https://github.com/lbirchler/strace-perfetto","last_synced_at":"2025-07-09T15:36:48.017Z","repository":{"id":57693981,"uuid":"486182995","full_name":"lbirchler/strace-perfetto","owner":"lbirchler","description":"strace-perfetto runs strace and converts the raw output to a Trace Event JSON file. The JSON file can then be analyzed using Google's Perfetto UI","archived":false,"fork":false,"pushed_at":"2022-04-27T13:39:52.000Z","size":76,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-27T16:42:23.175Z","etag":null,"topics":["perfetto","race-conditions","strace","syscalls"],"latest_commit_sha":null,"homepage":"","language":"Go","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/lbirchler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-27T12:29:02.000Z","updated_at":"2025-03-14T09:39:00.000Z","dependencies_parsed_at":"2022-09-26T21:00:53.786Z","dependency_job_id":null,"html_url":"https://github.com/lbirchler/strace-perfetto","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lbirchler/strace-perfetto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbirchler%2Fstrace-perfetto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbirchler%2Fstrace-perfetto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbirchler%2Fstrace-perfetto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbirchler%2Fstrace-perfetto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lbirchler","download_url":"https://codeload.github.com/lbirchler/strace-perfetto/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lbirchler%2Fstrace-perfetto/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264486580,"owners_count":23616083,"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":["perfetto","race-conditions","strace","syscalls"],"created_at":"2024-11-11T09:12:54.929Z","updated_at":"2025-07-09T15:36:47.912Z","avatar_url":"https://github.com/lbirchler.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# strace-perfetto\n\nstrace-perfetto runs strace and converts the raw output to a [Trace Event](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/edit#heading=h.yr4qxyxotyw) JSON file. The JSON file can then be analyzed using Google's [Perfetto UI](https://ui.perfetto.dev/)\n\n![example](img/ui.perfetto.dev.png)\n\n### Install\n```\ngo install github.com/lbirchler/strace-perfetto@latest\n```\n\n### Usage\n```\nUsage: strace-perfetto [OPTIONS] command\n  -e string\n        only trace specified syscalls\n  -o string\n        json output file (default \"stracefile.json\")\n  -t int\n        strace timeout (secs) (default 10)\n```\n\n### Examples\n#### Trace program/script/command\n```\n$ strace-perfetto ./x.py\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eJSON output\u003c/summary\u003e\n\n```\n$ jq '.[-3:]' stracefile.json                                                                                                            \n[\n  {\n    \"name\": \"munmap\",\n    \"cat\": \"successful\",\n    \"ph\": \"X\",\n    \"pid\": 83283,\n    \"tid\": 83283,\n    \"ts\": 1651010489317416,\n    \"dur\": 27,\n    \"args\": {\n      \"first\": \"(0x7fc75d49f000, 262144)\",\n      \"returnValue\": \"0\"\n    }\n  },\n  {\n    \"name\": \"munmap\",\n    \"cat\": \"successful\",\n    \"ph\": \"X\",\n    \"pid\": 83283,\n    \"tid\": 83283,\n    \"ts\": 1651010489317475,\n    \"dur\": 25,\n    \"args\": {\n      \"first\": \"(0x7fc79f115000, 262144)\",\n      \"returnValue\": \"0\"\n    }\n  },\n  {\n    \"name\": \"munmap\",\n    \"cat\": \"successful\",\n    \"ph\": \"X\",\n    \"pid\": 83283,\n    \"tid\": 83283,\n    \"ts\": 1651010489317520,\n    \"dur\": 24,\n    \"args\": {\n      \"first\": \"(0x7fc79eef8000, 262144)\",\n      \"returnValue\": \"0\"\n    }\n  }\n]\n```\n\u003c/details\u003e\n\n\n#### Trace specific syscalls\n```\n$ strace-perfetto -e symlink,unlink,openat ./x.py \n```\n\u003cdetails\u003e \n\u003csummary\u003eJSON output\u003c/summary\u003e\n\n```\n$ jq '.[-3:]' stracefile.json \n[\n  {\n    \"name\": \"symlink\",\n    \"cat\": \"successful\",\n    \"ph\": \"X\",\n    \"pid\": 85018,\n    \"tid\": 85018,\n    \"ts\": 1651015267210572,\n    \"dur\": 12,\n    \"args\": {\n      \"first\": \"(\\\"/flag\\\", \\\"x\\\")\",\n      \"returnValue\": \"0\"\n    }\n  },\n  {\n    \"name\": \"unlink\",\n    \"cat\": \"successful\",\n    \"ph\": \"X\",\n    \"pid\": 85018,\n    \"tid\": 85018,\n    \"ts\": 1651015267210598,\n    \"dur\": 14,\n    \"args\": {\n      \"first\": \"(\\\"x\\\")\",\n      \"returnValue\": \"0\"\n    }\n  },\n  {\n    \"name\": \"openat\",\n    \"cat\": \"successful\",\n    \"ph\": \"X\",\n    \"pid\": 85018,\n    \"tid\": 85018,\n    \"ts\": 1651015267210626,\n    \"dur\": 34,\n    \"args\": {\n      \"first\": \"(AT_FDCWD, \\\"x\\\", O_WRONLY|O_CREAT|O_CLOEXEC, 0777)\",\n      \"returnValue\": \"3\"\n    }\n  }\n]\n```\n\u003c/details\u003e\n\n\n#### Kill trace after *n* seconds \n```\n$ strace-perfetto -t 2 ./x.py \n```\n\n**NOTE:** The *cat (category)* field for each event is used to represent the status of each syscall\n```\nsuccessful: syscall returned without an error code\nfailed:     syscall returned with an error code\nunfinished: syscall didn't finish\ndetached:   strace detached from syscall before returning due to another one being called by a different thread/process\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flbirchler%2Fstrace-perfetto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flbirchler%2Fstrace-perfetto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flbirchler%2Fstrace-perfetto/lists"}