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): ...@@ -50,8 +50,8 @@ def getORSKPIValue(data):
evt.append(calc.tau_lo) evt.append(calc.tau_lo)
x = calc.eutran_ip_throughput() # E-UTRAN IP Throughput x = calc.eutran_ip_throughput() # E-UTRAN IP Throughput
tmp = [] tmp = []
for i in x: for qci, qci_data in enumerate(x):
tmp.append((i['dl']['lo'], i['dl']['hi'], i['ul']['lo'], i['ul']['hi'])) tmp.append((qci, qci_data['dl']['lo'], qci_data['dl']['hi'], qci_data['ul']['lo'], qci_data['ul']['hi']))
vIPThp_qci.append(tmp) vIPThp_qci.append(tmp)
# evt = np.asarray([x for x in evt]) # evt = np.asarray([x for x in evt])
......
...@@ -54,6 +54,7 @@ e_rab_dtype = np.dtype([ ...@@ -54,6 +54,7 @@ e_rab_dtype = np.dtype([
e_utran_dtype = np.dtype([ e_utran_dtype = np.dtype([
('evt', 'float'), ('evt', 'float'),
('qci', 'float'),
('dl_lo', 'float64'), ('dl_lo', 'float64'),
('dl_hi', 'float64'), ('dl_hi', 'float64'),
('ul_lo', 'float64'), ('ul_lo', 'float64'),
...@@ -65,21 +66,31 @@ if not e_rab_array: ...@@ -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 = e_rab_data_array.initArray(shape=(0,), dtype=e_rab_dtype)
e_rab_array_data = [] 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)): 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])) 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: 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_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_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: 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_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) e_utran_array.append(e_utran_array_data)
......
...@@ -5,19 +5,7 @@ ...@@ -5,19 +5,7 @@
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
function getColumn(array, column) { function getPlotData(raw_lo, raw_hi, raw_qci, raw_date) {
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) {
var color, var color,
color_array = [ color_array = [
{'color': '#1f77b4'}, {'color': '#1f77b4'},
...@@ -31,16 +19,36 @@ ...@@ -31,16 +19,36 @@
{'color': '#bcbd22'}, {'color': '#bcbd22'},
{'color': '#17becf'} {'color': '#17becf'}
], ],
length = lo[0].length, qci_list = [...new Set(...raw_qci)],
column_value, qci_count = qci_list.length,
data_count = raw_date.length,
data_list = [], data_list = [],
i; qci,
date,
for (i = 0; i < length; i += 1) { lo,
column_value = getColumn(hi, i); hi,
if (allEqual(column_value, 0)) { 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; 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]; color = color_array[i % color_array.length];
data_list.push({ data_list.push({
x: date, x: date,
...@@ -48,23 +56,23 @@ ...@@ -48,23 +56,23 @@
size: 4 size: 4
}, },
mode: 'lines+markers', mode: 'lines+markers',
y: getColumn(lo, i), y: lo,
type: 'scatter', type: 'scatter',
line: color, line: color,
name: 'IPThp.' + i, name: 'QCI ' + qci,
legendgroup: 'legendgroup' + i, legendgroup: 'legendgroup' + qci,
hovertemplate: 'Date: %{x}<br>Download: %{y} Mbit/s' hovertemplate: 'Date: %{x}<br>Link Speed: %{y} Mbit/s'
}); });
data_list.push({ data_list.push({
x: date, x: date,
mode: 'lines', mode: 'lines',
y: column_value, y: hi,
type: 'scatter', type: 'scatter',
line: color, line: color,
opacity: 0.3, opacity: 0.3,
showlegend: false, showlegend: false,
fill: 'tonexty', fill: 'tonexty',
legendgroup: 'legendgroup' + i, legendgroup: 'legendgroup' + qci,
hoverinfo: 'none' hoverinfo: 'none'
}); });
} }
...@@ -86,17 +94,19 @@ ...@@ -86,17 +94,19 @@
i, i,
download_data, download_data,
upload_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 new RSVP.Queue().push(function () {
return wendelin.getArrayRawSlice(gadget, option_dict.data_array_key); return wendelin.getArrayRawSlice(gadget, option_dict.data_array_key);
}) })
.push(function (result) { .push(function (result) {
var graph_data = nj.unpack(result.pick( null, label_list)), var graph_data = nj.unpack(result.pick( null, label_list)),
date = [], date = [],
qci = [],
dl_lo = [], dl_lo = [],
dl_hi = [], dl_hi = [],
ul_lo = [], ul_lo = [],
ul_hi = [], ul_hi = [],
raw_qci,
raw_dl_lo, raw_dl_lo,
raw_dl_hi, raw_dl_hi,
raw_ul_lo, raw_ul_lo,
...@@ -106,25 +116,30 @@ ...@@ -106,25 +116,30 @@
for (i = 0; i < graph_data.length; i += 1) { for (i = 0; i < graph_data.length; i += 1) {
if (date.indexOf(graph_data[i][0]) == -1) { if (date.indexOf(graph_data[i][0]) == -1) {
date.push(graph_data[i][0]); date.push(graph_data[i][0]);
qci.push(raw_qci);
dl_lo.push(raw_dl_lo); dl_lo.push(raw_dl_lo);
dl_hi.push(raw_dl_hi); dl_hi.push(raw_dl_hi);
ul_lo.push(raw_ul_lo); ul_lo.push(raw_ul_lo);
ul_hi.push(raw_ul_hi); ul_hi.push(raw_ul_hi);
raw_dl_lo = [graph_data[i][1] / 1e6]; raw_qci = [graph_data[i][1]];
raw_dl_hi = [graph_data[i][2] / 1e6]; raw_dl_lo = [graph_data[i][2] / 1e6];
raw_ul_lo = [graph_data[i][3] / 1e6]; raw_dl_hi = [graph_data[i][3] / 1e6];
raw_ul_hi = [graph_data[i][4] / 1e6]; raw_ul_lo = [graph_data[i][4] / 1e6];
raw_ul_hi = [graph_data[i][5] / 1e6];
} else { } else {
raw_dl_lo.push(graph_data[i][1] / 1e6); raw_qci.push(graph_data[i][1]);
raw_dl_hi.push(graph_data[i][2] / 1e6); raw_dl_lo.push(graph_data[i][2] / 1e6);
raw_ul_lo.push(graph_data[i][3] / 1e6); raw_dl_hi.push(graph_data[i][3] / 1e6);
raw_ul_hi.push(graph_data[i][4] / 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_lo.push(raw_dl_lo);
dl_hi.push(raw_dl_hi); dl_hi.push(raw_dl_hi);
ul_lo.push(raw_ul_lo); ul_lo.push(raw_ul_lo);
ul_hi.push(raw_ul_hi); ul_hi.push(raw_ul_hi);
qci.shift();
dl_lo.shift(); dl_lo.shift();
dl_hi.shift(); dl_hi.shift();
ul_lo.shift(); ul_lo.shift();
...@@ -132,8 +147,8 @@ ...@@ -132,8 +147,8 @@
date.forEach(function (element, index) { date.forEach(function (element, index) {
date[index] = new Date(element * 1000); date[index] = new Date(element * 1000);
}); });
download_data = getPlotData(dl_lo, dl_hi, date); download_data = getPlotData(dl_lo, dl_hi, qci, date);
upload_data = getPlotData(ul_lo, ul_hi, date); upload_data = getPlotData(ul_lo, ul_hi, qci, date);
Plotly.newPlot( Plotly.newPlot(
download_link, download_link,
download_data, download_data,
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1017.12308.4841.3874</string> </value> <value> <string>1018.40653.46063.57975</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1718094024.82</float> <float>1723640590.82</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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