Skip to main content
deleted 6 characters in body
Source Link
manatwork
  • 20.7k
  • 5
  • 51
  • 81

Groovy, 158158 143 characters

d={Systemnew Date().currentTimeMillisgetTime()}
s=d(j=[]j=0)
138.times{Thread.start{b=d(m=1000)
sleep 50008*m
synchronized(j){j<<dj+=d()-b}}}addShutdownHook{print([(d()-s)/1000m,j.sum()/1000]m])}

SamplerSample run:

bash-4.3$ groovy wait1minute.groovy 
[5[8.082031, 6564.164]055]

Groovy, 158 characters

d={System.currentTimeMillis()}
s=d(j=[])
13.times{Thread.start{b=d()
sleep 5000
synchronized(j){j<<d()-b}}}addShutdownHook{print([(d()-s)/1000,j.sum()/1000])}

Sampler run:

bash-4.3$ groovy wait1minute.groovy 
[5.082, 65.164]

Groovy, 158 143 characters

d={new Date().getTime()}
s=d(j=0)
8.times{Thread.start{b=d(m=1000)
sleep 8*m
synchronized(j){j+=d()-b}}}addShutdownHook{print([(d()-s)/m,j/m])}

Sample run:

bash-4.3$ groovy wait1minute.groovy
[8.031, 64.055]
Source Link
manatwork
  • 20.7k
  • 5
  • 51
  • 81

Groovy, 158 characters

d={System.currentTimeMillis()}
s=d(j=[])
13.times{Thread.start{b=d()
sleep 5000
synchronized(j){j<<d()-b}}}addShutdownHook{print([(d()-s)/1000,j.sum()/1000])}

Sampler run:

bash-4.3$ groovy wait1minute.groovy 
[5.082, 65.164]