Add simple profiling state.

This commit is contained in:
C. Guy Yarvin 2014-09-26 13:23:27 -07:00
parent 55e40f40e8
commit cffc2a545c

View File

@ -9542,6 +9542,86 @@
|= txt=@ta
^- twig
(rash txt wide:vast)
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: profiling support; move me ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
++ doss
$: sap=@ud :: sample count
hit=(map term ,@ud) :: hit points
cut=(map span hump) :: cut points
==
::
++ hump
$: sap=@ud :: sample count
inn=(map span ,@ud) :: calls into
out=(map span ,@ud) :: calls out of
==
::
++ pi-heck
|= [nam=@tas day=doss]
^- doss
=+ lam=(~(get by hit.day) nam)
day(hit (~(put by hit.day) nam ?~(lam 1 +(u.lam))))
::
++ pi-noon :: sample trace
|= [pax=path day=doss]
=| lax=(unit span)
|- ^- doss
?~ pax day(sap +(sap.day))
%= $
pax t.pax
lax `i.pax
cut.day
%+ ~(put by cut.day) i.pax
^- hump
=+ nax=`(unit span)`?~(t.pax ~ `i.t.pax)
=+ hup=`hump`=+(hup=(~(get by cut.day) i.pax) ?^(hup u.hup [0 ~ ~]))
:+ +(sap.hup)
?~ lax inn.hup
=+ hag=(~(get by inn.hup) u.lax)
(~(put by inn.hup) u.lax ?~(hag 1 +(u.hag)))
?~ nax out.hup
=+ hag=(~(get by out.hup) u.nax)
(~(put by out.hup) u.nax ?~(hag 1 +(u.hag)))
==
::
++ pi-tell :: produce dump
|= day=doss
^- (list tape)
;: welp
[(welp "events: " (scow %ud sap.day)) ~]
::
%+ turn
(~(tap by hit.day) ~)
|= [nam=term num=@ud]
:(welp (trip nam) ": " (scow %ud num))
["" ~]
::
%- zing
^- (list (list tape))
%+ turn
(~(tap by cut.day) ~)
|= [nam=term hup=hump]
;: welp
[(welp "sector: " (trip nam)) ~]
[(welp "weight: " (scow %ud (div (mul 1.000 sap.hup) sap.day))) ~]
["inn:" ~]
::
%+ turn
(~(tap by inn.hup) ~)
|= [nam=term num=@ud]
^- tape
:(welp " " (trip nam) ": " (scow %ud num))
::
["out:" ~]
::
%+ turn
(~(tap by out.hup) ~)
|= [nam=term num=@ud]
^- tape
:(welp " " (trip nam) ": " (scow %ud num))
==
==
--
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: volume 3, Arvo models and skeleton ::::::