From owner-svn-src-head@freebsd.org Tue Jul 7 16:07:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A61B366130; Tue, 7 Jul 2020 16:07:40 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B1S580nsRz3XD9; Tue, 7 Jul 2020 16:07:40 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE1D611E74; Tue, 7 Jul 2020 16:07:39 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 067G7dwD061566; Tue, 7 Jul 2020 16:07:39 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 067G7dWM061565; Tue, 7 Jul 2020 16:07:39 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202007071607.067G7dWM061565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Tue, 7 Jul 2020 16:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362992 - head/usr.bin/time X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/usr.bin/time X-SVN-Commit-Revision: 362992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jul 2020 16:07:40 -0000 Author: fernape (ports committer) Date: Tue Jul 7 16:07:39 2020 New Revision: 362992 URL: https://svnweb.freebsd.org/changeset/base/362992 Log: time(1): Add EXAMPLES section Add EXAMPLES showing all five flags: -a, -h, -l, -o, -p Approved by: manpages (bcr) Modified: head/usr.bin/time/time.1 Modified: head/usr.bin/time/time.1 ============================================================================== --- head/usr.bin/time/time.1 Tue Jul 7 13:51:16 2020 (r362991) +++ head/usr.bin/time/time.1 Tue Jul 7 16:07:39 2020 (r362992) @@ -28,7 +28,7 @@ .\" @(#)time.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd May 14, 2006 +.Dd July 7, 2020 .Dt TIME 1 .Os .Sh NAME @@ -129,6 +129,62 @@ If .Nm encounters any other error, the exit status is between 1 and 125 included. +.Sh EXAMPLES +Time the execution of +.Xr ls 1 +on an empty directory: +.Bd -literal -offset indent +$ /usr/bin/time ls + 0.00 real 0.00 user 0.00 sys +.Ed +.Pp +Time the execution of the +.Xr cp 1 +command and store the result in the +.Pa times.txt +file. +Then execute the command again to make a new copy and add the result to the same +file: +.Bd -literal -offset indent +$ /usr/bin/time -o times.txt cp FreeBSD-12.1-RELEASE-amd64-bootonly.iso copy1.iso +$ /usr/bin/time -a -o times.txt cp FreeBSD-12.1-RELEASE-amd64-bootonly.iso copy2.iso +.Ed +.Pp +The +.Pa times.txt +file will contain the times of both commands: +.Bd -literal -offset indent +$ cat times.txt + 0.68 real 0.00 user 0.22 sys + 0.67 real 0.00 user 0.21 sys +.Ed +.Pp +Time the +.Xr sleep 1 +command and show the results in a human friendly format. +Show the contents of the +.Em rusage +structure too: +.Bd -literal -offset indent +$ /usr/bin/time -l -h -p sleep 5 +real 5.01 +user 0.00 +sys 0.00 + 0 maximum resident set size + 0 average shared memory size + 0 average unshared data size + 0 average unshared stack size + 80 page reclaims + 0 page faults + 0 swaps + 1 block input operations + 0 block output operations + 0 messages sent + 0 messages received + 0 signals received + 3 voluntary context switches + 0 involuntary context switches +.Ed .Sh SEE ALSO .Xr builtin 1 , .Xr csh 1 ,