From 2d48093d3aae029528b08230de3d9601e9f99ac6 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Tue, 30 Apr 2024 12:57:29 -0500 Subject: [PATCH] examples(pathological): improve printing of time --- examples/pathological.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/pathological.zig b/examples/pathological.zig index 1d81510..1af65f1 100644 --- a/examples/pathological.zig +++ b/examples/pathological.zig @@ -12,7 +12,7 @@ pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const alloc = gpa.allocator(); var vx = try vaxis.init(alloc, .{}); - errdefer vx.deinit(alloc); + defer vx.deinit(alloc); var loop: vaxis.Loop(Event) = .{ .vaxis = &vx }; @@ -54,7 +54,8 @@ pub fn main() !void { } try vx.render(); } + try vx.exitAltScreen(); const took = std.time.microTimestamp() - timer_start; - vx.deinit(alloc); - log.info("took {d}ms", .{@divTrunc(took, std.time.us_per_ms)}); + const stdout = std.io.getStdOut().writer(); + try stdout.print("\r\ntook {d}ms to render 10,000 times\r\n", .{@divTrunc(took, std.time.us_per_ms)}); }