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

Re: "Profiling" my startup scripts



On 23 November 2011 22:04, Daniel Serodio (lists)
<daniel.lists@xxxxxxxxxxxxx> wrote:
> I have somewhat complex .zshrc and .zshenv startup scripts that I've
> improved over the years, running Linux. Now I'm using OSX and something in
> these scripts is taking more time than usual, and I'd like to "profile"
> them, ie. find out how long each step takes.
>
> My first idea was to add a $(date) execution to PS4, but I found that it
> doesn't work in zsh (it works in bash).
>
> Do you have any suggestions about a better way to profile my startup
> scripts?
>
> Also, would you add this feature (command execution substitution in PS4) to
> zsh?

Running $(date) on every line of your rc is probably a bad idea, but
you can setopt promptsubst to enable it. Rather than running date,
though, it's a much better idea to run typeset -F 3 SECONDS and use
$SECONDS in PS4 (this also needs promptsubst).

-- 
Mikael Magnusson



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