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

Re: Timing function execution



On Sat, Nov 6, 2021 at 5:16 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Sat, Nov 6, 2021 at 5:11 AM Zach Riggle <zachriggle@xxxxxxxxx> wrote:
> >
> > What is the appropriate way to benchmark / log the execution time of a function?
>
> "time" relies upon being able to use the OS-level profiling operations
> on an external process.  Shell functions run in the current shell, so
> there's no process to profile.

Could "time" invoke getrusage(RUSAGE_THREAD) before and after and
print the difference?

Roman.




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