session: More poll spewing

This commit is contained in:
Daniel Elstner 2015-09-01 00:36:30 +02:00
parent 15408b51f3
commit 7637fa35b5
1 changed files with 12 additions and 4 deletions

View File

@ -405,6 +405,7 @@ static int sr_session_iteration(struct sr_session *session)
GPollFD *pollfd;
gintptr poll_object;
#ifdef HAVE_LIBUSB_1_0
int64_t usb_timeout;
int64_t usb_due;
struct timeval tv;
#endif
@ -430,10 +431,14 @@ static int sr_session_iteration(struct sr_session *session)
libusb_error_name(ret));
return SR_ERR;
} else if (ret == 1) {
usb_due = start_time + tv.tv_usec
+ (int64_t)tv.tv_sec * G_USEC_PER_SEC;
usb_timeout = (int64_t)tv.tv_sec * G_USEC_PER_SEC
+ tv.tv_usec;
usb_due = start_time + usb_timeout;
if (usb_due < min_due)
min_due = usb_due;
sr_spew("poll: next USB timeout %g ms",
1e-3 * usb_timeout);
}
}
#endif
@ -444,6 +449,9 @@ static int sr_session_iteration(struct sr_session *session)
else
timeout_ms = 0;
sr_spew("poll enter: %u sources, %u fds, %d ms timeout",
session->sources->len, session->pollfds->len, timeout_ms);
ret = g_poll((GPollFD *)session->pollfds->data,
session->pollfds->len, timeout_ms);
#ifdef G_OS_UNIX
@ -459,8 +467,8 @@ static int sr_session_iteration(struct sr_session *session)
#endif
stop_time = g_get_monotonic_time();
sr_spew("%s: poll %d ms timeout, %g ms elapsed, %d events",
__func__, timeout_ms, 0.001 * (stop_time - start_time), ret);
sr_spew("poll leave: %g ms elapsed, %d events",
1e-3 * (stop_time - start_time), ret);
triggered = FALSE;
stopped = FALSE;