Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug: time doesn't work on builtins



Absent a rewrite of the functionality to actually work on builtins, maybe it could be modified to output a message about time only being supported for external commands?

On Thu, Aug 15, 2024 at 2:52 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
On Thu, Aug 15, 2024 at 6:15 AM Mark J. Reed <markjreed@xxxxxxxxx> wrote:
>
> Any attempt to time a builtin generates no output whatsoever. No timings, no error message.The timed command executes in the current shell and has its usual side-effects, but the time itself does nothing.

This was last discussed in users/28740 and subsequent thread ...

>> The OS facility that reports time statistics only works for a parent
>> process to read the stats of a child.  To work on builtins, we'd have
>> to rewrite that internally

That isn't quite accurate ... what we'd have to do is call RUSAGE_SELF
both before and after the builtin and subtract the former from the
latter, there's no (other) facility to get only the internal time
delta.


--
Mark J. Reed <markjreed@xxxxxxxxx>


Messages sorted by: Reverse Date, Date, Thread, Author