1%{ @file lsn_max_multiplicity.m
2 % @brief Computes the maximum multiplicity of
nodes in a Layered Software Network
4 % @author LINE Development Team
8 % @brief Computes maximum multiplicity (concurrency level)
for LSN
nodes
11 % This function computes the maximum multiplicity (throughput capacity)
for
12 % each node in a Layered Software Network (LSN). Uses Kahn
's algorithm for
13 % topological sorting to propagate constraints through the network.
17 % outflow = lsn_max_multiplicity(lsn)
22 % <tr><th>Name<th>Description
23 % <tr><td>lsn<td>Layered Software Network structure
28 % <tr><th>Name<th>Description
29 % <tr><td>outflow<td>Maximum multiplicity (throughput capacity) for each node
32function outflow = lsn_max_multiplicity(lsn)
39% Manual topological sort (Kahn's algorithm)
42% initially load ref task multiplicity
45 if type(i) == LayeredNetworkElement.TASK && isref(i)
47 % Also account
for entries with open arrivals
48 elseif type(i) == LayeredNetworkElement.ENTRY
49 if isfield(lsn,
'arrival') && ~isempty(lsn.arrival) && ...
50 iscell(lsn.arrival) && i <= length(lsn.arrival) && ...
51 ~isempty(lsn.arrival{i})
52 % Entry has open arrival - needs at least 1 thread of its parent task
65 outflow(i) = min(inflow(i), mult(i));
68 inflow(j) = inflow(j) + outflow(i);
72%inflow(type > LayeredNetworkElement.TASK )=0;
74 if type(i) == LayeredNetworkElement.TASK && mult(i)==Inf && ~isref(i)