5#ifndef LINE_SOLVERS_CACHE_METRICS_H
6#define LINE_SOLVERS_CACHE_METRICS_H
81 std::vector<CacheNodeMetrics<T>>
caches;
106 const std::vector<T>& missprob,
107 const std::vector<T>& delayedprob,
const std::vector<T>& latency,
109 const std::vector<T>& listcost) {
111 for (std::size_t ind = 1; ind <=
sn.nodes.size(); ++ind) {
112 if (
sn.nodes[ind - 1].nodetype != qn::NodeType::Cache)
continue;
113 const typename std::map<std::size_t, qn::CacheParam<T>>::const_iterator it =
114 sn.nodeparam.find(ind);
115 if (it ==
sn.nodeparam.end())
continue;
118 m.
name =
sn.nodes[ind - 1].name;
119 m.
nitems = it->second.nitems;
120 for (std::size_t l = 0; l < it->second.itemcap.size(); ++l)
121 m.
itemcap.push_back(
static_cast<double>(it->second.itemcap[l]));
122 for (std::size_t i = 0; i < it->second.itemsize.size(); ++i)
123 m.
itemsize.push_back(
static_cast<double>(it->second.itemsize[i]));
137 for (std::size_t r = 0; r < hitproblist.
rows(); ++r) {
140 for (std::size_t l = 0; l < hitproblist.
cols(); ++l) {
142 if (std::isnan(v))
continue;
143 acc = T(acc + hitproblist(r, l));
147 std::numeric_limits<double>::quiet_NaN()));
148 m.
missprob.push_back(any ? T(one - acc)
150 std::numeric_limits<double>::quiet_NaN()));
166 cache_metrics_of(
sn, std::vector<T>(), std::vector<T>(), std::vector<T>(), std::vector<T>(),
168 for (std::size_t c = 0; c < out.
caches.size(); ++c) {
169 if (c >= hitprob.
rows())
break;
170 out.
caches[c].hitprob.clear();
171 out.
caches[c].missprob.clear();
172 for (std::size_t r = 0; r < hitprob.
cols(); ++r) {
173 out.
caches[c].hitprob.push_back(hitprob(c, r));
174 out.
caches[c].missprob.push_back(missprob(c, r));
A network plus its refreshed NetworkStruct.
Dense matrix and non-owning view.
CacheMetrics< T > cache_metrics_of(const qn::NetworkStruct< T > &sn, const std::vector< T > &hitprob, const std::vector< T > &missprob, const std::vector< T > &delayedprob, const std::vector< T > &latency, const Matrix< T > &hitproblist, const Matrix< T > &itemprob, const std::vector< T > &listcost)
Assemble CacheMetrics from what a cache analyzer returned.
CacheMetrics< T > cache_metrics_of_matrix(const qn::NetworkStruct< T > &sn, const Matrix< T > &hitprob, const Matrix< T > &missprob)
The same, for the integrated caching-queueing branch, whose hit and miss probabilities are (ncaches x...
A queueing network and its refreshed NetworkStruct.
Every Cache node of the model, in node order; empty on a model with none.
std::vector< CacheNodeMetrics< T > > caches
One Cache node's measured behaviour.
std::vector< T > delayedhitqlen
(n) mean secondary requests waiting on the in-flight fetch of each item, and the same including the r...
std::vector< double > itemcap
(h) capacity of each list
std::vector< double > itemsize
(n) storage cost per item, EMPTY without setItemSizes
std::vector< T > hitprob
(K) TRUE hit fraction, EMPTY = not computed
std::vector< T > delayedprob
(K) delayed-hit fraction, EMPTY off a retrieval system
Matrix< T > hitproblist
(K x h) per-list hit fraction, EMPTY = not computed
std::size_t node
1-based node index of the Cache
std::vector< T > latency
(K) expected retrieval latency, EMPTY = not computed
std::vector< T > missprob
(K)
std::vector< T > listcost
(h) mean storage cost held by each list
Matrix< T > itemprob
(n x h+1), column 0 = miss; EMPTY = not computed
std::vector< T > delayedhitqlenfull
std::string name
The Cache node's NAME, which is what a cross-language payload must key on.