From 5fb9cd9ae9559cc2f9106433b9059eebb8dfc8a0 Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Tue, 2 Dec 2014 13:53:35 -0800 Subject: [PATCH] Update some profiling stuff. --- arvo/hoon.hoon | 72 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/arvo/hoon.hoon b/arvo/hoon.hoon index 48a5af29a8..e39fd0cfef 100644 --- a/arvo/hoon.hoon +++ b/arvo/hoon.hoon @@ -9469,13 +9469,20 @@ :::::: :::::: profiling support; move me :::::: :::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: ++ doss - $: sap=@ud :: sample count + $: mon=moan :: sample count hit=(map term ,@ud) :: hit points cut=(map path hump) :: cut points == +++ moan :: sample metric + $: fun=@ud :: samples in C + noc=@ud :: samples in nock + glu=@ud :: samples in glue + mal=@ud :: samples in alloc + far=@ud :: samples in frag + == :: :: ++ hump - $: sap=@ud :: sample count + $: mon=moan :: sample count inn=(map path ,@ud) :: calls into out=(map path ,@ud) :: calls out of == @@ -9487,10 +9494,10 @@ day(hit (~(put by hit.day) nam ?~(lam 1 +(u.lam)))) :: ++ pi-noon :: sample trace - |= [paz=(list path) day=doss] + |= [mot=term paz=(list path) day=doss] =| lax=(unit path) |- ^- doss - ?~ paz day(sap +(sap.day)) + ?~ paz day(mon (pi-mope mot mon.day)) %= $ paz t.paz lax `i.paz @@ -9498,8 +9505,8 @@ %+ ~(put by cut.day) i.paz ^- hump =+ nax=`(unit path)`?~(t.paz ~ `i.t.paz) - =+ hup=`hump`=+(hup=(~(get by cut.day) i.paz) ?^(hup u.hup [0 ~ ~])) - :+ +(sap.hup) + =+ hup=`hump`=+(hup=(~(get by cut.day) i.paz) ?^(hup u.hup [*moan ~ ~])) + :+ (pi-mope mot mon.hup) ?~ lax inn.hup =+ hag=(~(get by inn.hup) u.lax) (~(put by inn.hup) u.lax ?~(hag 1 +(u.hag))) @@ -9507,12 +9514,50 @@ =+ hag=(~(get by out.hup) u.nax) (~(put by out.hup) u.nax ?~(hag 1 +(u.hag))) == +++ pi-mope :: add sample + |= [mot=term mon=moan] + ?+ mot mon + %fun mon(fun +(fun.mon)) + %noc mon(noc +(noc.mon)) + %glu mon(glu +(glu.mon)) + %mal mon(mal +(mal.mon)) + %far mon(far +(far.mon)) + == +++ pi-moth :: count sample + |= mon=moan ^- @ud + :(add fun.mon noc.mon glu.mon mal.mon far.mon) +:: +++ pi-mumm :: print sample + |= mon=moan ^- tape + =+ tot=(pi-moth mon) + ;: welp + ^- tape + ?: =(0 noc.mon) ~ + (welp (scow %ud (div (mul 100 noc.mon) tot)) "n") + :: + ^- tape + ?: =(0 fun.mon) ~ + (welp (scow %ud (div (mul 100 fun.mon) tot)) "c") + :: + ^- tape + ?: =(0 glu.mon) ~ + (welp (scow %ud (div (mul 100 glu.mon) tot)) "g") + :: + ^- tape + ?: =(0 mal.mon) ~ + (welp (scow %ud (div (mul 100 mal.mon) tot)) "m") + :: + ^- tape + ?: =(0 far.mon) ~ + (welp (scow %ud (div (mul 100 far.mon) tot)) "f") + == :: ++ pi-tell :: produce dump |= day=doss ^- (list tape) + =+ tot=(pi-moth mon.day) ;: welp - [(welp "events: " (scow %ud sap.day)) ~] + [(welp "events: " (pi-mumm mon.day)) ~] :: %+ turn (~(tap by hit.day) ~) @@ -9525,21 +9570,24 @@ %+ turn %+ sort (~(tap by cut.day)) |= [one=(pair path hump) two=(pair path hump)] - (gth sap.q.one sap.q.two) + (gth (pi-moth mon.q.one) (pi-moth mon.q.two)) |= [pax=path hup=hump] + =+ ott=(pi-moth mon.day) ;: welp [(welp "label: " (spud pax)) ~] - [(welp "weight: " (scow %ud (div (mul 1.000 sap.hup) sap.day))) ~] - ["from:" ~] + [(welp "price: " (scow %ud (div (mul 100 ott) tot))) ~] + [(welp "shape: " (pi-mumm mon.day)) ~] :: + ?: =(~ inn.hup) ~ + :- "from:" %+ turn (~(tap by inn.hup) ~) |= [pax=path num=@ud] ^- tape :(welp " " (spud pax) ": " (scow %ud num)) :: - ["into:" ~] - :: + ?: =(~ out.hup) ~ + :- "into:" %+ turn (~(tap by out.hup) ~) |= [pax=path num=@ud]