Commit ce96be72 authored by Paul Graydon's avatar Paul Graydon

ors_wendelin: Significantly optimize IP Throughput KPI process

parent 56527915
......@@ -50,8 +50,8 @@ def getORSKPIValue(data):
evt.append(calc.tau_lo)
x = calc.eutran_ip_throughput() # E-UTRAN IP Throughput
tmp = []
for i in x:
tmp.append((i['dl']['lo'], i['dl']['hi'], i['ul']['lo'], i['ul']['hi']))
for qci, qci_data in enumerate(x):
tmp.append((qci, qci_data['dl']['lo'], qci_data['dl']['hi'], qci_data['ul']['lo'], qci_data['ul']['hi']))
vIPThp_qci.append(tmp)
# evt = np.asarray([x for x in evt])
......
......@@ -54,6 +54,7 @@ e_rab_dtype = np.dtype([
e_utran_dtype = np.dtype([
('evt', 'float'),
('qci', 'float'),
('dl_lo', 'float64'),
('dl_hi', 'float64'),
('ul_lo', 'float64'),
......@@ -65,21 +66,31 @@ if not e_rab_array:
e_rab_array = e_rab_data_array.initArray(shape=(0,), dtype=e_rab_dtype)
e_rab_array_data = []
e_utran_array = e_utran_data_array.getArray()
if not e_utran_array:
e_utran_array = e_utran_data_array.initArray(shape=(0,), dtype=e_utran_dtype )
e_utran_array_data = []
for i in range(len(vt)):
e_rab_array_data.append((vt[i], vInititialEPSBEstabSR[i][0], vInititialEPSBEstabSR[i][1], vAddedEPSBEstabSR[i][0], vAddedEPSBEstabSR[i][1]))
for i in range(len(evt)):
for j in vIPThp_qci[i]:
e_utran_array_data.append((evt[i], j[0], j[1], j[2], j[3]))
if e_rab_array_data:
e_rab_array_data = np.ndarray((len(e_rab_array_data), ), e_rab_dtype, np.array(e_rab_array_data))
e_rab_array.append(e_rab_array_data)
e_utran_array = e_utran_data_array.getArray()
if not e_utran_array:
e_utran_array = e_utran_data_array.initArray(shape=(0,), dtype=e_utran_dtype)
e_utran_array_data = []
seen_qci_list = []
i = e_utran_array.shape[0] - 1
qci_idx = 1
while (i >= 0) and (e_utran_array[i][qci_idx] not in seen_qci_list):
seen_qci_list.append(e_utran_array[i][qci_idx])
i -= 1
for i in range(len(evt)):
for qci_data in vIPThp_qci[i]:
qci = qci_data[0]
qci_data_hi = [qci_data[2], qci_data[4]]
if qci in seen_qci_list or any([data != 0 for data in qci_data_hi]):
e_utran_array_data.append((evt[i], qci, qci_data[1], qci_data[2], qci_data[3], qci_data[4]))
if e_utran_array_data:
e_utran_array_data = np.ndarray((len(e_utran_array_data), ), e_utran_dtype, np.array(e_utran_array_data))
e_utran_array.append(e_utran_array_data)
......
......@@ -5,19 +5,7 @@
var gadget_klass = rJS(window);
function getColumn(array, column) {
return array.map(function (value, index) {
return value[column];
});
}
function allEqual(array, value) {
return array.every(function (current) {
return current === value;
});
}
function getPlotData(lo, hi, date) {
function getPlotData(raw_lo, raw_hi, raw_qci, raw_date) {
var color,
color_array = [
{'color': '#1f77b4'},
......@@ -31,16 +19,36 @@
{'color': '#bcbd22'},
{'color': '#17becf'}
],
length = lo[0].length,
column_value,
qci_list = [...new Set(...raw_qci)],
qci_count = qci_list.length,
data_count = raw_date.length,
data_list = [],
i;
for (i = 0; i < length; i += 1) {
column_value = getColumn(hi, i);
if (allEqual(column_value, 0)) {
qci,
date,
lo,
hi,
qci_idx,
i,
j;
qci_list.sort(function(a, b) {
return a - b;
});
for (i = 0; i < qci_count; i += 1) {
qci = qci_list[i];
date = [];
lo = [];
hi = [];
for (j = 0; j < data_count; j += 1) {
qci_idx = raw_qci[j].indexOf(qci);
if (qci_idx == -1) {
continue;
}
date.push(raw_date[j]);
lo.push(raw_lo[j][qci_idx]);
hi.push(raw_hi[j][qci_idx]);
}
color = color_array[i % color_array.length];
data_list.push({
x: date,
......@@ -48,23 +56,23 @@
size: 4
},
mode: 'lines+markers',
y: getColumn(lo, i),
y: lo,
type: 'scatter',
line: color,
name: 'IPThp.' + i,
legendgroup: 'legendgroup' + i,
hovertemplate: 'Date: %{x}<br>Download: %{y} Mbit/s'
name: 'QCI ' + qci,
legendgroup: 'legendgroup' + qci,
hovertemplate: 'Date: %{x}<br>Link Speed: %{y} Mbit/s'
});
data_list.push({
x: date,
mode: 'lines',
y: column_value,
y: hi,
type: 'scatter',
line: color,
opacity: 0.3,
showlegend: false,
fill: 'tonexty',
legendgroup: 'legendgroup' + i,
legendgroup: 'legendgroup' + qci,
hoverinfo: 'none'
});
}
......@@ -86,17 +94,19 @@
i,
download_data,
upload_data,
label_list = ["evt", "dl_lo", "dl_hi", "ul_lo", "ul_hi"];
label_list = ["evt", "qci", "dl_lo", "dl_hi", "ul_lo", "ul_hi"];
return new RSVP.Queue().push(function () {
return wendelin.getArrayRawSlice(gadget, option_dict.data_array_key);
})
.push(function (result) {
var graph_data = nj.unpack(result.pick( null, label_list)),
date = [],
qci = [],
dl_lo = [],
dl_hi = [],
ul_lo = [],
ul_hi = [],
raw_qci,
raw_dl_lo,
raw_dl_hi,
raw_ul_lo,
......@@ -106,25 +116,30 @@
for (i = 0; i < graph_data.length; i += 1) {
if (date.indexOf(graph_data[i][0]) == -1) {
date.push(graph_data[i][0]);
qci.push(raw_qci);
dl_lo.push(raw_dl_lo);
dl_hi.push(raw_dl_hi);
ul_lo.push(raw_ul_lo);
ul_hi.push(raw_ul_hi);
raw_dl_lo = [graph_data[i][1] / 1e6];
raw_dl_hi = [graph_data[i][2] / 1e6];
raw_ul_lo = [graph_data[i][3] / 1e6];
raw_ul_hi = [graph_data[i][4] / 1e6];
raw_qci = [graph_data[i][1]];
raw_dl_lo = [graph_data[i][2] / 1e6];
raw_dl_hi = [graph_data[i][3] / 1e6];
raw_ul_lo = [graph_data[i][4] / 1e6];
raw_ul_hi = [graph_data[i][5] / 1e6];
} else {
raw_dl_lo.push(graph_data[i][1] / 1e6);
raw_dl_hi.push(graph_data[i][2] / 1e6);
raw_ul_lo.push(graph_data[i][3] / 1e6);
raw_ul_hi.push(graph_data[i][4] / 1e6);
raw_qci.push(graph_data[i][1]);
raw_dl_lo.push(graph_data[i][2] / 1e6);
raw_dl_hi.push(graph_data[i][3] / 1e6);
raw_ul_lo.push(graph_data[i][4] / 1e6);
raw_ul_hi.push(graph_data[i][5] / 1e6);
}
}
qci.push(raw_qci);
dl_lo.push(raw_dl_lo);
dl_hi.push(raw_dl_hi);
ul_lo.push(raw_ul_lo);
ul_hi.push(raw_ul_hi);
qci.shift();
dl_lo.shift();
dl_hi.shift();
ul_lo.shift();
......@@ -132,8 +147,8 @@
date.forEach(function (element, index) {
date[index] = new Date(element * 1000);
});
download_data = getPlotData(dl_lo, dl_hi, date);
upload_data = getPlotData(ul_lo, ul_hi, date);
download_data = getPlotData(dl_lo, dl_hi, qci, date);
upload_data = getPlotData(ul_lo, ul_hi, qci, date);
Plotly.newPlot(
download_link,
download_data,
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1017.12308.4841.3874</string> </value>
<value> <string>1018.40653.46063.57975</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1718094024.82</float>
<float>1723640590.82</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment