Skip to content

Commit def3190

Browse files
authored
Remove "log-timing" and "log-fallbacks" RPC log options (#4015)
This options are unused and all ther use cases are subsumed by the `-l Timing` and `-l Aborts` non-RPC log option.
1 parent 4bbd34b commit def3190

20 files changed

+51
-1559
lines changed

booster/library/Booster/JsonRpc.hs

+7-30
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import Data.Text.Encoding qualified as Text
3939
import GHC.Records
4040
import Numeric.Natural
4141
import Prettyprinter (comma, hsep, punctuate, (<+>))
42-
import System.Clock (Clock (Monotonic), diffTimeSpec, getTime, toNanoSecs)
4342

4443
import Booster.CLOptions (RewriteOptions (..))
4544
import Booster.Definition.Attributes.Base (UniqueId, getUniqueId, uniqueId)
@@ -111,7 +110,6 @@ respond stateVar request =
111110
| isJust req.movingAverageStepTimeout ->
112111
pure $ Left $ RpcError.unsupportedOption ("moving-average-step-timeout" :: String)
113112
RpcTypes.Execute req -> withModule req._module $ \(def, mLlvmLibrary, mSMTOptions, rewriteOpts) -> Booster.Log.withContext CtxExecute $ do
114-
start <- liftIO $ getTime Monotonic
115113
-- internalise given constrained term
116114
let internalised = runExcept $ internalisePattern DisallowAlias CheckSubsorts Nothing def req.state.term
117115

@@ -137,7 +135,6 @@ respond stateVar request =
137135
(fromMaybe False)
138136
[ req.logSuccessfulRewrites
139137
, req.logFailedRewrites
140-
, req.logFallbacks
141138
]
142139
-- apply the given substitution before doing anything else
143140
let substPat =
@@ -174,14 +171,7 @@ respond stateVar request =
174171
result <-
175172
performRewrite rewriteConfig substPat
176173
SMT.finaliseSolver solver
177-
stop <- liftIO $ getTime Monotonic
178-
let duration =
179-
if fromMaybe False req.logTiming
180-
then
181-
Just $
182-
fromIntegral (toNanoSecs (diffTimeSpec stop start)) / 1e9
183-
else Nothing
184-
pure $ execResponse duration req result substitution unsupported
174+
pure $ execResponse req result substitution unsupported
185175
RpcTypes.AddModule RpcTypes.AddModuleRequest{_module, nameAsId = nameAsId'} -> Booster.Log.withContext CtxAddModule $ runExceptT $ do
186176
-- block other request executions while modifying the server state
187177
state <- liftIO $ takeMVar stateVar
@@ -244,14 +234,8 @@ respond stateVar request =
244234
"Added a new module. Now in scope: " <> Text.intercalate ", " (Map.keys newDefinitions)
245235
pure $ RpcTypes.AddModule $ RpcTypes.AddModuleResult moduleHash
246236
RpcTypes.Simplify req -> withModule req._module $ \(def, mLlvmLibrary, mSMTOptions, _) -> Booster.Log.withContext CtxSimplify $ do
247-
start <- liftIO $ getTime Monotonic
248237
let internalised =
249238
runExcept $ internaliseTermOrPredicate DisallowAlias CheckSubsorts Nothing def req.state.term
250-
let mkTraces duration
251-
| Just True <- req.logTiming =
252-
Just [ProcessingTime (Just Booster) duration]
253-
| otherwise =
254-
Nothing
255239

256240
solver <- maybe (SMT.noSolver) (SMT.initSolver def) mSMTOptions
257241

@@ -325,13 +309,10 @@ respond stateVar request =
325309
(Left something, _) ->
326310
pure . Left . RpcError.backendError $ RpcError.Aborted $ renderText $ pretty' @mods something
327311
SMT.finaliseSolver solver
328-
stop <- liftIO $ getTime Monotonic
329312

330-
let duration =
331-
fromIntegral (toNanoSecs (diffTimeSpec stop start)) / 1e9
332-
mkSimplifyResponse state =
313+
let mkSimplifyResponse state =
333314
RpcTypes.Simplify
334-
RpcTypes.SimplifyResult{state, logs = mkTraces duration}
315+
RpcTypes.SimplifyResult{state, logs = Nothing}
335316
pure $ second mkSimplifyResponse result
336317
RpcTypes.GetModel req -> withModule req._module $ \case
337318
(_, _, Nothing, _) -> do
@@ -615,13 +596,12 @@ execStateToKoreJson RpcTypes.ExecuteState{term = t, substitution, predicate} =
615596
}
616597

617598
execResponse ::
618-
Maybe Double ->
619599
RpcTypes.ExecuteRequest ->
620600
(Natural, Seq (RewriteTrace ()), RewriteResult Pattern) ->
621601
Map Variable Term ->
622602
[Syntax.KorePattern] ->
623603
Either ErrorObj (RpcTypes.API 'RpcTypes.Res)
624-
execResponse mbDuration req (d, traces, rr) originalSubstitution unsupported = case rr of
604+
execResponse req (d, traces, rr) originalSubstitution unsupported = case rr of
625605
RewriteBranch p nexts ->
626606
Right $
627607
RpcTypes.Execute
@@ -727,12 +707,9 @@ execResponse mbDuration req (d, traces, rr) originalSubstitution unsupported = c
727707
(logSuccessfulRewrites, logFailedRewrites)
728708
)
729709
traces
730-
timingLog =
731-
fmap (ProcessingTime $ Just Booster) mbDuration
732-
in case (timingLog, traceLogs) of
733-
(Nothing, []) -> Nothing
734-
(Nothing, xs@(_ : _)) -> Just xs
735-
(Just t, xs) -> Just (t : xs)
710+
in case traceLogs of
711+
[] -> Nothing
712+
xs@(_ : _) -> Just xs
736713

737714
toExecState ::
738715
Pattern -> Map Variable Term -> [Syntax.KorePattern] -> Maybe UniqueId -> RpcTypes.ExecuteState

booster/test/rpc-integration/test-diamond/params-mutual-constraints-terminal-log-fallbacks-and-failed-and-successful-rewrites.json

-9
This file was deleted.

booster/test/rpc-integration/test-diamond/params-mutual-constraints-terminal-log-fallbacks-and-failed-rewrites.json

-8
This file was deleted.

booster/test/rpc-integration/test-diamond/params-mutual-constraints-terminal-log-fallbacks.json

-7
This file was deleted.

0 commit comments

Comments
 (0)