mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
build runner supports reporting cached status and duration
This commit is contained in:
parent
41a5ad28c9
commit
d695f36e70
@ -501,8 +501,42 @@ fn printTreeStep(
|
||||
|
||||
.success => {
|
||||
try ttyconf.setColor(stderr, .Green);
|
||||
try stderr.writeAll(" success\n");
|
||||
if (s.result_cached) {
|
||||
try stderr.writeAll(" cached");
|
||||
} else {
|
||||
try stderr.writeAll(" success");
|
||||
}
|
||||
try ttyconf.setColor(stderr, .Reset);
|
||||
if (s.result_duration_ns) |ns| {
|
||||
try ttyconf.setColor(stderr, .Dim);
|
||||
if (ns >= std.time.ns_per_min) {
|
||||
try stderr.writer().print(" {d}m", .{ns / std.time.ns_per_min});
|
||||
} else if (ns >= std.time.ns_per_s) {
|
||||
try stderr.writer().print(" {d}s", .{ns / std.time.ns_per_s});
|
||||
} else if (ns >= std.time.ns_per_ms) {
|
||||
try stderr.writer().print(" {d}ms", .{ns / std.time.ns_per_ms});
|
||||
} else {
|
||||
try stderr.writer().print(" {d}ns", .{ns});
|
||||
}
|
||||
try ttyconf.setColor(stderr, .Reset);
|
||||
}
|
||||
if (s.result_peak_rss != 0) {
|
||||
const rss = s.result_peak_rss;
|
||||
try ttyconf.setColor(stderr, .Dim);
|
||||
if (rss >= 1000_000_000_000) {
|
||||
try stderr.writer().print(" {d}G MaxRSS", .{rss / 1000_000_000_000});
|
||||
} else if (rss >= 1000_000_000) {
|
||||
try stderr.writer().print(" {d}M MaxRSS", .{rss / 1000_000_000});
|
||||
} else if (rss >= 1000_000) {
|
||||
try stderr.writer().print(" {d}M MaxRSS", .{rss / 1000_000});
|
||||
} else if (rss >= 1000) {
|
||||
try stderr.writer().print(" {d}K MaxRSS", .{rss / 1000});
|
||||
} else {
|
||||
try stderr.writer().print(" {d}B MaxRSS", .{rss});
|
||||
}
|
||||
try ttyconf.setColor(stderr, .Reset);
|
||||
}
|
||||
try stderr.writeAll("\n");
|
||||
},
|
||||
|
||||
.skipped => {
|
||||
|
||||
@ -13,6 +13,10 @@ debug_stack_trace: [n_debug_stack_frames]usize,
|
||||
|
||||
result_error_msgs: std.ArrayListUnmanaged([]const u8),
|
||||
result_error_bundle: std.zig.ErrorBundle,
|
||||
result_cached: bool,
|
||||
result_duration_ns: ?u64,
|
||||
/// 0 means unavailable or not reported.
|
||||
result_peak_rss: usize,
|
||||
|
||||
pub const MakeFn = *const fn (self: *Step, prog_node: *std.Progress.Node) anyerror!void;
|
||||
|
||||
@ -103,6 +107,9 @@ pub fn init(options: Options) Step {
|
||||
.debug_stack_trace = addresses,
|
||||
.result_error_msgs = .{},
|
||||
.result_error_bundle = std.zig.ErrorBundle.empty,
|
||||
.result_cached = false,
|
||||
.result_duration_ns = null,
|
||||
.result_peak_rss = 0,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user