Skip to content

Commit b779736

Browse files
Merge pull request #76 from adybag14-cyber/fs55-ethernet-integration
feat(fs5.5): extend zigos benchmark stress lane
2 parents 94ca07d + 629706b commit b779736

File tree

6 files changed

+91
-4
lines changed

6 files changed

+91
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ ZAR-Zig-Agent-Runtime is the Zig runtime port of OpenClaw, with parity-first del
8282
- `protocol.tcp_handshake_payload`
8383
- `runtime.state_queue_cycle`
8484
- `tool_service.codec_parse`
85+
- `filesystem.persistence_cycle`
86+
- `filesystem.overlay_read_cycle`
8587
- third delivered adoption slice is a ZAR-native read-only introspection overlay inspired by ZigOS `procfs` / `sysfs`:
8688
- `src/baremetal/virtual_fs.zig` now exposes synthetic `/proc` and `/sys` trees over existing ZAR runtime, storage, display, and network state
8789
- `src/baremetal/filesystem.zig` now routes `GET` / `LIST` / `STAT` requests through that overlay while rejecting writes under `/proc` and `/sys`

docs/zig-port/FS5_5_HARDWARE_DRIVERS_SYSTEMS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Delivered first adoption slice:
5252
Delivered second adoption slice:
5353

5454
- hosted benchmark and stress lane informed by ZigOS benchmark coverage
55-
- `src/benchmark_suite.zig` now provides ZAR-native benchmark cases for DNS, DHCP, TCP, runtime-state queue churn, and tool-service codec parsing
55+
- `src/benchmark_suite.zig` now provides ZAR-native benchmark cases for DNS, DHCP, TCP, runtime-state queue churn, tool-service codec parsing, filesystem persistence churn, and virtual overlay read churn
5656
- `src/benchmark_main.zig` now exposes `zig build bench` with deterministic `BENCH:START` / `BENCH:CASE` / `BENCH:END` output
5757
- `scripts/benchmark-smoke-check.ps1` now provides the strict hosted smoke gate for the benchmark lane
5858
- CI and release preview now run the benchmark smoke lane without regressing the normal hosted/bare-metal matrix

docs/zig-port/PHASE_CHECKLIST.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Registry status:
1717
- first delivered adoption slice is clean-room `E1000` protocol reuse through `ARP` / `IPv4` / `UDP` / bounded `TCP`, not direct VFS/userspace import.
1818
- the clean-room `E1000` slice now ships `src/baremetal/e1000.zig`, `src/baremetal/pci.zig` discovery + decode enablement, `src/pal/net.zig` backend selection across `RTL8139` + `E1000`, host regressions for init/MAC/TX/RX/export state plus `ARP` / `IPv4` / `UDP` / `DHCP` / `DNS` / bounded `TCP`, and the live QEMU proofs `scripts/baremetal-qemu-e1000-probe-check.ps1`, `scripts/baremetal-qemu-e1000-arp-probe-check.ps1`, `scripts/baremetal-qemu-e1000-ipv4-probe-check.ps1`, `scripts/baremetal-qemu-e1000-udp-probe-check.ps1`, `scripts/baremetal-qemu-e1000-dhcp-probe-check.ps1`, `scripts/baremetal-qemu-e1000-dns-probe-check.ps1`, and `scripts/baremetal-qemu-e1000-tcp-probe-check.ps1` on top of `scripts/qemu-e1000-dgram-echo.ps1`.
1919
- bounded framed tool-service reuse is now closed over `E1000` through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`, and bounded `HTTP` / `HTTPS` transport reuse remains closed through `scripts/baremetal-qemu-e1000-http-post-probe-check.ps1` and `scripts/baremetal-qemu-e1000-https-post-probe-check.ps1`.
20-
- second delivered adoption slice is the hosted benchmark lane through `src/benchmark_suite.zig`, `src/benchmark_main.zig`, and `scripts/benchmark-smoke-check.ps1`, with the current catalog covering DNS, DHCP, TCP, runtime-state queue churn, and tool-service codec parsing.
20+
- second delivered adoption slice is the hosted benchmark lane through `src/benchmark_suite.zig`, `src/benchmark_main.zig`, and `scripts/benchmark-smoke-check.ps1`, with the current catalog covering DNS, DHCP, TCP, runtime-state queue churn, tool-service codec parsing, filesystem persistence churn, and virtual overlay read churn.
2121
- third delivered adoption slice is a ZAR-native read-only introspection overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, with `/proc` + `/sys` exported over existing runtime/storage/display/network state, host regressions for `GET` / `LIST` / `STAT` plus write rejection, and live `E1000` tool-service proof through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`.
2222
- fourth delivered adoption slice is a ZAR-native read-only device overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, with `/dev` exported over existing storage/display/network device state, host regressions for `GET` / `LIST` / `STAT` plus write rejection, and live `E1000` tool-service proof through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`.
2323
- `FS5.5` framebuffer/console strict closure is now reached locally: `src/baremetal/framebuffer_console.zig` programs a real Bochs/QEMU BGA linear-framebuffer path with bounded mode support for `640x400`, `800x600`, `1024x768`, `1280x720`, and `1280x1024`, `src/baremetal/pci.zig` discovers the selected PCI display adapter as structured metadata, exposes the framebuffer BAR, and enables decode on that function, `src/baremetal/edid.zig`, `src/baremetal/display_output.zig`, and `src/baremetal/virtio_gpu.zig` now add the first real EDID-backed controller path over `virtio-gpu-pci` including exported capability flags for digital input, preferred timing, CEA, DisplayID, HDMI-vendor-data, and basic-audio metadata when present plus EDID-derived connector inference, bounded per-output entry export, and bounded resource-create/attach/set-scanout/flush behavior, `src/pal/framebuffer.zig` exposes the surface plus supported-mode enumeration and display-output state through the PAL, host regressions in `src/baremetal/framebuffer_console.zig`, `src/baremetal/virtio_gpu.zig`, `src/baremetal_main.zig`, and `src/baremetal/display_output.zig` prove framebuffer state, display-output state, adapter metadata, supported-mode enumeration, glyph pixel updates, bounded mode switching, present counters, non-zero scanout pixels, connector inference from EDID capability flags, and the output-entry table, and the live QEMU+GDB proofs `scripts/baremetal-qemu-framebuffer-console-probe-check.ps1` and `scripts/baremetal-qemu-virtio-gpu-display-probe-check.ps1` now read back real MMIO banner pixels plus BGA adapter metadata and real `virtio-gpu-pci` EDID/controller capability state with non-zero scanout pixels and validated output-entry metadata over the freestanding PVH artifact; real HDMI/DisplayPort connector-specific scanout paths remain future depth and are not claimed here.

docs/zig-port/PORT_PLAN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Full-stack replacement execution reference:
2323
- `src/pal/net.zig` now routes the same raw-frame PAL seam through selectable `RTL8139` and `E1000` backends without regressing the existing RTL8139 path
2424
- `scripts/baremetal-qemu-e1000-arp-probe-check.ps1`, `scripts/baremetal-qemu-e1000-ipv4-probe-check.ps1`, `scripts/baremetal-qemu-e1000-udp-probe-check.ps1`, `scripts/baremetal-qemu-e1000-dhcp-probe-check.ps1`, `scripts/baremetal-qemu-e1000-dns-probe-check.ps1`, and `scripts/baremetal-qemu-e1000-tcp-probe-check.ps1` now prove live QEMU `E1000` ARP request transmission, IPv4 frame encode/decode, UDP datagram encode/decode, DHCP discover encode/decode, DNS query/response exchange, bounded TCP handshake/payload/teardown, and TX/RX counter advance over the freestanding PVH artifact
2525
- bounded framed tool-service reuse is now closed over `E1000` through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`, and bounded `HTTP` / `HTTPS` transport reuse remains closed through host regressions plus `scripts/baremetal-qemu-e1000-http-post-probe-check.ps1` and `scripts/baremetal-qemu-e1000-https-post-probe-check.ps1`
26-
- second delivered adoption slice is the hosted benchmark lane through `src/benchmark_suite.zig`, `src/benchmark_main.zig`, and `scripts/benchmark-smoke-check.ps1`
26+
- second delivered adoption slice is the hosted benchmark lane through `src/benchmark_suite.zig`, `src/benchmark_main.zig`, and `scripts/benchmark-smoke-check.ps1`, with the current catalog covering DNS, DHCP, TCP, runtime-state queue churn, tool-service codec parsing, filesystem persistence churn, and virtual overlay read churn
2727
- third delivered adoption slice is a ZAR-native read-only introspection overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, exposing `/proc` + `/sys` over the existing runtime/storage/display/network state, reusing the existing builtin and typed `GET` / `LIST` / `STAT` tool-service surface, and proving the same overlay live over `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`
2828
- fourth delivered adoption slice is a ZAR-native read-only device overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, exposing `/dev` over the existing storage/display/network device state, reusing the existing builtin and typed `GET` / `LIST` / `STAT` tool-service surface, and proving the same overlay live over `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`
2929
- `FS5.5` hardware-driver pivot update:

docs/zig-port/ZAR_VS_ZIGOS_BENCHMARK_SLICE_PLAN.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Delivered benchmark cases:
3838
- `protocol.tcp_handshake_payload`
3939
- `runtime.state_queue_cycle`
4040
- `tool_service.codec_parse`
41+
- `filesystem.persistence_cycle`
42+
- `filesystem.overlay_read_cycle`
4143

4244
Delivered output contract:
4345

@@ -73,7 +75,11 @@ Required for closure:
7375
Natural next benchmark expansions:
7476

7577
- allocator pressure benchmark lane
76-
- filesystem persistence throughput lane
7778
- NIC-path transport throughput comparisons (`RTL8139` vs `E1000`)
7879
- display mode-switch/present timing lane
7980
- future SMP stress once that track is expanded
81+
82+
Recently delivered follow-on depth:
83+
84+
- filesystem persistence throughput lane through `filesystem.persistence_cycle`
85+
- virtual overlay read churn through `filesystem.overlay_read_cycle`

src/benchmark_suite.zig

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const std = @import("std");
33
const dhcp = @import("protocol/dhcp.zig");
44
const dns = @import("protocol/dns.zig");
55
const tcp = @import("protocol/tcp.zig");
6+
const filesystem = @import("baremetal/filesystem.zig");
67
const runtime_state = @import("runtime/state.zig");
78
const codec = @import("baremetal/tool_service/codec.zig");
89

@@ -56,6 +57,18 @@ pub const all_cases = [_]Case{
5657
.batch_iterations = 1024,
5758
.runFn = benchToolServiceCodecParse,
5859
},
60+
.{
61+
.name = "filesystem.persistence_cycle",
62+
.description = "Bare-metal filesystem create/write/read/stat/delete churn on the active backend",
63+
.batch_iterations = 96,
64+
.runFn = benchFilesystemPersistenceCycle,
65+
},
66+
.{
67+
.name = "filesystem.overlay_read_cycle",
68+
.description = "Virtual /proc,/sys,/dev overlay list/read churn through the filesystem surface",
69+
.batch_iterations = 128,
70+
.runFn = benchFilesystemOverlayReadCycle,
71+
},
5972
};
6073

6174
pub fn list(writer: anytype) !void {
@@ -307,11 +320,77 @@ fn benchToolServiceCodecParse(iterations: usize) !u64 {
307320
return checksum;
308321
}
309322

323+
fn benchFilesystemPersistenceCycle(iterations: usize) !u64 {
324+
filesystem.resetForTest();
325+
try filesystem.init();
326+
327+
var checksum: u64 = 0;
328+
var dir_buffer: [64]u8 = undefined;
329+
var file_buffer: [96]u8 = undefined;
330+
var payload_buffer: [64]u8 = undefined;
331+
332+
for (0..iterations) |idx| {
333+
const tick: u64 = @intCast(idx + 1);
334+
const dir = try std.fmt.bufPrint(&dir_buffer, "/bench/{d}", .{idx % 16});
335+
const file = try std.fmt.bufPrint(&file_buffer, "{s}/state.txt", .{dir});
336+
const payload = try std.fmt.bufPrint(&payload_buffer, "bench-payload-{d}", .{idx});
337+
338+
try filesystem.createDirPath(dir);
339+
try filesystem.writeFile(file, payload, tick);
340+
341+
const stat = try filesystem.statSummary(file);
342+
const listing = try filesystem.listDirectoryAlloc(std.heap.page_allocator, dir, 256);
343+
defer std.heap.page_allocator.free(listing);
344+
const readback = try filesystem.readFileAlloc(std.heap.page_allocator, file, 256);
345+
defer std.heap.page_allocator.free(readback);
346+
347+
checksum +%= stat.size;
348+
checksum +%= listing.len;
349+
checksum +%= readback.len;
350+
checksum +%= stat.entry_id;
351+
checksum +%= tick;
352+
353+
try filesystem.deleteFile(file, tick + 1);
354+
try filesystem.deleteTree(dir, tick + 2);
355+
}
356+
357+
return checksum;
358+
}
359+
360+
fn benchFilesystemOverlayReadCycle(iterations: usize) !u64 {
361+
filesystem.resetForTest();
362+
try filesystem.init();
363+
364+
var checksum: u64 = 0;
365+
for (0..iterations) |_| {
366+
const root_listing = try filesystem.listDirectoryAlloc(std.heap.page_allocator, "/", 256);
367+
defer std.heap.page_allocator.free(root_listing);
368+
const dev_listing = try filesystem.listDirectoryAlloc(std.heap.page_allocator, "/dev", 256);
369+
defer std.heap.page_allocator.free(dev_listing);
370+
const dev_storage = try filesystem.readFileAlloc(std.heap.page_allocator, "/dev/storage/state", 512);
371+
defer std.heap.page_allocator.free(dev_storage);
372+
const proc_runtime = try filesystem.readFileAlloc(std.heap.page_allocator, "/proc/runtime/snapshot", 1024);
373+
defer std.heap.page_allocator.free(proc_runtime);
374+
const sys_storage = try filesystem.readFileAlloc(std.heap.page_allocator, "/sys/storage/state", 512);
375+
defer std.heap.page_allocator.free(sys_storage);
376+
377+
checksum +%= root_listing.len;
378+
checksum +%= dev_listing.len;
379+
checksum +%= dev_storage.len;
380+
checksum +%= proc_runtime.len;
381+
checksum +%= sys_storage.len;
382+
}
383+
384+
return checksum;
385+
}
386+
310387
test "benchmark catalog includes expected protocol and runtime cases" {
311388
try std.testing.expect(findCase("protocol.dns_roundtrip") != null);
312389
try std.testing.expect(findCase("protocol.tcp_handshake_payload") != null);
313390
try std.testing.expect(findCase("runtime.state_queue_cycle") != null);
314391
try std.testing.expect(findCase("tool_service.codec_parse") != null);
392+
try std.testing.expect(findCase("filesystem.persistence_cycle") != null);
393+
try std.testing.expect(findCase("filesystem.overlay_read_cycle") != null);
315394
}
316395

317396
test "benchmark suite writes markers for filtered run" {

0 commit comments

Comments
 (0)