Add log of events to view.
This commit is contained in:
parent
2f180bbf98
commit
8d00731248
@ -133,13 +133,41 @@ viewAccessView m av =
|
|||||||
currentCache = Maybe.withDefault [] m.hierarchy
|
currentCache = Maybe.withDefault [] m.hierarchy
|
||||||
in
|
in
|
||||||
div [ class "access-view" ]
|
div [ class "access-view" ]
|
||||||
[ viewCacheHierarchy <| effectiveCacheHierarchy currentCache av
|
[ h2 [] [ text "Access Simulation" ]
|
||||||
, buttonWrapper
|
, buttonWrapper
|
||||||
[ button "Forward" AccessViewForward
|
[ button "Forward" AccessViewForward
|
||||||
, button "Back" AccessViewBack
|
, button "Back" AccessViewBack
|
||||||
]
|
]
|
||||||
|
, viewAccessLog av
|
||||||
|
, viewCacheHierarchy <| effectiveCacheHierarchy currentCache av
|
||||||
]
|
]
|
||||||
|
|
||||||
|
viewAccessLog : AccessView -> Html Msg
|
||||||
|
viewAccessLog (aes, ap) =
|
||||||
|
let
|
||||||
|
resultSpan r =
|
||||||
|
case r of
|
||||||
|
Hit -> span [ class "success" ] [ text "HIT" ]
|
||||||
|
Miss -> span [ class "failure" ] [ text "MISS" ]
|
||||||
|
downEvent n ae = div [ class "event" ]
|
||||||
|
[ text <| "L" ++ String.fromInt (n + 1)
|
||||||
|
, resultSpan ae.result
|
||||||
|
]
|
||||||
|
upEvent n ae = div [ class "event" ]
|
||||||
|
[ text <| "Updated L" ++ String.fromInt (n + 1)
|
||||||
|
]
|
||||||
|
events =
|
||||||
|
case ap of
|
||||||
|
Done -> []
|
||||||
|
Down n -> List.indexedMap downEvent <| List.take (n + 1) aes
|
||||||
|
Up n -> List.indexedMap downEvent aes ++
|
||||||
|
(List.indexedMap upEvent <| List.drop n aes)
|
||||||
|
in
|
||||||
|
div [ class "access-log" ]
|
||||||
|
[ h3 [] [ text "Simulation events" ]
|
||||||
|
, div [ class "access-log-events" ] events
|
||||||
|
]
|
||||||
|
|
||||||
viewAccessInput : Model -> Html Msg
|
viewAccessInput : Model -> Html Msg
|
||||||
viewAccessInput m =
|
viewAccessInput m =
|
||||||
let
|
let
|
||||||
|
Loading…
Reference in New Issue
Block a user