benchmarks/latmus: keep result log on comm error with latmon

Losing the whole result log upon network error communicating with
latmon is very annoying, especially when this happens at the very end
of an overnight test. Since we have a TCP connection, we can trust the
results received so far, so dump them to the result file regardless.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
This commit is contained in:
Philippe Gerum 2020-05-16 12:08:41 +02:00
parent 3ae497c35b
commit 6b2425d8f6
1 changed files with 9 additions and 6 deletions

View File

@ -677,16 +677,19 @@ static void setup_measurement_on_gpio(void)
req.period_usecs = 0; /* Zero means stop. */ req.period_usecs = 0; /* Zero means stop. */
req.histogram_cells = 0; req.histogram_cells = 0;
ret = send(lat_sock, &req, sizeof(req), 0); ret = send(lat_sock, &req, sizeof(req), 0);
if (ret != sizeof(req)) if (ret != sizeof(req)) {
error(1, errno, "send() start"); error(0, errno, "send() stop");
latmon_hung = true;
} else {
clock_gettime(CLOCK_REALTIME, &timeout); clock_gettime(CLOCK_REALTIME, &timeout);
timeout.tv_sec += LATMON_TIMEOUT_SECS; timeout.tv_sec += LATMON_TIMEOUT_SECS;
if (sem_timedwait(&logger_done, &timeout)) if (sem_timedwait(&logger_done, &timeout))
latmon_hung = true; latmon_hung = true;
} }
}
if (latmon_hung) if (latmon_hung)
error(1, ETIMEDOUT, "latmon at %s is unresponsive", error(0, ETIMEDOUT, "latmon at %s is unresponsive",
inet_ntoa(gpio_monitor_ip)); inet_ntoa(gpio_monitor_ip));
close(lat_sock); close(lat_sock);