From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id B58BC2EC53 for ; Fri, 6 Sep 2024 11:52:52 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1725616372; b=V3qFO06fJUsU8lIwuWX5PqtEEDPrmT41wqeVevWPDiDz6GiG7iTUCsTzlxpl+xgLPij9WmeGJk XVhU3hJ9TR5C+YpebsUWRAXqFKdPjtnZNsLjy7LzxwroBe1BgD/YL7g0Vu1VNLlacbmUanydPp nH6Of22nvdONUkgtlCoC9gTHjqFK7+HJrvrb5zCPKOprLQglKpIvTljf6PBv6TKlYZyB7Q+cEY OEJRkMijjfA0SK8BZofGDuTnv36SAm1VtoP6wTIy0J6sPAiDy9INePi5LuN6o2vFDFPwRbJ6Pe 3rZf9aiJX5GMrZYVt4mujaSQ2cXtliFbzLYIiXZg3+7rXw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta-snd-w01.biglobe.ne.jp) smtp.remote-ip=27.86.113.17; dkim=pass header.d=kba.biglobe.ne.jp header.s=default-1th84yt82rvi header.a=rsa-sha256; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1725616372; bh=5TLWVJN7Z+oTm/U4Gqhw7jxPm5Kh3w0n3YWYAIj2bKY=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:DKIM-Signature:Message-ID:In-Reply-To:To:References:Date: Subject:MIME-Version:Content-Transfer-Encoding:Content-Type:From: DKIM-Signature; b=EapPCWXQNbm9za7YNGXpjj+rIzaL0+pIv3UGYCnO0qkyJO3P4INDRNQg85VKmj6zUnN2ZC5o52 5DQpZWCi5k0NnUyyhPtpgxcbeZeEe8wmXHtZ2gHUddGWCSTjHe+lJT+qIUF1eMaFSENiZplPbh 8g8e7XJ91qEqvOncdyANBvDMMGiea7k0snUWOgXd9ngU0ZDTodwpxwG2ffICNCQCENKmAOJY65 LylXdqGbStPATYRUejQ4JZPFJImNAnOlWReHIroOv0Y1Tn0PCSghZjHcWPSLyiNdAqzRWh0JZI GHhxrPFpSBB9N2uyfVrkAfLzVeWodHyNTWjF/XTYMI2kmQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-Id:In-Reply-To:To:References: Date:Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=N1aPTm7cHMruiORFQiJaRNF8D5HmcwvEXI2a+marSqk=; b=UQhs0L0eCHYYA8B/8NFcixlHnf hUi7/W9+zKvozK3Zh8zblKWK66sJauDuVbSpOiS0ZP7t4UDGl2cigbqrDW8vM/8U/gGB+LVIxKz2Q 7JJTyt8vr3MwyBLWQB7IhDHRuBbfjpT6lUgQyzx6NXwlg1d7CqPVHpNTjqM9xM8qLVaVTLb5RqVvT Q/8SbzWbAkmgO10Uy1mHnUB5xAYGrbTyOLJN8ANAhYzWtj+or+4xF4cXTKHDG6oiq93hCDTX0UTJ9 V62IPfhHfZdAWJSokrYTR89Sx+nJn3zRca+bd2FpdEmmD4NVisn09WT3EQnW2TwDb9fo9WW4rYCIL AIEDJhww==; Received: by zero.zsh.org with local id 1smVe8-000E6X-1r; Fri, 06 Sep 2024 09:52:52 +0000 Authentication-Results: zsh.org; iprev=pass (mta-snd-w01.biglobe.ne.jp) smtp.remote-ip=27.86.113.17; dkim=pass header.d=kba.biglobe.ne.jp header.s=default-1th84yt82rvi header.a=rsa-sha256; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from mta-snd-w01.biglobe.ne.jp ([27.86.113.17]:65185) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1smVdr-000Dlr-0S; Fri, 06 Sep 2024 09:52:36 +0000 Received: from mail.biglobe.ne.jp by mta-snd-w01.biglobe.ne.jp with ESMTP id <20240906095231890.DYEO.85838.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Fri, 6 Sep 2024 18:52:31 +0900 From: Jun T Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: Re: Bug: time doesn't work on builtins Date: Fri, 6 Sep 2024 18:52:17 +0900 References: <20C9A9EE-49A5-4A58-AA00-136A5D221331@kba.biglobe.ne.jp> To: zsh-workers@zsh.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3731.700.6) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kba.biglobe.ne.jp; s=default-1th84yt82rvi; t=1725616351; bh=N1aPTm7cHMruiORFQiJaRNF8D5HmcwvEXI2a+marSqk=; h=From:Subject:Date:References:To:In-Reply-To; b=PDPFut9uLqKvrmT9Idruadb3yHLoydSYDScq8UpQk5Mpx9r9wpeVUVsIT+x3opwz8jySR1tc QTjz4lynR2NQvZqPbOuUIjLKZU4jC0FcEbF7xVMlqXYP/PgbQ5cRMag8tJVZXZb5ncPrIzXDrw OO0g+dKOlQ5lnA3mVKES8TPVPvnTCTuHG5AafS5VDFtaLNHXMTtCDbfwCUF6XPYqA2LDSnTgaP mqOUgxUHUTw8vK+6L1K1/L+CnLC3wccL2b4CM9jeyT/yL+/Qu2pJd+6Brs6hmBBpROKmfJDdq8 gjZWS59RfTw4Is7f3lkTaZ1GX5bkEhEnUjMiuckwkJXSCawQ== X-Seq: 53070 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: > 2024/09/06 9:10, Bart Schaefer wrote: >=20 > On Wed, Sep 4, 2024 at 7:33=E2=80=AFAM Jun. T = wrote: >>=20 >> The followings still give no time statistics: >>=20 >> % time x=3D1 >> % time x=3D$(date) >=20 > (Hand-fuzzed patch follows) The patch works for the above two cases, but I've fond there are still more problems... [1] In the patch file "time-builtin.txt": @@ -4377,6 +4384,8 @@ execcmd_exec(Estate state, Execcmd_params eparams, errflag |=3D ERRFLAG_ERROR; } } + if (is_cursh && (how & Z_TIMED)) + shelltime(&shti, is_builtin ? NULL : &chti, &then, 1); Due to "is_builtin ? NULL : &chti", child time is not reported for the cases such as % time eval 'external command' % time . ./script # script runs external command I think it's better to pass &chti always. [2] Time spent in prefork() is not included in the statistics. % time echo $(x=3D0;for ((i=3D0; i<=3D100000; ++i)); do ((x+=3Di)); = done; echo $x) 5000050000 shell 0.00s user 0.00s system 100% cpu 0.000 total % time cat <(time-consuming-command) # cat is not builtin (the problem existed before applying "time-builtin.txt") % time echo $(external command) Even if the problem [1] is fixed (by always passing &chti) the time reported would not include the time used for the 'external command'. Not sure this can be fixed easily.=