4 SocketManager setSelectTimeout(0.0)
5 Scheduler
setSleepInterval(0)
7 requestCount
:= if(args
at(0), args
at(0) asNumber
, 10000)
10 lastChunkTime
:= Date clone now
13 for (i
, 1, requestCount
,
14 socket
:= Socket clone setHost("127.0.0.1") setPort(8000)
15 socket
setReadTimeout(.01) setConnectTimeout(.1)
17 if (socket isOpen
== nil
, writeln(i
, " failed connect"); continue)
18 socket
write("GET /\r\n")
21 dt
:= (Date clone now
- lastChunkTime
) totalSeconds
24 writeln(i
, " paused for ", dt
asString(1, 5), " seconds, diff: ", i
- lastPause
)
27 lastChunkTime
:= Date clone now
32 dt
:= (Date clone now
- t1
) totalSeconds
33 writeln(requestCount
, " requests in ", dt
, " seconds")
34 writeln((requestCount
/ dt
) floor
, " requests per second")