Add views for cache data.

This commit is contained in:
Danila Fedorin 2019-05-28 21:07:41 -07:00
parent 25d6ecc769
commit eebf82d40a
1 changed files with 11 additions and 0 deletions

View File

@ -91,13 +91,24 @@ viewCache level (cm, cs) =
List.indexedMap (\i _ -> td [ colspan cm.setSize ] [ text <| String.fromInt i ])
<| List.repeat cm.setCount ()
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 =
table []
[ tr [ classList [("hidden", cm.setCount == 1)] ] setLabel
, tr [ classList [("hidden", cm.setCount == 1)] ] setLabels
, tr [ classList [("hidden", cm.setSize == 1)] ] allSlotsLabel
, tr [ classList [("hidden", cm.setSize == 1)] ] allSlotLabels
, tr [] cacheRow
]
in
div [ class "cache" ]
[ h3 [] [ text <| "L" ++ String.fromInt level ++ " Cache" ]