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

Re: profile prompt rendering time



Hi, Bart. thanks for the help. I can work with the execution time of ls
included, no problem.
that's because I can compare the execution time of ls in the same dir, with
the plugin, and without the plugin. The difference between the two tests
will give me the performance hit of the plugin.

But I did not really understand where I have to declare SECONDS.See if I
understand correctly. I'll open my zshrc and type this:

```
preexec() {
  float SECONDS
}
precmd() {
  print $SECONDS
}
```

is that right?

Also, is 4.800e+2 = 480 milliseconds?

thanks again,

Filipe.



On Wed, Jul 13, 2016 at 3:08 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:

> On Jul 13, 11:17am, Filipe Silva wrote:
> }
> } I'm talking about the time that it takes for zsh to give me another
> } prompt once that it is fully loaded. In other words, I want to achieve
> } this:
> }
> } ~ $ ls (when i hit enter, start counting)
> } code/ notes/ file.txt
> } ~ $ (stop counting when this prompt appears. show me elapsed time)
>
> By your literal example, you would be getting a timing that includes
> the execution of "ls".  Is that really what you want?
>
> Assuming not, probably the closest you can get is to declare
>
>     float SECONDS
>
> and then print $SECONDS at the end of your precmd function, and at the
> beginning of the zle-line-init widget call "zle -M $SECONDS".
>
> However, I don't know how to explain in detail how to accomplish that
> because you mention using plugins and I have no way to know whether
> those plugins have co-opted precmd or zle-line-init for other uses.
>
> If you really do want to include the execution time of "ls", then
> print $SECONDS at the end of preexec instead of at the end of precmd.
>
> Just to demonstrate, here's the output from precmd/zle-line-init with
> an otherwise virgin "zsh -f" on my desktop:
>
> torch% echo start
> start
> 4.800639270e+02
> torch%
> 4.800641060e+02
>
>


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