Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Timing function execution
- X-seq: zsh-users 27313
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zach Riggle <zachriggle@xxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Timing function execution
- Date: Sat, 6 Nov 2021 17:21:38 +0100
- Archived-at: <https://zsh.org/users/27313>
- In-reply-to: <CAH+w=7Z2jJqxSAa6sD_+jBEbDfHTfa_aMr_9WLfWG5T1OcCNFw@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAMP9c5=YX9v969sVNcVcpbb8R6e4EoyrAMpqpEDAnpSYQi9Sbw@mail.gmail.com> <CAH+w=7Z2jJqxSAa6sD_+jBEbDfHTfa_aMr_9WLfWG5T1OcCNFw@mail.gmail.com>
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