{"id":16956403,"url":"https://github.com/bgamari/hs-usdt","last_synced_at":"2025-04-11T21:41:17.992Z","repository":{"id":42185640,"uuid":"479515262","full_name":"bgamari/hs-usdt","owner":"bgamari","description":"A library for introducing USDT tracepoints into Haskell programs","archived":false,"fork":false,"pushed_at":"2023-12-08T15:47:02.000Z","size":14,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T13:17:21.560Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bgamari.png","metadata":{"files":{"readme":"README.mkd","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-08T19:31:05.000Z","updated_at":"2023-06-27T08:05:19.000Z","dependencies_parsed_at":"2022-08-12T08:50:38.854Z","dependency_job_id":null,"html_url":"https://github.com/bgamari/hs-usdt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgamari%2Fhs-usdt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgamari%2Fhs-usdt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgamari%2Fhs-usdt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bgamari%2Fhs-usdt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bgamari","download_url":"https://codeload.github.com/bgamari/hs-usdt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248486452,"owners_count":21112101,"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":[],"created_at":"2024-10-13T22:14:57.386Z","updated_at":"2025-04-11T21:41:17.964Z","avatar_url":"https://github.com/bgamari.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hs-usdt - A library for embedding of tracepoints in Haskell programs\n\nThis library offers a set of TemplateHaskell utilities for\nembedding USDT tracepoints in Haskell programs. It has been\ntested on Linux with Systemtap's `dtrace` implementation.\n\nNote that convenient use with `perf` executables must be\nbuilt with `ld`'s `--build-id` flag. This can be achieved by\nadding the following to your `.cabal` or `cabal.project` file:\n```\nghc-options: -optl-Wl,--build-id\n```\n\n## Caveats\n\nUnfortunately, the default linker used by most GHC installations, `ld.gold`\nappears to [mislink][] USDT probes. Consequently, it is necessary to instead\nuse `ld.bfd` or `ld.lld`. This can be achieved by adding the following to your\ncabal file:\n```\nghc-options: -optl-fuse-ld=bfd\n```\n\n[mislink]: https://github.com/iovisor/bcc/issues/1528\n\n## Example session\n\nFirst build the project,\n```bash\n$ nix shell nixpkgs#linuxPackages.systemtap\n$ nix build nixpkgs#libsystemtap\n$ echo \"package hs-usdt\" \u003e cabal.project.local\n$ echo \"  extra-include-dirs: $(realpath ./result)/include\" \u003e\u003e cabal.project.local\n$ echo \"  ghc-options: -optl-Wl,--build-id -optl-fuse-ld=bfd\" \u003e\u003e cabal.project.local\n$ cabal build\n$ exe=\"$(cabal list-bin hs_usdt_test)\"\n```\nNow let `perf` know about the executable's tracepoints:\n```bash\n$ perf buildid-cache --add \"$exe\"\n$ perf probe -x \"$exe\" sdt_hs_usdt__Main:tp1\n$ perf list | grep hs_usdt\n  sdt_hs_usdt__Main:tp1                              [Tracepoint event]\n  sdt_hs_usdt__Main:tp1                              [SDT event]\n```\nNow we can run the executable under perf, e.g. recording tracepoint events:\n```bash\n$ perf record -e sdt_hs_usdt__Main:tp1 \"$exe\"\nHello, Haskell!\n[ perf record: Woken up 1 times to write data ]\n[ perf record: Captured and wrote 0.043 MB perf.data (2 samples) ]\n$ perf script\n    hs_usdt_test 166810 [015] 191748.282102: sdt_hs_usdt__Main:tp1: (403354)\n    hs_usdt_test 166810 [015] 191748.282104: sdt_hs_usdt__Main:tp1: (403354)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgamari%2Fhs-usdt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbgamari%2Fhs-usdt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbgamari%2Fhs-usdt/lists"}