Skip to content

Commit

Permalink
measuring performance concurrently for h2c-client
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Jun 14, 2024
1 parent adb6b61 commit 51cfe54
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions util/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ client :: Options -> [Path] -> Client ()
client Options{..} paths sendRequest _aux = do
let cli
| optPerformance /= 0 = clientPF optPerformance sendRequest
| otherwise =
foldr1 concurrently_ $ map (clientNReqs optNumOfReqs sendRequest) paths
ex <- E.try cli
| otherwise = clientNReqs optNumOfReqs sendRequest
ex <- E.try $ mapConcurrently_ cli paths
case ex of
Right () -> return ()
Left e -> print (e :: HTTP2Error)
Expand All @@ -43,8 +42,9 @@ clientNReqs n0 sendRequest path = loop n0
getResponseBodyChunk rsp >>= C8.putStrLn
loop (n - 1)

clientPF :: Int -> SendRequest -> IO ()
clientPF n sendRequest = do
-- Path is dummy
clientPF :: Int -> SendRequest -> Path -> IO ()
clientPF n sendRequest _ = do
t1 <- getUnixTime
sendRequest req loop
t2 <- getUnixTime
Expand Down

0 comments on commit 51cfe54

Please sign in to comment.