From: Dominik Vogt <vogt@linux.vnet.ibm.com>
To: zsh-users@zsh.org
Subject: Re: How do I accomplish this?
Date: Thu, 26 Jan 2017 21:33:33 +0100 [thread overview]
Message-ID: <20170126203333.GA15148@linux.vnet.ibm.com> (raw)
In-Reply-To: <d64277ff-a2d9-b517-bc4b-0d0ea5efdd1d@gmail.com>
On Thu, Jan 26, 2017 at 12:19:10PM -0800, Kannan Varadhan wrote:
> Some of the commands I run seem to take a long time, but also
> varying amounts of time.
>
> I'd like to prefix "time" to every command that runs. So that,
>
> when I type:
>
>
> % make long-running-target
>
> I'd like to see the equivalent of:
>
>
> % time make long-running-target
>
> ...
>
> make long-running-target 0.00s user 0.00s system 66% cpu
> 0.004 total
>
>
> I thought preexec() might help:
>
>
> preexec() {
>
> set $3
>
> eval time "$@"
>
> }
>
>
> but this ends up running the same command twice, once timed, and
> once without.
Setting REPORTTIME does the trick:
REPORTTIME=1 # stats for procs using 1 or more seconds
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
IBM Germany
next prev parent reply other threads:[~2017-01-26 21:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-26 20:19 Kannan Varadhan
2017-01-26 20:33 ` Dominik Vogt [this message]
2017-01-26 23:22 ` Kannan Varadhan
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=20170126203333.GA15148@linux.vnet.ibm.com \
--to=vogt@linux.vnet.ibm.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).