Revision 0a8dd21d
b/Ganeti/HTools/Cluster.hs | ||
---|---|---|
148 | 148 |
(0, 0) (Container.elems nl) |
149 | 149 |
|
150 | 150 |
-- | Compute the mem and disk covariance. |
151 |
compDetailedCV :: Node.List -> (Double, Double, Double, Double, Double) |
|
151 |
compDetailedCV :: Node.List -> (Double, Double, Double, Double, Double, Double)
|
|
152 | 152 |
compDetailedCV nl = |
153 | 153 |
let |
154 | 154 |
all_nodes = Container.elems nl |
... | ... | |
167 | 167 |
(length . Node.slist $ n)) $ nodes |
168 | 168 |
off_score = (fromIntegral offline_inst) / |
169 | 169 |
(fromIntegral $ online_inst + offline_inst) |
170 |
in (mem_cv, dsk_cv, n1_score, res_cv, off_score) |
|
170 |
cpu_l = map Node.p_cpu nodes |
|
171 |
cpu_cv = varianceCoeff cpu_l |
|
172 |
in (mem_cv, dsk_cv, n1_score, res_cv, off_score, cpu_cv) |
|
171 | 173 |
|
172 | 174 |
-- | Compute the /total/ variance. |
173 | 175 |
compCV :: Node.List -> Double |
174 | 176 |
compCV nl = |
175 |
let (mem_cv, dsk_cv, n1_score, res_cv, off_score) = compDetailedCV nl |
|
176 |
in mem_cv + dsk_cv + n1_score + res_cv + off_score |
|
177 |
let (mem_cv, dsk_cv, n1_score, res_cv, off_score, cpu_cv) = |
|
178 |
compDetailedCV nl |
|
179 |
in mem_cv + dsk_cv + n1_score + res_cv + off_score + cpu_cv |
|
177 | 180 |
|
178 | 181 |
-- | Compute online nodes from a Node.List |
179 | 182 |
getOnline :: Node.List -> [Node.Node] |
... | ... | |
790 | 793 |
-- | Shows statistics for a given node list. |
791 | 794 |
printStats :: Node.List -> String |
792 | 795 |
printStats nl = |
793 |
let (mem_cv, dsk_cv, n1_score, res_cv, off_score) = compDetailedCV nl |
|
794 |
in printf "f_mem=%.8f, r_mem=%.8f, f_dsk=%.8f, n1=%.3f, uf=%.3f" |
|
795 |
mem_cv res_cv dsk_cv n1_score off_score |
|
796 |
let (mem_cv, dsk_cv, n1_score, res_cv, off_score, cpu_cv) = |
|
797 |
compDetailedCV nl |
|
798 |
in printf "f_mem=%.8f, r_mem=%.8f, f_dsk=%.8f, n1=%.3f, \ |
|
799 |
\uf=%.3f, r_cpu=%.3f" |
|
800 |
mem_cv res_cv dsk_cv n1_score off_score cpu_cv |
Also available in: Unified diff