Show per-line wall clock info
parent
ca93157c6e
commit
ac6997be19
|
@ -105,7 +105,7 @@ data JoinMode
|
||||||
|
|
||||||
data JoinedInfo
|
data JoinedInfo
|
||||||
= JoinedNot Bool -- yield or drop, not to be merged. bool determines whether to forward
|
= JoinedNot Bool -- yield or drop, not to be merged. bool determines whether to forward
|
||||||
| JoinedHeader Bool (Maybe Text) Int Int -- header, not to be merged. bool determines whether to forward. Int is count stdout/stderr
|
| JoinedHeader TimeSpec Bool (Maybe Text) Int Int -- header, not to be merged. bool determines whether to forward. Int is count stdout/stderr
|
||||||
| JoinedAll Bool Int -- bool determines whether to forward
|
| JoinedAll Bool Int -- bool determines whether to forward
|
||||||
| Joined Int Text [Text] -- pattern, prefix
|
| Joined Int Text [Text] -- pattern, prefix
|
||||||
|
|
||||||
|
@ -238,21 +238,21 @@ dispatchPat oldKind i pat prefix = do
|
||||||
StdOut -> when (c_keepStdout conf /= Drop) $ outputConcurrent prettyPat
|
StdOut -> when (c_keepStdout conf /= Drop) $ outputConcurrent prettyPat
|
||||||
StdErr -> when (c_keepStderr conf /= Drop) $ errorConcurrent prettyPat
|
StdErr -> when (c_keepStderr conf /= Drop) $ errorConcurrent prettyPat
|
||||||
|
|
||||||
showHeader :: Text -> Maybe Text -> Int -> Int -> Text
|
showHeader :: Float -> Text -> Maybe Text -> Int -> Int -> Text
|
||||||
showHeader header mLevel2 countOut countErr =
|
showHeader diffTime header mLevel2 countOut countErr =
|
||||||
header
|
header
|
||||||
<> (maybe (t "") (\l2 -> t " " <> l2) mLevel2)
|
<> (maybe (t "") (\l2 -> t " " <> l2) mLevel2)
|
||||||
<> fGrey
|
<> fGrey
|
||||||
<> t " ("
|
<> t (printf " (%i/%i lines out/err, %0.1fs)" countOut countErr diffTime)
|
||||||
<> t (show countOut)
|
|
||||||
<> t "/"
|
|
||||||
<> t (show countErr)
|
|
||||||
<> t " lines out/err)"
|
|
||||||
<> fReset
|
<> fReset
|
||||||
|
|
||||||
dispatchHeader :: StreamKind -> Int -> Int -> Text -> StateT State IO ()
|
dispatchHeader
|
||||||
dispatchHeader oldKind countOut countErr header = do
|
:: TimeSpec -> StreamKind -> Int -> Int -> Text -> StateT State IO ()
|
||||||
let prettyPat = showHeader header Nothing countOut countErr <> t "\n"
|
dispatchHeader startTime oldKind countOut countErr header = do
|
||||||
|
now <- gets s_nowTime
|
||||||
|
let prettyPat =
|
||||||
|
showHeader (diffTimes startTime now) header Nothing countOut countErr
|
||||||
|
<> t "\n"
|
||||||
conf <- gets s_config
|
conf <- gets s_config
|
||||||
liftIO $ case oldKind of
|
liftIO $ case oldKind of
|
||||||
StdOut -> when (c_keepStdout conf /= Drop) $ outputConcurrent prettyPat
|
StdOut -> when (c_keepStdout conf /= Drop) $ outputConcurrent prettyPat
|
||||||
|
@ -283,8 +283,8 @@ dispatchSummary = \case
|
||||||
SummaryNone -> pure ()
|
SummaryNone -> pure ()
|
||||||
SummaryNorm kind line (JoinedNot keep) ->
|
SummaryNorm kind line (JoinedNot keep) ->
|
||||||
when keep $ dispatchYielded (kind, line)
|
when keep $ dispatchYielded (kind, line)
|
||||||
SummaryNorm kind line (JoinedHeader keep _mLevel2 iOut iErr) ->
|
SummaryNorm kind line (JoinedHeader startTime keep _mLevel2 iOut iErr) ->
|
||||||
when keep $ dispatchHeader kind iOut iErr line
|
when keep $ dispatchHeader startTime kind iOut iErr line
|
||||||
SummaryNorm kind _ (JoinedAll keep i ) -> when keep $ dispatchSkipped kind i
|
SummaryNorm kind _ (JoinedAll keep i ) -> when keep $ dispatchSkipped kind i
|
||||||
SummaryNorm kind _ (Joined i pat prefix) -> dispatchPat kind i pat prefix
|
SummaryNorm kind _ (Joined i pat prefix) -> dispatchPat kind i pat prefix
|
||||||
|
|
||||||
|
@ -322,8 +322,9 @@ summarizeLines (kind, line, _linetime) = do
|
||||||
(JoinSpecific, pat) ->
|
(JoinSpecific, pat) ->
|
||||||
SummaryNorm kind line (Joined 1 pat (Text.words line))
|
SummaryNorm kind line (Joined 1 pat (Text.words line))
|
||||||
(JoinHeader1, _) ->
|
(JoinHeader1, _) ->
|
||||||
SummaryNorm kind line (JoinedHeader False Nothing 0 0)
|
SummaryNorm kind line (JoinedHeader (s_nowTime s) False Nothing 0 0)
|
||||||
(JoinHeader2 , _) -> SummaryNorm kind line (JoinedNot False)
|
(JoinHeader2, _) ->
|
||||||
|
SummaryNorm kind line (JoinedHeader (s_nowTime s) False Nothing 0 0)
|
||||||
(JoinDrop , _) -> SummaryNorm kind line (JoinedNot False)
|
(JoinDrop , _) -> SummaryNorm kind line (JoinedNot False)
|
||||||
(JoinErrorStart, _) -> SummaryErr kind line
|
(JoinErrorStart, _) -> SummaryErr kind line
|
||||||
(JoinErrorStop, _) ->
|
(JoinErrorStop, _) ->
|
||||||
|
@ -365,21 +366,24 @@ summarizeLines (kind, line, _linetime) = do
|
||||||
(SummaryNorm oldKind oldLine (JoinedNot keep), _joiner) -> do
|
(SummaryNorm oldKind oldLine (JoinedNot keep), _joiner) -> do
|
||||||
when keep $ dispatchYielded (oldKind, oldLine)
|
when keep $ dispatchYielded (oldKind, oldLine)
|
||||||
defaultReplace
|
defaultReplace
|
||||||
(SummaryNorm oldKind oldLine (JoinedHeader keep mLevel2 countOut countErr), joiner)
|
(SummaryNorm oldKind oldLine (JoinedHeader startTime keep mLevel2 countOut countErr), joiner)
|
||||||
-> do
|
-> do
|
||||||
let replaceMay = case joiner of
|
let
|
||||||
(JoinYield , _pat) -> Just (JoinedNot True)
|
replaceMay = case joiner of
|
||||||
(JoinAllKeep , _ ) -> Just (JoinedAll True 1)
|
(JoinYield , _pat) -> Just (JoinedNot True)
|
||||||
(JoinAllDrop , _ ) -> Nothing
|
(JoinAllKeep , _ ) -> Just (JoinedAll True 1)
|
||||||
(JoinSpecific , pat ) -> Just (Joined 1 pat (Text.words line))
|
(JoinAllDrop , _ ) -> Nothing
|
||||||
(JoinHeader1 , _ ) -> Just (JoinedHeader False Nothing 0 0)
|
(JoinSpecific, pat ) -> Just (Joined 1 pat (Text.words line))
|
||||||
(JoinHeader2 , _ ) -> Nothing
|
(JoinHeader1, _) ->
|
||||||
(JoinDrop , _ ) -> Nothing
|
Just (JoinedHeader (s_nowTime s) False Nothing 0 0)
|
||||||
(JoinErrorStart, _ ) -> Nothing
|
(JoinHeader2 , _) -> Nothing
|
||||||
(JoinErrorStop , _ ) -> Nothing
|
(JoinDrop , _) -> Nothing
|
||||||
|
(JoinErrorStart, _) -> Nothing
|
||||||
|
(JoinErrorStop , _) -> Nothing
|
||||||
case replaceMay of
|
case replaceMay of
|
||||||
Just replace -> do
|
Just replace -> do
|
||||||
when keep $ dispatchHeader oldKind countOut countErr oldLine
|
when keep
|
||||||
|
$ dispatchHeader startTime oldKind countOut countErr oldLine
|
||||||
put s { s_summary = SummaryNorm kind line replace }
|
put s { s_summary = SummaryNorm kind line replace }
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
let newLevel2 = case joiner of
|
let newLevel2 = case joiner of
|
||||||
|
@ -390,8 +394,16 @@ summarizeLines (kind, line, _linetime) = do
|
||||||
oldKind
|
oldKind
|
||||||
oldLine
|
oldLine
|
||||||
(case kind of
|
(case kind of
|
||||||
StdOut -> JoinedHeader keep newLevel2 (countOut + 1) countErr
|
StdOut -> JoinedHeader startTime
|
||||||
StdErr -> JoinedHeader keep newLevel2 countOut (countErr + 1)
|
keep
|
||||||
|
newLevel2
|
||||||
|
(countOut + 1)
|
||||||
|
countErr
|
||||||
|
StdErr -> JoinedHeader startTime
|
||||||
|
keep
|
||||||
|
newLevel2
|
||||||
|
countOut
|
||||||
|
(countErr + 1)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
(SummaryNorm oldKind _ (JoinedAll keep i), joiner) -> case joiner of
|
(SummaryNorm oldKind _ (JoinedAll keep i), joiner) -> case joiner of
|
||||||
|
@ -461,15 +473,21 @@ processLine newKind newLine = execStateT $ do
|
||||||
reverse $ take (c_lines conf) curLines <&> prettyLine conf
|
reverse $ take (c_lines conf) curLines <&> prettyLine conf
|
||||||
|
|
||||||
summary <- gets s_summary
|
summary <- gets s_summary
|
||||||
|
now <- gets s_nowTime
|
||||||
pure $ case summary of
|
pure $ case summary of
|
||||||
SummaryNone -> prettyLines
|
SummaryNone -> prettyLines
|
||||||
SummaryNorm StdOut line (JoinedNot _) ->
|
SummaryNorm StdOut line (JoinedNot _) ->
|
||||||
(fWhiteDis <> t "│ " <> fReset <> ellipse conf line) : prettyLines
|
(fWhiteDis <> t "│ " <> fReset <> ellipse conf line) : prettyLines
|
||||||
SummaryNorm StdOut line (JoinedHeader _ mLevel2 countOut countErr) ->
|
SummaryNorm StdOut line (JoinedHeader startTime _ mLevel2 countOut countErr)
|
||||||
(fWhiteDis <> t "│ " <> fReset <> ellipse
|
-> (fWhiteDis <> t "│ " <> fReset <> ellipse
|
||||||
conf
|
conf
|
||||||
(showHeader line mLevel2 countOut countErr)
|
(showHeader (diffTimes startTime now)
|
||||||
)
|
line
|
||||||
|
mLevel2
|
||||||
|
countOut
|
||||||
|
countErr
|
||||||
|
)
|
||||||
|
)
|
||||||
: prettyLines
|
: prettyLines
|
||||||
SummaryNorm StdOut line (JoinedAll _ 1) ->
|
SummaryNorm StdOut line (JoinedAll _ 1) ->
|
||||||
(fWhiteDis <> t "│ " <> fReset <> ellipse conf line) : prettyLines
|
(fWhiteDis <> t "│ " <> fReset <> ellipse conf line) : prettyLines
|
||||||
|
@ -501,11 +519,16 @@ processLine newKind newLine = execStateT $ do
|
||||||
(fWhiteDis <> t "│ " <> fReset <> ellipse conf line) : prettyLines
|
(fWhiteDis <> t "│ " <> fReset <> ellipse conf line) : prettyLines
|
||||||
SummaryNorm StdErr line (JoinedNot _) ->
|
SummaryNorm StdErr line (JoinedNot _) ->
|
||||||
(fRedDis <> t "│ " <> fReset <> ellipse conf line) : prettyLines
|
(fRedDis <> t "│ " <> fReset <> ellipse conf line) : prettyLines
|
||||||
SummaryNorm StdErr line (JoinedHeader _ mLevel2 countOut countErr) ->
|
SummaryNorm StdErr line (JoinedHeader startTime _ mLevel2 countOut countErr)
|
||||||
(fRedDis <> t "│ " <> fReset <> ellipse
|
-> (fRedDis <> t "│ " <> fReset <> ellipse
|
||||||
conf
|
conf
|
||||||
(showHeader line mLevel2 countOut countErr)
|
(showHeader (diffTimes startTime now)
|
||||||
)
|
line
|
||||||
|
mLevel2
|
||||||
|
countOut
|
||||||
|
countErr
|
||||||
|
)
|
||||||
|
)
|
||||||
: prettyLines
|
: prettyLines
|
||||||
SummaryNorm StdErr line (JoinedAll _ 1) ->
|
SummaryNorm StdErr line (JoinedAll _ 1) ->
|
||||||
(fRedDis <> t "│ " <> fReset <> ellipse conf line) : prettyLines
|
(fRedDis <> t "│ " <> fReset <> ellipse conf line) : prettyLines
|
||||||
|
|
Loading…
Reference in New Issue