To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 1e37fd67 authored by Reto Da Forno's avatar Reto Da Forno
Browse files

include debug service in stats

parent 5d42d779
......@@ -138,7 +138,7 @@
var defaultColors = ['#3366CC','#DC3912','#FF9900','#109618','#990099','#3B3EAC','#0099C6','#DD4477','#66AA00','#B82E2E','#316395','#994499','#22AA99','#AAAA11','#6633CC','#E67300','#8B0707','#329262','#5574A6','#3B3EAC'];
</script>
<style>
.chartContainer { float: left; display: block; width: 600px; text-align: left; margin-top: 10px; margin-bottom: 10px; padding: 10px; }
.chartContainer { float: left; display: block; width: 700px; text-align: left; margin-top: 10px; margin-bottom: 10px; padding: 10px; }
.chartTitle { margin: 25px; width: 100%; text-align: center; font-weight: bold }
.chartArea { display: block; }
.numberField { text-align: right; }
......@@ -172,6 +172,7 @@
<tr><td>Number of tests with GPIO tracing: </td><td class="numberField"><?php echo $stats['gpiotracing_tests']; ?></td></td><td class="numberField"><?php print_tests_percent($stats['gpiotracing_tests']); ?></td></tr>
<tr><td>Number of tests with GPIO actuation: </td><td class="numberField"><?php echo $stats['gpioactuation_tests']; ?></td></td><td class="numberField"><?php print_tests_percent($stats['gpioactuation_tests']); ?></td></tr>
<tr><td>Number of tests with power profiling: </td><td class="numberField"><?php echo $stats['powerprof_tests']; ?></td></td><td class="numberField"><?php print_tests_percent($stats['powerprof_tests']); ?></td></tr>
<tr><td>Number of tests with debug service: </td><td class="numberField"><?php echo $stats['debug_tests']; ?></td></td><td class="numberField"><?php print_tests_percent($stats['debug_tests']); ?></td></tr>
</table>
</div>
<div class="chartContainer"><div class="chartTitle">Flocklab users by country</div><canvas id="chartCountries" class="chartArea"></canvas></div>
......@@ -201,15 +202,15 @@
create_line_chart("chartTestRuntime", $stats['runtime_cdf'], ["runtime [minutes]", "percentage of tests"]);
$dataseries = [$stats['tmote_per_year'], $stats['dpp_per_year'], $stats['dpp2_per_year'], $stats['nrf_per_year']];
$dataserieslabels = ['Tmote', 'DPP', 'DPP2LoRa', 'nRF5'];
create_multi_line_chart("chartPlatformsYear", $dataseries, $dataserieslabels, [$granularity, "percentage of tests"]);
$dataseries = [$stats['serial_per_year'], $stats['gpiotracing_per_year'], $stats['gpioactuation_per_year'], $stats['powerprof_per_year']];
$dataserieslabels = ['serial logging', 'GPIO tracing', 'GPIO actuation', 'power profiling'];
create_multi_line_chart("chartPlatformsYear", $dataseries, $dataserieslabels, [$granularity, "number of tests"]);
$dataseries = [$stats['serial_per_year'], $stats['gpiotracing_per_year'], $stats['gpioactuation_per_year'], $stats['powerprof_per_year'], $stats['debug_per_year']];
$dataserieslabels = ['serial', 'GPIO tracing', 'GPIO actuation', 'power profiling', 'debug & datatrace'];
create_multi_line_chart("chartServicesYear", $dataseries, $dataserieslabels, [$granularity, "percentage of tests"]);
$dataseries = [$stats['tmoteusers_per_year'], $stats['dppusers_per_year'], $stats['dpp2users_per_year'], $stats['nrfusers_per_year']];
$dataserieslabels = ['Tmote', 'DPP', 'DPP2LoRa', 'nRF5'];
create_multi_line_chart("chartPlatformsUsers", $dataseries, $dataserieslabels, [$granularity, "percentage of users"]);
$dataseries = [$stats['serialusers_per_year'], $stats['gpiotracingusers_per_year'], $stats['gpioactuationusers_per_year'], $stats['powerprofusers_per_year']];
$dataserieslabels = ['serial logging', 'GPIO tracing', 'GPIO actuation', 'power profiling'];
$dataseries = [$stats['serialusers_per_year'], $stats['gpiotracingusers_per_year'], $stats['gpioactuationusers_per_year'], $stats['powerprofusers_per_year'], $stats['debugusers_per_year']];
$dataserieslabels = ['serial', 'GPIO tracing', 'GPIO actuation', 'power profiling', 'debug & datatrace'];
create_multi_line_chart("chartServicesUsers", $dataseries, $dataserieslabels, [$granularity, "percentage of users"]);
?>
</script>
......
......@@ -111,6 +111,8 @@ function collect_stats($filename, $monthly)
$gpioactuationcnt = 0;
$powerprof_per_year = Array();
$powerprofcnt = 0;
$debug_per_year = Array();
$debugcnt = 0;
$sql = "select month(time_start_act) as m, year(time_start_act) as y, count(*) as num from tbl_serv_tests where time_start_act is not null group by ".($monthly ? "y, m" : "y");
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
......@@ -133,22 +135,23 @@ function collect_stats($filename, $monthly)
} else {
$tests_per_mote[$row['pname']] = $row['c'];
}
$val = $row['c']; // or as percent: round($row['c'] * 100 / $tests_per_year[$index])
if ($row['pname'] == 'Tmote') {
$tmotetests_per_year[$index] = round($row['c'] * 100 / $tests_per_year[$index]);
$tmotetests_per_year[$index] = $val;
$tmotetestcnt = $tmotetestcnt + $row['c'];
} else if ($row['pname'] == 'DPP') {
$dpptests_per_year[$index] = round($row['c'] * 100 / $tests_per_year[$index]);
$dpptests_per_year[$index] = $val;
$dpptestcnt = $dpptestcnt + $row['c'];
} else if ($row['pname'] == 'DPP2LoRa') {
$dpp2tests_per_year[$index] = round($row['c'] * 100 / $tests_per_year[$index]);
$dpp2tests_per_year[$index] = $val;
$dpp2testcnt = $dpp2testcnt + $row['c'];
} else if ($row['pname'] == 'nRF5') {
$nrftests_per_year[$index] = round($row['c'] * 100 / $tests_per_year[$index]);
$nrftests_per_year[$index] = $val;
$nrftestcnt = $nrftestcnt + $row['c'];
}
}
// Tests by service
$sql = "select sum(ExtractValue(testconfig_xml, 'count(/testConf/serialConf|/testConf/serialReaderConf)') > 0) as num_serial, sum(ExtractValue(testconfig_xml, 'count(/testConf/gpioTracingConf|/testConf/gpioMonitorConf)') > 0) as num_tracing, sum(ExtractValue(testconfig_xml, 'count(/testConf/gpioActuationConf|/testConf/gpioSettingConf)') > 0) as num_actuation, sum(ExtractValue(testconfig_xml, 'count(/testConf/powerProfilingConf|/testConf/powerprofConf)') > 0) as num_power from tbl_serv_tests where year(time_start_act) = $year".($monthly ? " and month(time_start_act) = $month" : "");
$sql = "select sum(ExtractValue(testconfig_xml, 'count(/testConf/serialConf|/testConf/serialReaderConf)') > 0) as num_serial, sum(ExtractValue(testconfig_xml, 'count(/testConf/gpioTracingConf|/testConf/gpioMonitorConf)') > 0) as num_tracing, sum(ExtractValue(testconfig_xml, 'count(/testConf/gpioActuationConf|/testConf/gpioSettingConf)') > 0) as num_actuation, sum(ExtractValue(testconfig_xml, 'count(/testConf/powerProfilingConf|/testConf/powerprofConf)') > 0) as num_power, sum(ExtractValue(testconfig_xml, 'count(/testConf/debugConf)') > 0) as num_debug from tbl_serv_tests where year(time_start_act) = $year".($monthly ? " and month(time_start_act) = $month" : "");
$rs3 = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
$row = mysqli_fetch_array($rs3);
......@@ -160,6 +163,8 @@ function collect_stats($filename, $monthly)
$gpioactuationcnt = $gpioactuationcnt + $row['num_actuation'];
$powerprof_per_year[$index] = round($row['num_power'] * 100 / $tests_per_year[$index]);
$powerprofcnt = $powerprofcnt + $row['num_power'];
$debug_per_year[$index] = round($row['num_debug'] * 100 / $tests_per_year[$index]);
$debugcnt = $debugcnt + $row['num_debug'];
}
arsort($tests_per_mote);
......@@ -173,6 +178,7 @@ function collect_stats($filename, $monthly)
$gpiotracingusers_per_year = Array();
$gpioactuationusers_per_year = Array();
$powerprofusers_per_year = Array();
$debugusers_per_year = Array();
$sql = "select month(time_start_act) as m, year(time_start_act) as y, count(distinct owner_fk) as num from tbl_serv_tests group by ".($monthly ? "y, m" : "y")." having y is not null";
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
while ($row = mysqli_fetch_array($rs)) {
......@@ -199,13 +205,14 @@ function collect_stats($filename, $monthly)
$nrfusers_per_year[$index] = round($row['c'] / $num_users * 100);
}
}
$sql = "select sum(num_all > 0) as user_all, sum(num_serial > 0) as user_serial, sum(num_tracing > 0) as user_tracing, sum(num_actuation > 0) as user_actuation, sum(num_power > 0) as user_power from (select sum(1) as num_all, sum(ExtractValue(testconfig_xml, 'count(/testConf/serialConf|/testConf/serialReaderConf)') > 0) as num_serial, sum(ExtractValue(testconfig_xml, 'count(/testConf/gpioTracingConf|/testConf/gpioMonitorConf)') > 0) as num_tracing, sum(ExtractValue(testconfig_xml, 'count(/testConf/gpioActuationConf|/testConf/gpioSettingConf)') > 0) as num_actuation, sum(ExtractValue(testconfig_xml, 'count(/testConf/powerProfilingConf|/testConf/powerprofConf)') > 0) as num_power from tbl_serv_tests where year(time_start_act) = $year".($monthly ? " and month(time_start_act) = $month" : "")." and (test_status_preserved in ('finished', 'retention expiring', 'synced') or test_status_preserved is null) group by owner_fk) as stats;";
$sql = "select sum(num_all > 0) as user_all, sum(num_serial > 0) as user_serial, sum(num_tracing > 0) as user_tracing, sum(num_actuation > 0) as user_actuation, sum(num_power > 0) as user_power, sum(num_debug > 0) as user_debug from (select sum(1) as num_all, sum(ExtractValue(testconfig_xml, 'count(/testConf/serialConf|/testConf/serialReaderConf)') > 0) as num_serial, sum(ExtractValue(testconfig_xml, 'count(/testConf/gpioTracingConf|/testConf/gpioMonitorConf)') > 0) as num_tracing, sum(ExtractValue(testconfig_xml, 'count(/testConf/gpioActuationConf|/testConf/gpioSettingConf)') > 0) as num_actuation, sum(ExtractValue(testconfig_xml, 'count(/testConf/powerProfilingConf|/testConf/powerprofConf)') > 0) as num_power, sum(ExtractValue(testconfig_xml, 'count(/testConf/debugConf)') > 0) as num_debug from tbl_serv_tests where year(time_start_act) = $year".($monthly ? " and month(time_start_act) = $month" : "")." and (test_status_preserved in ('finished', 'retention expiring', 'synced') or test_status_preserved is null) group by owner_fk) as stats;";
$rs3 = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
$row = mysqli_fetch_array($rs3);
$serialusers_per_year[$index] = round($row['user_serial'] / $num_users * 100); // in percent
$gpiotracingusers_per_year[$index] = round($row['user_tracing'] / $num_users * 100);
$gpioactuationusers_per_year[$index] = round($row['user_actuation'] / $num_users * 100);
$powerprofusers_per_year[$index] = round($row['user_power'] / $num_users * 100);
$debugusers_per_year[$index] = round($row['user_debug'] / $num_users * 100);
}
$sql = 'select avg(setuptime) as tsetup, avg(cleanuptime) as tcleanup, avg(timestampdiff(SECOND, time_start_act, time_end_act)) as avgruntime from tbl_serv_tests where time_start_act is not null and time_end_act is not null';
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
......@@ -305,6 +312,9 @@ gpioactuationusers_per_year = \"".str_replace('"', '\'', serialize($gpioactuatio
powerprof_tests = ".(string)$powerprofcnt."
powerprof_per_year = \"".str_replace('"', '\'', serialize($powerprof_per_year))."\"
powerprofusers_per_year = \"".str_replace('"', '\'', serialize($powerprofusers_per_year))."\"
debug_tests = ".(string)$debugcnt."
debug_per_year = \"".str_replace('"', '\'', serialize($debug_per_year))."\"
debugusers_per_year = \"".str_replace('"', '\'', serialize($debugusers_per_year))."\"
";
......
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