{"id":28089012,"url":"https://github.com/javierhonduco/lightswitch","last_synced_at":"2026-02-03T13:11:58.875Z","repository":{"id":228186325,"uuid":"747633606","full_name":"javierhonduco/lightswitch","owner":"javierhonduco","description":"CPU profiler as a library for Linux suitable for on-demand and continuous profiling running on BPF","archived":false,"fork":false,"pushed_at":"2025-05-07T06:34:47.000Z","size":1696,"stargazers_count":17,"open_issues_count":10,"forks_count":3,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-07T07:39:51.431Z","etag":null,"topics":["bpf","ebpf","performance","profiling","rust"],"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/javierhonduco.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,"zenodo":null}},"created_at":"2024-01-24T10:32:37.000Z","updated_at":"2025-05-01T13:13:20.000Z","dependencies_parsed_at":"2025-05-07T07:31:41.722Z","dependency_job_id":"9c616963-3efb-4303-9c6f-de0ba6727321","html_url":"https://github.com/javierhonduco/lightswitch","commit_stats":null,"previous_names":["javierhonduco/lightswitch"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javierhonduco%2Flightswitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javierhonduco%2Flightswitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javierhonduco%2Flightswitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javierhonduco%2Flightswitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javierhonduco","download_url":"https://codeload.github.com/javierhonduco/lightswitch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253947942,"owners_count":21988948,"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":["bpf","ebpf","performance","profiling","rust"],"created_at":"2025-05-13T12:53:17.170Z","updated_at":"2025-10-16T00:47:48.915Z","avatar_url":"https://github.com/javierhonduco.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![ci](https://github.com/javierhonduco/lightswitch/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/javierhonduco/lightswitch/actions/workflows/build.yml)\n\nlightswitch\n===========\n**lightswitch** is a profiler as a library for Linux suitable for on-demand and continuous on-CPU profiling. It's mostly written in Rust but the unwinders are written in C and run in BPF. Currently C, C++, Rust, Zig, and Go are fully supported on x86_64 (arm64 support is experimental).\n\nThe main features / design goals are:\n\n* Low overhead: currently targeting 3% CPU utilization and 500MB of memory.\n* No requirement for applications to be compiled with frame pointers.\n* Detailed metrics to understand profiling effectiveness and troubleshoot issues.\n* Enhanced unwinding capability for larger process stacks by not relying on [`PERF_SAMPLE_STACK_USER`](https://man7.org/linux/man-pages/man2/perf_event_open.2.html).\n* Support for modern kernels, released approximately 4y ago.\n\nInstallation\n------------\nThe [latest release](https://github.com/javierhonduco/lightswitch/releases/latest) contains pre-built binaries and container images in the OCI format (Docker compatible). Alternatively, for every commit merged to the `main` branch, an OCI container tagged with the full Git sha1 is published to [the GitHub registry](https://github.com/javierhonduco/lightswitch/pkgs/container/lightswitch).\n\nUsage\n-----\nAs a CLI, **lightswitch** can be run with:\n\n```shell\n$ sudo lightswitch\n```\n\nIt can be stopped with \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003eC\u003c/kbd\u003e, or alternatively, by passing a `--duration` in seconds. A flamegraph in SVG will be written to disk. Pprof is also supported with `--profile-format=pprof`. By default the whole machine will be profiled, to profile invidual processes you can use `--pids`.\n\nUsing Docker:\n\n```shell\n$ docker run -it --privileged --pid=host -v /sys:/sys -v $PWD:/profiles -v /tmp/lightswitch ghcr.io/javierhonduco/lightswitch:main-$LIGHTSWITCH_SHA1 --profile-path=/profiles\n```\n\nDevelopment\n-----------\nWe use `nix` for the development environment and the building system. It can be installed with [the official installer](https://nixos.org/download/#nix-install-linux) (make sure to enable support for flakes) or with the [Determinate Systems installer](https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-file#usage). Once `nix` is installed, you can\n\n* start a developer environment with `nix develop` and then you'll be able to build the project with cargo with `cargo build`. This might take a little while the first time.\n* generate a container image `nix build .#container` will write a symlink to the container image under `./result`.\n\n### Building\n```shell\n# after running `nix develop`\n$ cargo build # use `--release` to get an optimized build\n$ sudo ./target/debug/lightswitch # or ./target/release for optimized builds\n```\n\n### Running tests\n```shell\n# after running `nix develop`\n$ cargo test\n```\n\n### Running kernel tests\n```shell\n$ nix run .#vmtest\n```\n\nReporting bugs\n--------------\nWhen reporting any bugs, please share which version / revision you are running, the arguments, the output of `lightswitch system-info` and if relevant, the logs with `--logging=debug`. If you suspect there is a bug in the unwinders, adding `--bpf-logging` and sharing the output from `bpftool prog tracelog` or `/sys/kernel/debug/tracing/trace_pipe` will be very helpful.\n\nProject status\n---------------\n**lightswitch** is in active development and the main focus is to provide a low-overhead profiler with excellent UX. A more comprehensive roadmap will be published. Feedback is greatly appreciated.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavierhonduco%2Flightswitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavierhonduco%2Flightswitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavierhonduco%2Flightswitch/lists"}