mirror of
https://github.com/composewell/streamly.git
synced 2024-09-11 19:47:10 +03:00
Add stop reason and life-time duration to channel dump
This commit is contained in:
parent
79e743667b
commit
13d165082b
@ -207,47 +207,55 @@ dumpSVarStats inspecting rateInfo ss = do
|
|||||||
minLat <- readIORef $ minWorkerLatency ss
|
minLat <- readIORef $ minWorkerLatency ss
|
||||||
maxLat <- readIORef $ maxWorkerLatency ss
|
maxLat <- readIORef $ maxWorkerLatency ss
|
||||||
(avgCnt, avgTime) <- readIORef $ avgWorkerLatency ss
|
(avgCnt, avgTime) <- readIORef $ avgWorkerLatency ss
|
||||||
(svarCnt, svarGainLossCnt, svarLat) <- case rateInfo of
|
stopTime <- readIORef (svarStopTime ss)
|
||||||
Nothing -> return (0, 0, 0)
|
let stopReason =
|
||||||
|
case stopTime of
|
||||||
|
Nothing -> "on GC"
|
||||||
|
Just _ -> "normal"
|
||||||
|
(svarCnt, svarGainLossCnt, svarLat, interval) <- case rateInfo of
|
||||||
|
Nothing -> return (0, 0, 0, 0)
|
||||||
Just yinfo -> do
|
Just yinfo -> do
|
||||||
(cnt, startTime) <- readIORef $ svarAllTimeLatency yinfo
|
(cnt, startTime) <- readIORef $ svarAllTimeLatency yinfo
|
||||||
if cnt > 0
|
interval <-
|
||||||
then do
|
case stopTime of
|
||||||
t <- readIORef (svarStopTime ss)
|
|
||||||
gl <- readIORef (svarGainedLostYields yinfo)
|
|
||||||
case t of
|
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
now <- getTime Monotonic
|
now <- getTime Monotonic
|
||||||
let interval = diffAbsTime64 now startTime
|
return (diffAbsTime64 now startTime)
|
||||||
return (cnt, gl, interval `div` fromIntegral cnt)
|
Just t -> do
|
||||||
Just stopTime -> do
|
return (diffAbsTime64 t startTime)
|
||||||
let interval = diffAbsTime64 stopTime startTime
|
if cnt > 0
|
||||||
return (cnt, gl, interval `div` fromIntegral cnt)
|
then do
|
||||||
else return (0, 0, 0)
|
gl <- readIORef (svarGainedLostYields yinfo)
|
||||||
|
return (cnt, gl, interval `div` fromIntegral cnt, interval)
|
||||||
|
else return (0, 0, 0, interval)
|
||||||
|
|
||||||
return $ unlines
|
return $ concat
|
||||||
[ "total dispatches = " <> show dispatches
|
[ "stop reason = " <> stopReason
|
||||||
, "max workers = " <> show maxWrk
|
, if interval > 0
|
||||||
, "max outQSize = " <> show maxOq
|
then "\nlife time = " <> showRelTime64 interval
|
||||||
<> (if minLat > 0
|
else ""
|
||||||
then "\nmin worker latency = " <> showNanoSecond64 minLat
|
, "\ntotal dispatches = " <> show dispatches
|
||||||
else "")
|
, "\nmax workers = " <> show maxWrk
|
||||||
<> (if maxLat > 0
|
, "\nmax outQSize = " <> show maxOq
|
||||||
then "\nmax worker latency = " <> showNanoSecond64 maxLat
|
, if minLat > 0
|
||||||
else "")
|
then "\nmin worker latency = " <> showNanoSecond64 minLat
|
||||||
<> (if avgCnt > 0
|
else ""
|
||||||
then let lat = avgTime `div` fromIntegral avgCnt
|
, if maxLat > 0
|
||||||
in "\navg worker latency = " <> showNanoSecond64 lat
|
then "\nmax worker latency = " <> showNanoSecond64 maxLat
|
||||||
else "")
|
else ""
|
||||||
<> (if svarLat > 0
|
, if avgCnt > 0
|
||||||
then "\nSVar latency = " <> showRelTime64 svarLat
|
then let lat = avgTime `div` fromIntegral avgCnt
|
||||||
else "")
|
in "\navg worker latency = " <> showNanoSecond64 lat
|
||||||
<> (if svarCnt > 0
|
else ""
|
||||||
then "\nSVar yield count = " <> show svarCnt
|
, if svarLat > 0
|
||||||
else "")
|
then "\nchannel latency = " <> showRelTime64 svarLat
|
||||||
<> (if svarGainLossCnt > 0
|
else ""
|
||||||
then "\nSVar gain/loss yield count = " <> show svarGainLossCnt
|
, if svarCnt > 0
|
||||||
else "")
|
then "\nchannel yield count = " <> show svarCnt
|
||||||
|
else ""
|
||||||
|
, if svarGainLossCnt > 0
|
||||||
|
then "\nchannel gain/loss yield count = " <> show svarGainLossCnt
|
||||||
|
else ""
|
||||||
]
|
]
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user