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

Re: "Profiling" my startup scripts



In the last episode (Nov 23), Daniel Serodio (lists) said:
> 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?

You need the PROMPT_SUBST option for $() to work in prompt strings.  But
it's a lot more efficient to just have zsh print the time directly, without
forking a subshell: PS4="%D %* "

-- 
	Dan Nelson
	dnelson@xxxxxxxxxxxxxxx



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