Skip to content

Commit aeb0ab0

Browse files
committed
workbench | locli: document + report compiler version
1 parent db0f829 commit aeb0ab0

File tree

4 files changed

+54
-22
lines changed

4 files changed

+54
-22
lines changed

bench/locli/src/Cardano/Analysis/API/Context.hs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -197,34 +197,36 @@ manifestPackages =
197197

198198
data Metadata
199199
= Metadata
200-
{ tag :: Text
201-
, batch :: Text
202-
, ident :: Text
203-
, profile :: Text
204-
, era :: Text
205-
, manifest :: Manifest
206-
, profile_content :: AE.KeyMap Value
200+
{ tag :: Text
201+
, batch :: Text
202+
, ident :: Text
203+
, node_ghc_version :: Text
204+
, profile :: Text
205+
, era :: Text
206+
, manifest :: Manifest
207+
, profile_content :: AE.KeyMap Value
207208
}
208209
deriving (Generic, NFData, Show, ToJSON)
209210

210211
instance FromJSON Metadata where
211212
parseJSON =
212213
withObject "Metadata" $ \v -> do
213214

214-
tag <- v .: "tag"
215-
batch <- v .: "batch"
216-
manifest <- (v .: "manifest")
215+
tag <- v .: "tag"
216+
batch <- v .: "batch"
217+
manifest <- (v .: "manifest")
217218
<|> compatParseManifest v
218-
profile <- v .: "profile"
219-
profile_content <- v .: "profile_content"
220-
generator <- profile_content .: "generator"
219+
profile <- v .: "profile"
220+
profile_content <- v .: "profile_content"
221+
generator <- profile_content .: "generator"
221222

222-
ident <- (v .:? "ident")
223-
<&> fromMaybe (unVersion . ciVersion $
223+
ident <- (v .:? "ident")
224+
<&> fromMaybe (unVersion . ciVersion $
224225
getComponent "cardano-node" manifest)
225-
eraDirect <- v .:? "era"
226-
eraProfile <- profile_content .:? "era"
227-
eraGenerator <- generator .:? "era"
226+
node_ghc_version <- v .:? "node_ghc_version" .!= "unknown"
227+
eraDirect <- v .:? "era"
228+
eraProfile <- profile_content .:? "era"
229+
eraGenerator <- generator .:? "era"
228230
era <- case eraDirect <|> eraProfile <|> eraGenerator of
229231
Just x -> pure x
230232
Nothing -> fail "While parsing run metafile: missing era specification"

bench/locli/src/Cardano/Analysis/API/Metrics.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ sumFieldsReport =
4040
[ "date.systemStart", "time.systemStart", "sumAnalysisTime"
4141
, "ident"
4242
, "batch"
43+
, "ghc_version"
4344
] ++ (FieldName <$> manifestPackages) ++
4445
[ "era"
4546
, "delegators", "utxo"
@@ -79,6 +80,10 @@ instance (KnownCDF f) => TimelineFields (Summary f) where
7980
"Run batch"
8081
""
8182

83+
<> fScalar "ghc_version" Wno Id (IText $ node_ghc_version.sumMeta)
84+
"GHC version"
85+
"GHC version used to build cardano-node"
86+
8287
<> manifestFields
8388

8489
<> fScalar "era" Wno Era (IText $ era.sumMeta)

bench/locli/src/Cardano/Analysis/Summary.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ data SummaryError
3030
| SEIncoherentRunEras [Text]
3131
| SEIncoherentRunVersions [Manifest]
3232
| SEIncoherentRunFilters [([FilterName], [ChainFilter])]
33+
| SEIncoherentCompilerVersions [Text]
3334
| SECDFError CDFError
3435
deriving Show
3536

@@ -96,10 +97,11 @@ summariseMultiSummary sumAnalysisTime centiles xs@(headline:xss) = do
9697
summariseMetadata :: [Metadata] -> Either SummaryError Metadata
9798
summariseMetadata [] = Left SEEmptyDataset
9899
summariseMetadata xs@(headline:_) = do
99-
profile <- allEqOrElse (xs <&> profile) SEIncoherentRunProfileNames
100-
era <- allEqOrElse (xs <&> era) SEIncoherentRunEras
101-
manifest <- allEqOrElse (xs <&> manifest) SEIncoherentRunVersions
102-
profile_content <- allEqOrElse (xs <&> profile_content) SEIncoherentRunProfiles
100+
profile <- allEqOrElse (xs <&> profile) SEIncoherentRunProfileNames
101+
era <- allEqOrElse (xs <&> era) SEIncoherentRunEras
102+
manifest <- allEqOrElse (xs <&> manifest) SEIncoherentRunVersions
103+
profile_content <- allEqOrElse (xs <&> profile_content) SEIncoherentRunProfiles
104+
node_ghc_version <- allEqOrElse (xs <&> node_ghc_version) SEIncoherentCompilerVersions
103105
-- XXX: magic transformation that happens to match
104106
-- the logic in 'analyse.sh multi-call' on line with "local run="
105107
pure Metadata { tag = multiRunTag (Just "variance") xs

nix/workbench/run.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ EOF
470470
fail "Mode no longer supported: operation without profile/ directory."
471471
fi
472472

473+
local ghc_version=$(get_node_ghc_version)
474+
473475
progress "run | topology" \
474476
"$(white $(jq -r .composition.topology "$dir"/profile.json))"
475477
ln -s "$profile_data"/topology.json "$dir"
@@ -500,6 +502,7 @@ EOF
500502
--arg run "$run"
501503
--arg batch "$batch"
502504
--arg profile_name "$profile_name"
505+
--arg ghc_version "$ghc_version"
503506
--argjson timing "$timing"
504507
--slurpfile profile_content "$dir"/profile.json
505508
--argjson manifest "$manifest"
@@ -509,6 +512,7 @@ EOF
509512
{ tag: $run
510513
, batch: $batch
511514
, profile: $profile_name
515+
, node_ghc_version: $ghc_version
512516
, timing: $timing
513517
, manifest: $manifest
514518
, profile_overlay: $profile_content[0].overlay
@@ -1053,3 +1057,22 @@ run_ls_sets_cmd() {
10531057
cut -d/ -f2 |
10541058
sort -u || true'
10551059
}
1060+
1061+
get_node_ghc_version(){
1062+
local node_executable
1063+
1064+
if [[ $WB_BACKEND == nomad* ]]
1065+
then
1066+
node_executable=$(jq --raw-output '.containerPkgs."cardano-node"."nix-store-path"' $WB_BACKEND_DATA/container-specs.json)
1067+
node_executable="$node_executable/bin/cardano-node"
1068+
else
1069+
node_executable=cardano-node
1070+
fi
1071+
1072+
if [[ -x $node_executable ]]
1073+
then
1074+
$node_executable +RTS --info | grep 'GHC version' | grep -E -o "([0-9]{1,2}[\.]){2}[0-9]{1,2}"
1075+
else
1076+
echo "unknown"
1077+
fi
1078+
}

0 commit comments

Comments
 (0)