LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
cache_mva_miss.m
1%{ @file cache_mva_miss.m
2 % @brief Computes miss rates using Mean Value Analysis
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Computes cache miss rates using Mean Value Analysis
9 %
10 % @details
11 % This function computes global and per-item miss rates for cache models
12 % using Mean Value Analysis with given item popularities and routing.
13 %
14 % @par Syntax:
15 % @code
16 % [M, Mk] = cache_mva_miss(p, m, R)
17 % @endcode
18 %
19 % @par Parameters:
20 % <table>
21 % <tr><th>Name<th>Description
22 % <tr><td>p<td>Item popularity probabilities
23 % <tr><td>m<td>Cache capacity vector
24 % <tr><td>R<td>Routing probabilities
25 % </table>
26 %
27 % @par Returns:
28 % <table>
29 % <tr><th>Name<th>Description
30 % <tr><td>M<td>Global miss rate
31 % <tr><td>Mk<td>Per-item miss rate
32 % </table>
33%}
34function [M,Mk]=cache_mva_miss(p,m,R)
35n=length(p);
36h=length(m);
37if sum(m)==0 || min(m)<0
38 Mk=ones(1,n);
39 M=p*Mk';
40 return
41end
42for j=1:h
43 [~,Mj]=cache_mva_miss(p,oner(m,j),R);
44 for k=1:n
45 w(k,j)=prod(R(1:j,k))*p(k)^j*abs(Mj(k));
46 end
47end
48for j=1:h
49 x(j) = 1/sum(abs(w(:,j)));
50end
51for k=1:n
52 Mk(k)=1;
53 for j=1:h
54 Mk(k)=Mk(k)-x(j)*m(j)*w(k,j);
55 end
56end
57Mk=abs(Mk);
58M=p*Mk';
59end