{"id":20009832,"url":"https://github.com/plsyssec/sightglass","last_synced_at":"2025-07-16T05:38:24.818Z","repository":{"id":144629514,"uuid":"265361140","full_name":"PLSysSec/sightglass","owner":"PLSysSec","description":"Up to date sightglass for sfi-spectre project","archived":false,"fork":false,"pushed_at":"2020-10-07T02:26:18.000Z","size":1214,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-06-04T09:51:48.366Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PLSysSec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2020-05-19T20:40:07.000Z","updated_at":"2021-08-11T17:03:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"f66be93c-cfbd-44b2-82ee-308b66010f20","html_url":"https://github.com/PLSysSec/sightglass","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PLSysSec/sightglass","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLSysSec%2Fsightglass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLSysSec%2Fsightglass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLSysSec%2Fsightglass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLSysSec%2Fsightglass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PLSysSec","download_url":"https://codeload.github.com/PLSysSec/sightglass/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLSysSec%2Fsightglass/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265485120,"owners_count":23774432,"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-11-13T07:17:12.330Z","updated_at":"2025-07-16T05:38:24.436Z","avatar_url":"https://github.com/PLSysSec.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sight Glass\n\nA benchmark suite and tool to compare different implementations of the same primitives.\n\n## Usage\n\nSight Glass loads multiple shared libraries implementing the same test suite, runs all tests from all suites, and produces reports to evaluate how implementations compare to each other.\n\nFunctions from each library are evaluated as follows:\n\n```c\ntests_config.global_setup(\u0026global_ctx);\n\n  test1_setup(global_ctx, \u0026test1_ctx);\n  test1_body(test1_ctx);\n  test1_teardown(test1_ctx);\n\n  test2_setup(global_ctx, \u0026test2_ctx);\n  test2_body(test2_ctx);\n  test2_teardown(test2_ctx);\n\n  // ...\n\n  testN_setup(global_ctx, \u0026testN_ctx);\n  testN_body(testN_ctx);\n  testN_teardown(testN_ctx);\n\ntests_config.global_teardown(global_ctx);\n```\n\nEach shared library must export a `tests_config` symbol:\n\n```c\ntypedef struct TestsConfig {\n    void     (*global_setup)(void **global_ctx_p);\n    void     (*global_teardown)(void *global_ctx);\n    uint64_t version;\n} TestsConfig;\n\nTestsConfig tests_config;\n```\n\n`global_setup` and `global_teardown` are optional, and can be set to `NULL` if not required.\n\nA test must at least export a function named `\u003ctestname\u003e_body`:\n\n```c\nvoid testname_body(void *ctx);\n```\n\nThis function contains the actual code to be benchmarked.\n\nBy default, `ctx` will be set to the `global_ctx`. However, optional `setup` and `teardown` functions can also be provided for individual tests:\n\n```c\nvoid testname_setup(void *global_ctx, void **ctx_p);\n\nvoid testname_teardown(void *ctx);\n```\n\nSee `example/example.c` for an example test suite.\n\nSightglass extracts all symbols matching the above convention to define and run the test suite.\n\n## Running multiple functions for a single test\n\nA single test can evaluate multiple body functions sharing the same context.\n\nThese functions have to be named `\u003ctestname\u003e_body_\u003cbodyname\u003e`.\n\n`\u003cbodyname\u003e` can be anything; a numeric ID or a short description of the purpose of the function.\n\n```c\nvoid testname_body_2(void *ctx);\nvoid testname_body_randomized(void *ctx);\n```\n\nThese functions are guaranteed to be evaluated according to their names sorted in lexical order.\n\n## Configuration\n\nThe global configuration is loaded from `sightglass.toml` file. This can be changed using the `-c` command-line flag.\n\nThe configuration lists implementations to be benchmarked:\n\n```toml\ntest_suites = [\n  { name = \"test1\", library_path = \"implementation1.so\" },\n  { name = \"test2\", library_path = \"implementation2.so\" }\n]\n```\n\nIndividual test suites can also run a command in order to be optionally skipped if that command returns a non-zero exit code:\n\n```toml\ntest_suites = [\n  { name = \"test1\", library_path = \"implementation1.so\" },\n  { name = \"test2\", library_path = \"implementation2.so\", guard = [\"/opt/sg/guard-scripts/check\", \"arg1\", \"arg2\"] }\n]\n```\n\nAdditional properties that the file can include:\n\n- `single_core = \u003cbool\u003e`: set to `true` in order to run the tests on a single CPU core, in order to get more accurate results. This only works on Linux.\n\n- `output = [ { format = \"Text|CSV|JSON\" [, file = \u003cfile\u003e] [, breakdown = \u003cbool\u003e] } ... ]`: how to store or display the results.\n\nBy defaut, the `Text` and `CSV` output do not include a breakdown of the time spent in individual functions for tests made of multiple functions.\nThis can be changed with the optional `breakdown` property being set to `true`.\n\nThe `JSON` output always includes this information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplsyssec%2Fsightglass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplsyssec%2Fsightglass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplsyssec%2Fsightglass/lists"}