{"id":16842573,"url":"https://github.com/rofl0r/libperfstat","last_synced_at":"2025-07-14T16:05:01.978Z","repository":{"id":228109234,"uuid":"773190340","full_name":"rofl0r/libperfstat","owner":"rofl0r","description":"a tiny library to control what `perf record` records.","archived":false,"fork":false,"pushed_at":"2024-03-17T01:14:37.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-20T15:49:05.402Z","etag":null,"topics":["c","perf","performance-testing","profiling","record"],"latest_commit_sha":null,"homepage":"","language":"C","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/rofl0r.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"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-03-17T01:10:30.000Z","updated_at":"2024-03-17T01:30:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"d41a9b95-44c3-4c64-8f0e-0f20b8ebf15d","html_url":"https://github.com/rofl0r/libperfstat","commit_stats":null,"previous_names":["rofl0r/libperfstat"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rofl0r/libperfstat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Flibperfstat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Flibperfstat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Flibperfstat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Flibperfstat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rofl0r","download_url":"https://codeload.github.com/rofl0r/libperfstat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rofl0r%2Flibperfstat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265314143,"owners_count":23745201,"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":["c","perf","performance-testing","profiling","record"],"created_at":"2024-10-13T12:46:48.151Z","updated_at":"2025-07-14T16:05:01.919Z","avatar_url":"https://github.com/rofl0r.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"libperfstat - a tiny library to `perf record` only specific code parts\n----------------------------------------------------------------------\n\n# about\n\ninspired by https://stackoverflow.com/questions/70314376/enable-disable-perf-event-collection-programmatically\ni set out the implement the mentioned steps, only to find that the output\nprovided by `perf stat` wasn't quite what i wanted.\nfortunately it turned out that `perf record` achieved the same IPC functionality\nsomewhere between kernel 5.4 and 5.10.\n\nthis library allows you to start `perf record` in the background, and\nthen enable and disable it programmatically, so you can performance-test\nonly specific code snippets and only in specific situations.\n\nsee `test.c` for how it works and how to use.\n\nnote that there's also a libperf - which let's you use the perf performance\ncounters manually without perf binary, a way more powerful tool.\nhowever if a `perf report`-like output is what you're after, you'd probably\nneed to spend a week to study the perf code to figure out how to produce a\nsimilar result.\n\n# requirements\n- gnu make\n- a C compiler\n- an installed `perf` binary that supports --control command line option.\n  one compiled from kernel sources \u003e= 5.10 should work.\n- this also means you need linux, since it's the platform perf was\n  written for.\n\n# compilation/installation\nmake CFLAGS=\"-O1 -g\"\nmake PREFIX=/usr install\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Flibperfstat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frofl0r%2Flibperfstat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frofl0r%2Flibperfstat/lists"}