From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3255 invoked by alias); 26 Jan 2017 23:22:33 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22429 Received: (qmail 9789 invoked from network); 26 Jan 2017 23:22:33 -0000 X-Qmail-Scanner-Diagnostics: from mail-pg0-f52.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.83.52):SA:0(0.2/5.0):. Processed in 1.195947 secs); 26 Jan 2017 23:22:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: kvaradhan3@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 74.125.83.52 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=qUngm8wBTiBzRCKH5E5Fy+Lw4reK2/c9J3vZMGQ6DE4=; b=OmK/y2hxpdpXE8t/g/u1ypTP7yMQYZkrsrcw/RHnQT5X4LsGAyvoy+exvnuEV07zbR NEDRPxzbc8VbKG0118ndj37Jhw0joBHV8gVWyiMVDR74OoshZTyy6m0telbIr06TexlH ZLDliOwH0zD0f1pVrbH8+rqptZfc0j1WRzu3omnTnwwA9kprqyTDm1Htj23jvXINrBMC e5uQZ4KU9ri/zV47bd/HVZrUV1z+z8jTD2PfGErpv2jVeYeoUpGjI+nTguY1TVxPN3V6 ZjQWsNzoSB9ATSPiO0OoCFDdgO4UP/slFJ0lN6JF/1w2NxZWvlZ4fd0cQCO/zXwBR0bY InEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=qUngm8wBTiBzRCKH5E5Fy+Lw4reK2/c9J3vZMGQ6DE4=; b=DiEXIM13xZcTbyUZ9avZYcnBDCY8sioTqhFD2OWQ025l+6aXLsesQ5phV871PpOGk4 fsl+lGKmkHDX2W7qX2HpMRru3KwQKOAZwvKFfzv97MnDUm3TFPf6qomWN7Hz/rA9TAAP 2R8420e3RqweSUu6kxUzN7NtmZ/03uHB2NeCMibib7IoCThC5OudBVrnEgsTD39BEDAh l2Ubs6MKDiDGeKFANuM+eR8+P2x3Sxhr05aVVfepzxf3YBY81Y1nkorUAv8vbJstur1L gt63WOSCcnt4yG54cwIe2R4EZ8m2ClmelaSB5rcZYLnOegFCC6gb3Qb9r5wkDyPNVZna RpAw== X-Gm-Message-State: AIkVDXLTHeVnCgll4oJcv3wrSi6OmepyF8HLFB+L3ve6ySQ5hZNedXHgZEglbpt1PPZUJA== X-Received: by 10.84.137.37 with SMTP id 34mr7746760plm.29.1485472946262; Thu, 26 Jan 2017 15:22:26 -0800 (PST) Subject: Re: How do I accomplish this? To: zsh-users@zsh.org References: <20170126203333.GA15148@linux.vnet.ibm.com> From: Kannan Varadhan Message-ID: <42239862-71a6-61ba-4f53-54b7297aec74@gmail.com> Date: Thu, 26 Jan 2017 15:22:24 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170126203333.GA15148@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Nice. I didnt know where to look for it, THanks, Kannan On 1/26/17 12:33 PM, Dominik Vogt wrote: > 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 ^_^ ^_^ >