Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions guest/rootfs/Containerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 LingCage. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

# lingbench guest rootfs — multi-stage
#
# Stage 1 builds benchmarks that aren't packaged by Alpine.
Expand Down Expand Up @@ -49,6 +53,8 @@ RUN apk add --no-cache \

COPY --from=builder /rootfs-extras/ /

COPY nginx-fix/default.conf /etc/nginx/http.d/default.conf

COPY lingbench/ /lingbench/
RUN chmod +x /lingbench/boot-marker.sh /lingbench/run.sh /lingbench/oneshot.sh

Expand Down
4 changes: 4 additions & 0 deletions guest/rootfs/lingbench/boot-marker.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/sh
# SPDX-FileCopyrightText: Copyright (c) 2026 LingCage. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

# Emit a boot-complete marker to the serial console. The host-side
# runner watches ttyS0 for this exact line and timestamps it to derive
# guest-ready latency (boot time).
Expand Down
4 changes: 4 additions & 0 deletions guest/rootfs/lingbench/oneshot.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/sh
# SPDX-FileCopyrightText: Copyright (c) 2026 LingCage. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

# lingbench one-shot benchmark runner.
#
# Reads `lingbench.scenario=<name>` (and optional `lingbench.args=<args>`,
Expand Down
37 changes: 28 additions & 9 deletions guest/rootfs/lingbench/run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/sh
# SPDX-FileCopyrightText: Copyright (c) 2026 LingCage. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

# lingbench in-guest benchmark dispatcher.
#
# Invoked by the host-side runner (over vsock, ssh, or the serial
Expand Down Expand Up @@ -34,15 +38,19 @@ block I/O (virtio-blk):
io-randwrite fio 4k randwrite, iodepth 32, 10s
io-seqread fio 1M seqread, iodepth 16, 10s

network (virtio-net, requires host-side server):
net-iperf3-tcp <host> iperf3 TCP_STREAM for 10s
net-iperf3-udp <host> iperf3 UDP_STREAM for 10s
network (DISABLED - requires host-side server + bridge config):
# net-iperf3-tcp <host> iperf3 TCP_STREAM for 10s
# net-iperf3-udp <host> iperf3 UDP_STREAM for 10s

application:
app-redis redis-benchmark against a local redis
app-nginx wrk against a local nginx
app-memcached memcached stats smoke test

all:
all run all scenarios above in sequence (excludes network tests)


Any scenario can be prefixed with `time` externally; this script only
runs the workload and writes its native output to stdout.
EOF
Expand Down Expand Up @@ -87,12 +95,12 @@ case "$scenario" in
--direct=1 --runtime=10 --time_based --group_reporting
;;

net-iperf3-tcp)
iperf3 -c "${1:?host ip required}" -t 10
;;
net-iperf3-udp)
iperf3 -c "${1:?host ip required}" -u -b 0 -t 10
;;
# net-iperf3-tcp)
# iperf3 -c "${1:?host ip required}" -t 10
# ;;
# net-iperf3-udp)
# iperf3 -c "${1:?host ip required}" -u -b 0 -t 10
# ;;

app-redis)
redis-server --daemonize yes --save '' --logfile /tmp/redis.log
Expand All @@ -107,6 +115,17 @@ case "$scenario" in
wrk -t2 -c64 -d10s http://127.0.0.1/
nginx -s stop 2>/dev/null || true
;;
all)
# Run all scenarios in sequence (excludes network tests)
for scenario in cpu-sysbench cpu-coremark cpu-stress mem-sysbench meminfo io-randread io-randwrite io-seqread app-redis app-nginx app-memcached; do
echo ""
echo "========================================"
echo "[LingBench] Running: $scenario"
echo "========================================"
sh "$0" "$scenario"
done
;;

app-memcached)
memcached -u nobody -d -P /tmp/memcached.pid
sleep 0.2
Expand Down
11 changes: 11 additions & 0 deletions guest/rootfs/nginx-fix/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/lib/nginx/html;
index index.html;

location / {
return 200 'Hello from nginx';
}
}
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2026 LingCage
// SPDX-FileCopyrightText: Copyright (c) 2026 LingCage. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0

Expand Down
2 changes: 1 addition & 1 deletion src/lib/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2026 LingCage
// SPDX-FileCopyrightText: Copyright (c) 2026 LingCage. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0

Expand Down
2 changes: 1 addition & 1 deletion src/lib/kernel.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2026 LingCage
// SPDX-FileCopyrightText: Copyright (c) 2026 LingCage. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0

Expand Down
2 changes: 1 addition & 1 deletion src/lib/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2026 LingCage
// SPDX-FileCopyrightText: Copyright (c) 2026 LingCage. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0

Expand Down
2 changes: 1 addition & 1 deletion src/lib/rootfs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2026 LingCage
// SPDX-FileCopyrightText: Copyright (c) 2026 LingCage. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0

Expand Down
2 changes: 1 addition & 1 deletion src/lib/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2026 LingCage
// SPDX-FileCopyrightText: Copyright (c) 2026 LingCage. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0

Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2026 LingCage
// SPDX-FileCopyrightText: Copyright (c) 2026 LingCage. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0

Expand Down
Loading