Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

swh:1:snp:608d2763677e9f99035674512504b69493191ab0
  • Code
  • Branches (22)
  • Releases (0)
    • Branches
    • Releases
    • HEAD
    • refs/heads/aimer
    • refs/heads/benchmarkupdate
    • refs/heads/biscuit
    • refs/heads/dependabot/submodules/libopencm3-201f5bc
    • refs/heads/efm32gg11b
    • refs/heads/faster-ml-dsa
    • refs/heads/gcc14.2
    • refs/heads/github-actions-test
    • refs/heads/haetae-fix
    • refs/heads/master
    • refs/heads/meds
    • refs/heads/mirith
    • refs/heads/mkannwischer-patch-1
    • refs/heads/openocdtcp
    • refs/heads/outoftree
    • refs/heads/remove-broken-symlinks
    • refs/heads/tuov
    • refs/remotes/amin/kyberintt
    • refs/tags/Round1
    • refs/tags/Round2
    • refs/tags/Round3
    • refs/tags/SignatureRound1
    No releases to show
  • 0f0e6f5
  • /
  • benchmarks.py
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
content badge
swh:1:cnt:d7d270bf02cef67d5e50ea11c3f8c05833cff600
directory badge
swh:1:dir:0f0e6f57638ca1490f87065c51561ec2d36d88b1
revision badge
swh:1:rev:ae06d3dfc39e62f24a6dbb62d8e15a198b536d29
snapshot badge
swh:1:snp:608d2763677e9f99035674512504b69493191ab0

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: ae06d3dfc39e62f24a6dbb62d8e15a198b536d29 authored by Matthias J. Kannwischer on 31 January 2019, 10:15:17 UTC
Add kyber512 and kyber1024 (#35)
Tip revision: ae06d3d
benchmarks.py
#!/usr/bin/env python3
import sys
import os
import datetime
import time
import utils


def benchmarkBinary(benchmark, binary):
    binpath = os.path.join("bin", binary)

    info = binary.split('_')
    primitive = '_'.join(info[:2])
    scheme = '_'.join(info[2:-2])
    implementation = info[-2]

    if utils.m4ignore(primitive, scheme, implementation):
        return

    if len(sys.argv) > 1 and scheme not in sys.argv[1:]:
        return

    result = utils.m4run(binpath)
    if 'ERROR KEYS' in result:
        print("")
        print("!!! KEY MISMATCH DURING BENCHMARKING !!!")
        print("  This could indicate illegal stack usage,")
        print("  leading to errors when measurement interrupts occur.")
        print("")
        print("  .. exiting with errors!")
        sys.exit(1)

    timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y%m%d%H%M%S')
    filename = os.path.join('benchmarks/', benchmark, primitive, scheme, implementation, timestamp)
    os.makedirs(os.path.dirname(filename), exist_ok=True)
    with open(filename, 'w') as f:
        f.write(result.strip())
    print("  .. wrote benchmarks!")

def doBenchmarks(benchmark):
    try:
        binaries = [x for x in os.listdir('bin') if (benchmark+".bin") in x]
    except FileNotFoundError:
        print("There is no bin/ folder. Please first make binaries.")
        sys.exit(1)

    print("This script flashes the benchmarking binaries onto the board, ")
    print(" and then writes the resulting output to the benchmarks directory.")

    for binary in binaries:
        benchmarkBinary(benchmark, binary)

doBenchmarks("stack")
doBenchmarks("speed")

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API