Repository navigation
Add Duration to process results: how long each program ran - #67
Merged
Merged
Conversation
Process results now carry Duration, a [TimeSpan] from the program's start to its exit or kill (Process.ExitTime - Process.StartTime): not the time it waited for a slot, nor any wait for its output afterwards, so a program that exits at once while a leftover child holds its output reads as short. On Complete-PkProcess's and Invoke-PkProcessWithTimeout's result, and the batch's (last field). A command an abort force-stopped gets the time it ran; one that never started, $null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was no way to see how long each program ran, for finding the slow files in a batch, short of timing it yourself.
What changed
Process results get a
Durationfield: a[TimeSpan]from the program's start to its exit or kill (Process.ExitTime - Process.StartTime, which works the same on both start paths, read before the process is disposed).Complete-PkProcess's andInvoke-PkProcessWithTimeout's result (afterStreamError), and on eachInvoke-PkProcessBatchresult (last, afterTimedOut).-TimeoutSecondsor force-stopped by an abort gets the time it ran. A command that never started, or couldn't start, gets$null, as does a job whose.Procisn't aProcess(a custom starter).The README lists the field and shows sorting a batch on it. Scripts that
Format-Tablea result get one more column.Testing
Durationstays under 0.8 s while the call takes 1 s; with one slot, the second of two 1 s programs reads about 1 s, not 2; a program killed by a 1 s time limit reads about 1 s; in an abort, the force-stopped program gets its time, while one never started and one that couldn't start get$null. All five failed on the old code (no field) and pass now.🤖 Generated with Claude Code