zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org, zsh-users@zsh.org
Subject: Re: profile prompt rendering time
Date: Wed, 13 Jul 2016 11:08:43 -0700	[thread overview]
Message-ID: <160713110843.ZM21443@torch.brasslantern.com> (raw)
In-Reply-To: <CAEwkUWO7yrxptZChw7Q3F=u=0+Uwf+Frmzo24py3xvrK1=cTtA@mail.gmail.com>

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


  reply	other threads:[~2016-07-13 18:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13 14:17 Filipe Silva
2016-07-13 18:08 ` Bart Schaefer [this message]
2016-07-13 19:31   ` Filipe Silva
2016-07-13 21:29     ` Bart Schaefer
2016-07-13 21:37 ` Richo Healey
2016-07-13 22:37   ` Filipe Silva
2016-07-13 23:49   ` Bart Schaefer
2016-07-14  0:23     ` Filipe Silva
2016-07-14  5:25       ` Bart Schaefer
2016-07-14  0:28     ` Nikolay Aleksandrovich Pavlov (ZyX)
2016-07-14  0:49       ` Filipe Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=160713110843.ZM21443@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).