@task
def format():
    """
    Format C source files.
    """
    system("clang-format -i *.c *.h")

@task
def upstreams():
    """
    Upstreams to molodetz and random for retoor2 local server.
    """
    system("ssh -f -N -L 3028:127.0.0.1:3028 molodetz.nl")
    system("ssh -f -N -L 8082:127.0.0.1:8082 molodetz.nl")

@task
def bench():
    """
    Benchmark using Apache Benchmark for retoor2 local server.
    """
    system("ab -n 1000 -c 5 http://molodetz.localhost:2222/")
    system("ab -n 1000 -c 5 http://random.localhost:2222/")

@task
def build():
    """
    Build the program. Output is pgs.
    """
    format()
    system("PY_SSIZE_T_CLEAN=1 gcc pgs.c -o pgs -lpython3.12 -I/usr/include/python3.14")

@task
def run():
    """
    Build the program and run it.
    """
    build()
    system("./pgs")