Add views for cache data.

This commit is contained in:
Danila Fedorin 2019-05-28 21:07:41 -07:00
parent 25d6ecc769
commit eebf82d40a

View File

@ -91,13 +91,24 @@ viewCache level (cm, cs) =
List.indexedMap (\i _ -> td [ colspan cm.setSize ] [ text <| String.fromInt i ]) List.indexedMap (\i _ -> td [ colspan cm.setSize ] [ text <| String.fromInt i ])
<| List.repeat cm.setCount () <| List.repeat cm.setCount ()
setLabel = [ td [ colspan <| cm.setSize * cm.setCount ] [ text "Set" ] ] setLabel = [ td [ colspan <| cm.setSize * cm.setCount ] [ text "Set" ] ]
setRow set =
let
slotHtml s =
case s of
Empty -> td [] [ text "" ]
Used l a -> td [] [ text <| String.fromInt a ]
in
List.map slotHtml set
cacheRow = List.concat <| List.map setRow cs
cacheTable = cacheTable =
table [] table []
[ tr [ classList [("hidden", cm.setCount == 1)] ] setLabel [ tr [ classList [("hidden", cm.setCount == 1)] ] setLabel
, tr [ classList [("hidden", cm.setCount == 1)] ] setLabels , tr [ classList [("hidden", cm.setCount == 1)] ] setLabels
, tr [ classList [("hidden", cm.setSize == 1)] ] allSlotsLabel , tr [ classList [("hidden", cm.setSize == 1)] ] allSlotsLabel
, tr [ classList [("hidden", cm.setSize == 1)] ] allSlotLabels , tr [ classList [("hidden", cm.setSize == 1)] ] allSlotLabels
, tr [] cacheRow
] ]
in in
div [ class "cache" ] div [ class "cache" ]
[ h3 [] [ text <| "L" ++ String.fromInt level ++ " Cache" ] [ h3 [] [ text <| "L" ++ String.fromInt level ++ " Cache" ]