on 4fdc19d help sign in
194 lines 3.6 kB history raw
1+++
2title = "5f: Profiling support"
3weight = 48
4template = "doc.html"
5+++
7## `++pi-heck`
9Profiling utility
11#### Source
13```hoon
14++ pi-heck
15 |= [nam=@tas day=doss]
16 ^- doss
17 =+ lam=(~(get by hit.day) nam)
18 day(hit (~(put by hit.day) nam ?~(lam 1 +(u.lam))))
19```
21---
23## `++pi-noon`
25Sample trace
27#### Source
29```hoon
30++ pi-noon
31 |= [mot=term paz=(list path) day=doss]
32 =| lax=(unit path)
33 |- ^- doss
34 ?~ paz day(mon (pi-mope mot mon.day))
35 %= $
36 paz t.paz
37 lax `i.paz
38 cut.day
39 %+ ~(put by cut.day) i.paz
40 ^- hump
41 =+ nax=`(unit path)`?~(t.paz ~ `i.t.paz)
42 =+ hup=`hump`=+(hup=(~(get by cut.day) i.paz) ?^(hup u.hup [*moan ~ ~]))
43 :+ (pi-mope mot mon.hup)
44 ?~ lax out.hup
45 =+ hag=(~(get by out.hup) u.lax)
46 (~(put by out.hup) u.lax ?~(hag 1 +(u.hag)))
47 ?~ nax inn.hup
48 =+ hag=(~(get by inn.hup) u.nax)
49 (~(put by inn.hup) u.nax ?~(hag 1 +(u.hag)))
50 ==
51```
53---
55## `++pi-mope`
57Add sample
59#### Source
61```hoon
62++ pi-mope
63 |= [mot=term mon=moan]
64 ?+ mot mon
65 %fun mon(fun +(fun.mon))
66 %noc mon(noc +(noc.mon))
67 %glu mon(glu +(glu.mon))
68 %mal mon(mal +(mal.mon))
69 %far mon(far +(far.mon))
70 %coy mon(coy +(coy.mon))
71 %euq mon(euq +(euq.mon))
72 ==
73```
75---
77## `++pi-moth`
79Count sample
81#### Source
83```hoon
84++ pi-moth
85 |= mon=moan ^- @ud
86 :(add fun.mon noc.mon glu.mon mal.mon far.mon coy.mon euq.mon)
87```
89---
91## `++pi-mumm`
93Print sample
95#### Source
97```hoon
98++ pi-mumm
99 |= mon=moan ^- tape
100 =+ tot=(pi-moth mon)
101 ;: welp
102 ^- tape
103 ?: =(0 noc.mon) ~
104 (welp (scow %ud (div (mul 100 noc.mon) tot)) "n ")
105 ::
106 ^- tape
107 ?: =(0 fun.mon) ~
108 (welp (scow %ud (div (mul 100 fun.mon) tot)) "c ")
109 ::
110 ^- tape
111 ?: =(0 glu.mon) ~
112 (welp (scow %ud (div (mul 100 glu.mon) tot)) "g ")
113 ::
114 ^- tape
115 ?: =(0 mal.mon) ~
116 (welp (scow %ud (div (mul 100 mal.mon) tot)) "m ")
117 ::
118 ^- tape
119 ?: =(0 far.mon) ~
120 (welp (scow %ud (div (mul 100 far.mon) tot)) "f ")
121 ::
122 ^- tape
123 ?: =(0 coy.mon) ~
124 (welp (scow %ud (div (mul 100 coy.mon) tot)) "y ")
125 ::
126 ^- tape
127 ?: =(0 euq.mon) ~
128 (welp (scow %ud (div (mul 100 euq.mon) tot)) "e ")
129 ==
130```
132---
134## `++pi-tell`
136Produce dump
138#### Source
140```hoon
141++ pi-tell
142 |= day=doss
143 ^- (list tape)
144 ?: =(day *doss) ~
145 =+ tot=(pi-moth mon.day)
146 ;: welp
147 [(welp "events: " (pi-mumm mon.day)) ~]
148 ::
149 %+ turn
150 %+ sort ~(tap by hit.day)
151 |= [a=[* @] b=[* @]]
152 (lth +.a +.b)
153 |= [nam=term num=@ud]
154 :(welp (trip nam) ": " (scow %ud num))
155 ["" ~]
156 ::
157 %- zing
158 ^- (list (list tape))
159 %+ turn
160 %+ sort ~(tap by cut.day)
161 |= [one=(pair path hump) two=(pair path hump)]
162 (gth (pi-moth mon.q.one) (pi-moth mon.q.two))
163 |= [pax=path hup=hump]
164 =+ ott=(pi-moth mon.hup)
165 ;: welp
166 [(welp "label: " (spud pax)) ~]
167 [(welp "price: " (scow %ud (div (mul 100 ott) tot))) ~]
168 [(welp "shape: " (pi-mumm mon.hup)) ~]
169 ::
170 ?: =(~ out.hup) ~
171 :- "into:"
172 %+ turn
173 %+ sort ~(tap by out.hup)
174 |=([[* a=@ud] [* b=@ud]] (gth a b))
175 |= [pax=path num=@ud]
176 ^- tape
177 :(welp " " (spud pax) ": " (scow %ud num))
178 ::
179 ?: =(~ inn.hup) ~
180 :- "from:"
181 %+ turn
182 %+ sort ~(tap by inn.hup)
183 |=([[* a=@ud] [* b=@ud]] (gth a b))
184 |= [pax=path num=@ud]
185 ^- tape
186 :(welp " " (spud pax) ": " (scow %ud num))
187 ::
188 ["" ~]
189 ~
190 ==
191 ==
192```
194---