{"id":20263136,"url":"https://github.com/briandowns/libbenchmark","last_synced_at":"2026-02-06T09:04:00.305Z","repository":{"id":81489582,"uuid":"201845665","full_name":"briandowns/libbenchmark","owner":"briandowns","description":"loads is a simple library to benchmark C functions across a given number of threads.","archived":false,"fork":false,"pushed_at":"2024-11-04T15:52:33.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T02:08:20.072Z","etag":null,"topics":["benchmark","c","performance","threads"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/briandowns.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-12T02:45:38.000Z","updated_at":"2024-11-04T15:52:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"befd8a3a-00cd-4d53-90ce-a6ee71eca006","html_url":"https://github.com/briandowns/libbenchmark","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Flibbenchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Flibbenchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Flibbenchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Flibbenchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/briandowns","download_url":"https://codeload.github.com/briandowns/libbenchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328163,"owners_count":21085261,"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":["benchmark","c","performance","threads"],"created_at":"2024-11-14T11:33:40.021Z","updated_at":"2026-02-06T09:04:00.250Z","avatar_url":"https://github.com/briandowns.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libbenchmark\n\n[![travis](https://img.shields.io/travis/briandowns/libbenchmark.svg)](https://travis-ci.org/briandowns/libbenchmark/)\n[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause)\n![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/briandowns/libbenchmark?style=plastic)\n\nlibbenchmark is a small library that provides a single function named `benchmark` to perform micro-benchmarks on a given function spread across a given number of threads. This library was heavily inspired by [Tidwall's](github.com/tidwall) [lotsa](github.com/tidwall/lotsa) Go package.\n\nOperation:\n\n`benchmark` takes 3 arguments. The first is the number of times you want the function executed, the second is the number of threads, and the third, the function you want executed. If either the number of operations or threads is less than 1 `-1` is returned indicating an error state. If the thread count is 1, execution will remain in the current process however if it's larger than 1, execution will be distributed across the threads evenly based on the number of operations given.\n\n## Example \n\n```c\n#include \u003cstdint.h\u003e\n#include \u003cstdio.h\u003e\n\n#include \"benchmark.h\"\n\nvoid\nfizz_buzz(uint64_t i)\n{\n    if (i % 15 == 0) {\n        printf(\"fizzbuzz\\n\");\n    } else if (i % 5 == 0) {\n        printf(\"buzz\\n\");\n    } else if (i % 3 == 0) {\n        printf(\"fizz\\n\");\n    } else {\n        printf(\"%llu\\n\", i);\n    }\n}\n\nint\nmain(int argc, char** argv)\n{\n    benchmark(100, 10, fizz_buzz);\n    return 0;\n}\n```\n\nOutput: \n\n```sh\n100 ops over 10 threads in 0.001524 sec, inf/sec 15240.00 ns/op\n```\n\n## Test\n\n```sh\nmake test\n```\n\n## Installation\n\nInstallation is currently supported on Linux and MacOS. There will be an effort to get this installed on FreeBSD soon.\n\n```sh\nmake install\n```\n\n## Contributing\n\nPlease feel free to open a PR!\n\n## License\n\nlibbenchmark source code is available under the BSD 2 clause [License](/LICENSE).\n\n## Contact\n\n[@bdowns328](http://twitter.com/bdowns328)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriandowns%2Flibbenchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriandowns%2Flibbenchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriandowns%2Flibbenchmark/lists"}