RE: Bug/limitation in 'time'

2013-03-17 Thread Bruce Dawson
The man page is clear that it is displaying the results of wait3(). However it doesn't mention that this means that sub-process startup time is not accounted for. That's what I feel should be clarified. Otherwise a CPU bound task may appear to not be CPU bound. My expectation is that the sum of 'u

Re: Bug/limitation in 'time'

2013-03-17 Thread Hans J. Albertsson
This version is actually slightly faster... And the sys time goes down very close to zero. Now, what were you actually looking to test?? My version might be utterly irrelevant. function BashCount() { i=$1 while (( i-- )) ; do true done echo Just

Re: Bug/limitation in 'time'

2013-03-17 Thread Pierre Gaston
On Sun, Mar 17, 2013 at 5:58 PM, Bruce Dawson wrote: > The man page is clear that it is displaying the results of wait3(). However > it doesn't mention that this means that sub-process startup time is not > accounted for. That's what I feel should be clarified. Otherwise a CPU bound > task may app

Re: Bug/limitation in 'time'

2013-03-17 Thread Bob Proulx
Bruce Dawson wrote: > The man page is clear that it is displaying the results of wait3(). Man page for time? You mean the time section of the man page for bash. If you are looking at the time man page then you are looking at the standalone /usr/bin/time command and not the bash builtin time comm

Re: Bug/limitation in 'time'

2013-03-17 Thread Pierre Gaston
On Sun, Mar 17, 2013 at 9:07 PM, Bob Proulx wrote: > Bruce Dawson wrote: >> The man page is clear that it is displaying the results of wait3(). > > Man page for time? You mean the time section of the man page for > bash. no > If you are looking at the time man page then you are looking at > the

Re: Bug/limitation in 'time'

2013-03-17 Thread Dan Douglas
On Sunday, March 17, 2013 01:09:47 AM William Park wrote: > On Sat, Mar 16, 2013 at 10:15:50PM -0400, Chris F.A. Johnson wrote: > > On Sun, 17 Mar 2013, Chris Down wrote: > > > ExprCount() { > > > for (( i = $1 ; i > 0 ; i-- )); do > > > : > > > done > > > echo "$1 ite

Re: Bug/limitation in 'time'

2013-03-17 Thread Linda Walsh
Bruce Dawson wrote: > Yep, we've changed our loops to use roughly that syntax. Unfortunately a lot > of online resources recommend the $(expr) technique. My understanding is > that using $(expr) is more portable, because i-- is bash specific, but I > don't really know. but $((i-=1)) isn't Bash s

RE: Bug/limitation in 'time'

2013-03-17 Thread Bruce Dawson
Chris Down pointed that out. My loop now looks like this -- portable (I believe) and fast: BashCount() { for (( i = $1 ; i > 0 ; i-- )); do : done echo Just did $1 iterations using bash math } -Original Message- From: Linda Walsh [mailto:b...@tlinx.org] Sent: Sunday,

RE: Bug/limitation in 'time'

2013-03-17 Thread Chris F.A. Johnson
On Sun, 17 Mar 2013, Bruce Dawson wrote: Chris Down pointed that out. My loop now looks like this -- portable (I believe) and fast: BashCount() { for (( i = $1 ; i > 0 ; i-- )); do No, that is not portable. The only portable use of (( ... )) is $(( ... )) -- Chris F.A. Johnson, <

Re: Bug/limitation in 'time'

2013-03-17 Thread Jonathan Nieder
-bug-bash, +help-bash Bruce Dawson wrote: > Chris Down pointed that out. My loop now looks like this -- portable (I > believe) and fast: > > BashCount() { > for (( i = $1 ; i > 0 ; i-- )); do Not actually portable to non ksh-based shells. See for hints. Hope