| ... | ... | @@ -375,6 +375,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 375 | 375 | &.{ "o", &digest, placeholder.output.basename }, |
| 376 | 376 | ); |
| 377 | 377 | } |
| 378 | step.result_cached = true; |
| 378 | 379 | return; |
| 379 | 380 | } |
| 380 | 381 | |
| ... | ... | @@ -580,6 +581,9 @@ fn runCommand(self: *RunStep, argv: []const []const u8, has_side_effects: bool) |
| 580 | 581 | return step.fail("unable to spawn {s}: {s}", .{ argv[0], @errorName(err) }); |
| 581 | 582 | }; |
| 582 | 583 | |
| 584 | step.result_duration_ns = result.elapsed_ns; |
| 585 | step.result_peak_rss = result.peak_rss; |
| 586 | |
| 583 | 587 | switch (self.stdio) { |
| 584 | 588 | .check => |checks| for (checks.items) |check| switch (check) { |
| 585 | 589 | .expect_stderr_exact => |expected_bytes| { |
| ... | ... | @@ -678,6 +682,8 @@ const ChildProcResult = struct { |
| 678 | 682 | stdout_null: bool, |
| 679 | 683 | stderr_null: bool, |
| 680 | 684 | term: std.process.Child.Term, |
| 685 | elapsed_ns: u64, |
| 686 | peak_rss: usize, |
| 681 | 687 | }; |
| 682 | 688 | |
| 683 | 689 | fn spawnChildAndCollect( |
| ... | ... | @@ -696,6 +702,7 @@ fn spawnChildAndCollect( |
| 696 | 702 | child.cwd_dir = b.build_root.handle; |
| 697 | 703 | } |
| 698 | 704 | child.env_map = self.env_map orelse b.env_map; |
| 705 | child.request_resource_usage_statistics = true; |
| 699 | 706 | |
| 700 | 707 | child.stdin_behavior = switch (self.stdio) { |
| 701 | 708 | .infer_from_args => if (has_side_effects) .Inherit else .Ignore, |
| ... | ... | @@ -716,6 +723,7 @@ fn spawnChildAndCollect( |
| 716 | 723 | child.spawn() catch |err| return self.step.fail("unable to spawn {s}: {s}", .{ |
| 717 | 724 | argv[0], @errorName(err), |
| 718 | 725 | }); |
| 726 | var timer = try std.time.Timer.start(); |
| 719 | 727 | |
| 720 | 728 | // These are not optionals, as a workaround for |
| 721 | 729 | // https://github.com/ziglang/zig/issues/14783 |
| ... | ... | @@ -762,12 +770,17 @@ fn spawnChildAndCollect( |
| 762 | 770 | } |
| 763 | 771 | } |
| 764 | 772 | |
| 773 | const term = try child.wait(); |
| 774 | const elapsed_ns = timer.read(); |
| 775 | |
| 765 | 776 | return .{ |
| 766 | 777 | .stdout = stdout_bytes, |
| 767 | 778 | .stderr = stderr_bytes, |
| 768 | 779 | .stdout_null = stdout_null, |
| 769 | 780 | .stderr_null = stderr_null, |
| 770 | | .term = try child.wait(), |
| 781 | .term = term, |
| 782 | .elapsed_ns = elapsed_ns, |
| 783 | .peak_rss = child.resource_usage_statistics.getMaxRss() orelse 0, |
| 771 | 784 | }; |
| 772 | 785 | } |
| 773 | 786 | |