Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,037 changes: 1,289 additions & 748 deletions bench/cardano-profile/data/all-profiles-coay.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@
"tracer": {
"rtview": false,
"ekg": false,
"withresources": false
"withresources": false,
"timeseries": false
},
"cluster": null,
"extra_desc": "without cardano-tracer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@
"tracer": {
"rtview": false,
"ekg": false,
"withresources": false
"withresources": false,
"timeseries": false
},
"extra_desc": "without cardano-tracer",
"suffix": "notrc",
Expand Down
14 changes: 7 additions & 7 deletions bench/cardano-profile/data/test/ci-test-bage.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"filters": [],
"finish_patience": 21,
"last_log_spread_s": 120,
"minimum_chain_density": 2.5e-2,
"minimum_chain_density": 0.025,
"silence_since_last_block_s": 120,
"start_log_spread_s": 120,
"tx_loss_ratio": 2.0e-2,
"tx_loss_ratio": 0.020,
"type": "standard"
},
"cli_args": {
Expand Down Expand Up @@ -119,7 +119,7 @@
"tx_fee": 1000000
},
"genesis": {
"active_slots_coeff": 5.0e-2,
"active_slots_coeff": 0.050,
"alonzo": {
"collateralPercentage": 150,
"costModels": {
Expand Down Expand Up @@ -329,7 +329,7 @@
"pparamsEpoch": 300,
"pparamsOverlays": [],
"shelley": {
"activeSlotsCoeff": 5.0e-2,
"activeSlotsCoeff": 0.050,
"epochLength": 600,
"protocolParams": {
"a0": 0.3,
Expand All @@ -352,7 +352,7 @@
"major": 6,
"minor": 0
},
"rho": 3.0e-3,
"rho": 0.0030,
"tau": 0.2
},
"securityParam": 3,
Expand Down Expand Up @@ -383,8 +383,8 @@
"tracer": {
"ekg": false,
"rtview": false,
"withresources": false
"withresources": false,
"timeseries": false
},
"workloads": []
}

3 changes: 2 additions & 1 deletion bench/cardano-profile/data/test/ci-test-coay/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@
"tracer": {
"rtview": false,
"ekg": false,
"withresources": false
"withresources": false,
"timeseries": false
},
"cluster": null,
"desc": "Miniature dataset, CI-friendly duration, test scale",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,15 @@
"tracer": {
"rtview": false,
"ekg": false,
"withresources": false
"withresources": false,
"timeseries": false
},
"cluster": null,
"desc": "Miniature dataset, CI-friendly duration, test scale",
"name": "ci-test-dense10-coay",
"overlay": {},
"derived": {
"supply_delegated": 1e+16,
"supply_delegated": 1E+16,
"supply_total": 10010000000000000,
"utxo_delegated": 0,
"utxo_generated": 18000,
Expand Down
3 changes: 2 additions & 1 deletion bench/cardano-profile/data/test/default-coay/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@
"tracer": {
"rtview": false,
"ekg": false,
"withresources": false
"withresources": false,
"timeseries": false
},
"cluster": null,
"name": "default-coay",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@
"tracer": {
"rtview": false,
"ekg": false,
"withresources": false
"withresources": false,
"timeseries": false
},
"cluster": {
"nomad": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ profilesNoEraMiniature =
ciBench02PlutusV3 = ciBench02 & V.genesisVariantVoltaire
ciBench10Value = ciBench10 & V.genesisVariant300
ciBench10Plutus = ciBench10 & V.genesisVariant300
-- No-shutdown variant for interactive/timeseries use.
ciTimeseries02Value =
P.empty & base
. P.desc "Miniature dataset, no shutdown, bench scale"
. P.uniCircle . P.loopback
. V.timescaleCompressed . P.generatorEpochs 100000
& V.hosts 2 & V.genesisVariant300
loop = V.plutusSaturation . V.plutusTypeLoop . P.analysisSizeSmall
loop2024 = V.plutusSaturation . V.plutusTypeLoop2024 . P.analysisSizeSmall
ecdsa = V.plutusDoublePlusSaturation . V.plutusTypeECDSA . P.analysisSizeModerate
Expand All @@ -85,6 +92,7 @@ profilesNoEraMiniature =
, ciBench02Value & P.name "ci-bench-lmdb" . V.valueLocal . P.dreps 0 . P.traceForwardingOn . P.newTracing . P.lmdb . P.ssdDirectory "/tmp"
, ciBench02Value & P.name "ci-bench-lsmt" . V.valueLocal . P.dreps 0 . P.traceForwardingOn . P.newTracing . P.lsmt . P.ssdDirectory "/tmp"
, ciBench02Value & P.name "ci-bench-rtview" . V.valueLocal . P.dreps 0 . P.traceForwardingOn . P.newTracing . P.tracerRtview
, ciTimeseries02Value & P.name "ci-bench-timeseries" . V.valueLocal . P.dreps 0 . P.traceForwardingOn . P.newTracing . P.tracerTimeseries
, ciBench02Value & P.name "ci-bench-notracer" . V.valueLocal . P.dreps 0 . P.traceForwardingOff . P.newTracing
, ciBench02Value & P.name "ci-bench-drep" . V.valueLocal . P.dreps 10 . P.traceForwardingOn . P.newTracing
, ciBench02Plutus & P.name "ci-bench-plutus" . loop . P.dreps 0 . P.traceForwardingOn . P.newTracing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module Cardano.Benchmarking.Profile.Primitives (
, workloadAppend

-- Tracer's params.
, tracerRtview, tracerWithresources
, tracerRtview, tracerWithresources, tracerTimeseries

-- Cluster params.
, clusterMinimunStorage, ssdDirectory, clusterKeepRunningOn
Expand Down Expand Up @@ -203,6 +203,7 @@ empty = Types.Profile {
Types.rtview = False
, Types.ekg = False
, Types.withresources = False
, Types.timeseries = False
}
, Types.cluster = Nothing
, Types.analysis = Types.Analysis {
Expand Down Expand Up @@ -804,6 +805,9 @@ tracerRtview = tracer (\t -> t {Types.rtview = True})
tracerWithresources :: Types.Profile -> Types.Profile
tracerWithresources = tracer (\t -> t {Types.withresources = True})

tracerTimeseries :: Types.Profile -> Types.Profile
tracerTimeseries = tracer (\t -> t {Types.timeseries = True})

-- Cluster.
--------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ data Tracer = Tracer
{ rtview :: Bool
, ekg :: Bool
, withresources :: Bool
, timeseries :: Bool
}
deriving (Eq, Show, Generic)

Expand Down
1 change: 1 addition & 0 deletions bench/cardano-profile/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ ciTestBage = Types.Profile {
Types.rtview = False
, Types.ekg = False
, Types.withresources = False
, Types.timeseries = False
}
, Types.cluster = Nothing
, Types.analysis = Types.Analysis {
Expand Down
1 change: 1 addition & 0 deletions bench/cardano-timeseries-io/cardano-timeseries-io.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ library
, Cardano.Timeseries.Interp.Expr
, Cardano.Timeseries.Interp.Types
, Cardano.Timeseries.Interp.Value
, Cardano.Timeseries.JSON

, Cardano.Timeseries.Store
, Cardano.Timeseries.Store.Flat
Expand Down
1 change: 1 addition & 0 deletions bench/cardano-timeseries-io/docs/elab.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ let x = t in t
t t
fst t
snd t
()
(t, t)
t == t (~)
t != t (~)
Expand Down
7 changes: 7 additions & 0 deletions bench/cardano-timeseries-io/docs/typing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ A, B, C, T ::= InstantVector T | RangeVector T | Scalar | Bool | Timestamp | Dur

// Terms
t, f, e, a, b ::= x
| ()
| (t, t)
| \x -> t
| let x = t in t
Expand Down Expand Up @@ -104,6 +105,9 @@ A type
RangeVector A type


Unit type


Scalar type


Expand Down Expand Up @@ -184,6 +188,9 @@ x ∈ metric-store
Γ ⊦ snd t : B


Γ ⊦ () : Unit ✔


Γ ⊦ a : A
Γ ⊦ b : B
------------------- ✔
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ readConfig handle = readTVarIO handle.config
writeConfig :: TimeseriesHandle -> Maybe TimeseriesConfig -> IO ()
writeConfig handle k = modifyConfig handle (const k)

-- | Insert a batch on metric data into the store at the given timestamp.
-- | Insert a batch of metric data into the store at the given timestamp.
insert :: TimeseriesHandle -> Text -> Text -> Timestamp -> [(MetricIdentifier, Double)] -> IO ()
insert TimeseriesHandle{..} originKey originValue t batch = do
atomically $ modifyTVar' store $ \st -> foldl' f st batch
Expand Down
4 changes: 4 additions & 0 deletions bench/cardano-timeseries-io/src/Cardano/Timeseries/Elab.hs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,10 @@ solveGeneralElabProblem _ (Surface.Number l f) x typ = do
let u = UnificationProblem l typ Scalar
modify (updateDefs $ instantiateExpr x (Semantic.Number f))
pure ([u], [])
solveGeneralElabProblem _ (Surface.MkUnit l) x typ = do
let u = UnificationProblem l typ Ty.Unit
modify (updateDefs $ instantiateExpr x Semantic.Unit)
pure ([u], [])
solveGeneralElabProblem _ (Surface.Truth l) x typ = do
let u = UnificationProblem l typ Bool
modify (updateDefs $ instantiateExpr x Semantic.True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ data Expr =
| Fst Loc Expr
| Snd Loc Expr
| MkPair Loc Expr Expr
| MkUnit Loc
| Eq Loc Expr Expr
| NotEq Loc Expr Expr
| Lt Loc Expr Expr
Expand Down Expand Up @@ -177,6 +178,7 @@ getLoc (Let l _ _ _) = l
getLoc (Lambda l _ _) = l
getLoc (Fst l _) = l
getLoc (Snd l _) = l
getLoc (MkUnit l) = l
getLoc (MkPair l _ _) = l
getLoc (Eq l _ _) = l
getLoc (NotEq l _ _) = l
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,29 +96,23 @@ true = Truth <$> getSourcePos <* string "true"
false :: Parser Expr
false = Falsity <$> getSourcePos <* string "false"

continueTight :: Expr -> Parser Expr
continueTight a = a <$ string ")"

continuePair :: Loc -> Expr -> Parser Expr
continuePair l a = do
void $ string ","
space
b <- exprUniverse
space
void $ string ")"
pure (MkPair l a b)

tightOrPair :: Parser Expr
tightOrPair = do
tuple :: Parser Expr
tuple = do
l <- getSourcePos
void $ string "("
space
a <- exprUniverse
inner <- sepBy exprUniverse (try $ space *> string "," *> space)
space
try (continuePair l a) <|> continueTight a
void $ string ")"
pure $ mk l inner
where
mk p [] = MkUnit p
mk _ [x] = x
mk p [x, y] = MkPair p x y
mk p (x : y : z : ws) = MkPair p x (mk p (y : z : ws))

exprAtom :: Parser Expr
exprAtom = tightOrPair
exprAtom = tuple
<|> epoch
<|> true
<|> false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ resolveTy defs (InstantVector typ) = InstantVector (resolveTy defs typ)
resolveTy defs (RangeVector typ) = RangeVector (resolveTy defs typ)
resolveTy defs (Fun typ typ') = Fun (resolveTy defs typ) (resolveTy defs typ')
resolveTy defs (Pair typ typ') = Pair (resolveTy defs typ) (resolveTy defs typ')
resolveTy _ Ty.Unit = Ty.Unit
resolveTy _ Scalar = Scalar
resolveTy _ Timestamp = Timestamp
resolveTy _ Duration = Duration
Expand Down Expand Up @@ -63,6 +64,7 @@ resolveExpr' defs (LtInstantVectorScalar a b) = LtInstantVectorScalar (resolveEx
resolveExpr' defs (LteInstantVectorScalar a b) = LteInstantVectorScalar (resolveExpr' defs a) (resolveExpr' defs b)
resolveExpr' defs (GtInstantVectorScalar a b) = GtInstantVectorScalar (resolveExpr' defs a) (resolveExpr' defs b)
resolveExpr' defs (GteInstantVectorScalar a b) = GteInstantVectorScalar (resolveExpr' defs a) (resolveExpr' defs b)
resolveExpr' _ Expr.Unit = Expr.Unit
resolveExpr' _ Expr.True = Expr.True
resolveExpr' _ Expr.False = Expr.False
resolveExpr' defs (Not t) = Not (resolveExpr' defs t)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ data Ty = InstantVector Ty
| Text
| Bool
| Pair Ty Ty
| Unit
| Timestamp
| Duration
| Fun Ty Ty
Expand All @@ -51,6 +52,7 @@ prettyTy prec (RangeVector typ) = conditionalParens (prec == Tight) $
"RangeVector " <> prettyTy Tight typ
prettyTy _prec (Pair typ typ') =
"(" <> prettyTy Loose typ <> ", " <> prettyTy Loose typ' <> ")"
prettyTy _prec Unit = "()"
prettyTy prec (Fun typ typ') = conditionalParens (prec > FunCodomain) $
prettyTy FunDomain typ <> " -> " <> prettyTy FunCodomain typ'
prettyTy _ Scalar = "Scalar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ unifyNu _ Text Text = pure []
unifyNu _ Timestamp Timestamp = pure []
unifyNu _ Duration Duration = pure []
unifyNu loc (Pair a b) (Pair a' b') = pure [UnificationProblem loc a a', UnificationProblem loc b b']
unifyNu _ Unit Unit = pure []
unifyNu _ (Hole x) (Hole y) | x == y = pure []
unifyNu _ (Hole x) ty = [] <$ unifyHole x ty
unifyNu _ ty (Hole y) = [] <$ unifyHole y ty
Expand All @@ -73,6 +74,7 @@ occursNu x (InstantVector ty) = occursNu x ty
occursNu x (RangeVector ty) = occursNu x ty
occursNu x (Fun ty ty') = (||) <$> occursNu x ty <*> occursNu x ty'
occursNu x (Pair ty ty') = (||) <$> occursNu x ty <*> occursNu x ty'
occursNu _ Unit = pure False
occursNu _ Scalar = pure False
occursNu _ Bool = pure False
occursNu _ Timestamp = pure False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import Data.Word (Word64)
import Statistics.Function (minMax)
import Statistics.Quantile (cadpw, quantile)
import Statistics.Sample (mean)
import qualified Data.Text as Text


interpJoin :: (a -> b -> c) -> InstantVector a -> InstantVector b -> Either InterpError (InstantVector c)
Expand Down Expand Up @@ -171,11 +170,14 @@ interpFilterBinaryRelation cfg store env v rel k now = do
)
now

mkTuple :: [Value] -> Value
mkTuple = foldr Value.Pair Value.Unit

-- | Given a metric store, an assignment of values to local variables, a query expression and a timestamp "now",
-- interpret the `Expr` into a `Value`.
interp :: Store s Double => Config -> s -> Map Identifier Value -> Expr -> Timestamp -> InterpM Value
interp _ store _ Expr.Metrics _ = do
pure $ Value.Text $ Text.intercalate ", " (Set.toList $ metrics store)
pure $ mkTuple $ map Value.Text $ Set.toList $ metrics store
interp _ _ _ (Expr.Number x) _ = do
pure (Value.Scalar x)
interp _ store env (Expr.Variable x) _ =
Expand Down Expand Up @@ -293,6 +295,8 @@ interp cfg store env (MkPair a b) now = do
va <- interp cfg store env a now
vb <- interp cfg store env b now
pure $ Value.Pair va vb
interp _ _ _ Expr.Unit _ = do
pure Value.Unit
interp cfg store env (Fst t) now = do
(a, _) <- interp cfg store env t now >>= expectPair
pure a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ data Expr = Number Double

| True
| False
| Unit
| And Expr Expr
| Or Expr Expr
| Not Expr
Expand Down
Loading
Loading