mirror of
https://github.com/composewell/streamly.git
synced 2024-10-26 19:50:19 +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 ""
|
||||||
|
, "\ntotal dispatches = " <> show dispatches
|
||||||
|
, "\nmax workers = " <> show maxWrk
|
||||||
|
, "\nmax outQSize = " <> show maxOq
|
||||||
|
, if minLat > 0
|
||||||
then "\nmin worker latency = " <> showNanoSecond64 minLat
|
then "\nmin worker latency = " <> showNanoSecond64 minLat
|
||||||
else "")
|
else ""
|
||||||
<> (if maxLat > 0
|
, if maxLat > 0
|
||||||
then "\nmax worker latency = " <> showNanoSecond64 maxLat
|
then "\nmax worker latency = " <> showNanoSecond64 maxLat
|
||||||
else "")
|
else ""
|
||||||
<> (if avgCnt > 0
|
, if avgCnt > 0
|
||||||
then let lat = avgTime `div` fromIntegral avgCnt
|
then let lat = avgTime `div` fromIntegral avgCnt
|
||||||
in "\navg worker latency = " <> showNanoSecond64 lat
|
in "\navg worker latency = " <> showNanoSecond64 lat
|
||||||
else "")
|
else ""
|
||||||
<> (if svarLat > 0
|
, if svarLat > 0
|
||||||
then "\nSVar latency = " <> showRelTime64 svarLat
|
then "\nchannel latency = " <> showRelTime64 svarLat
|
||||||
else "")
|
else ""
|
||||||
<> (if svarCnt > 0
|
, if svarCnt > 0
|
||||||
then "\nSVar yield count = " <> show svarCnt
|
then "\nchannel yield count = " <> show svarCnt
|
||||||
else "")
|
else ""
|
||||||
<> (if svarGainLossCnt > 0
|
, if svarGainLossCnt > 0
|
||||||
then "\nSVar gain/loss yield count = " <> show svarGainLossCnt
|
then "\nchannel gain/loss yield count = " <> show svarGainLossCnt
|
||||||
else "")
|
else ""
|
||||||
]
|
]
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user