sw_limits: Log when the sample/time limit is reached.
This commit is contained in:
parent
4b1a9d5d86
commit
3ba944cf41
|
@ -31,6 +31,8 @@
|
||||||
#include <libsigrok/libsigrok.h>
|
#include <libsigrok/libsigrok.h>
|
||||||
#include "libsigrok-internal.h"
|
#include "libsigrok-internal.h"
|
||||||
|
|
||||||
|
#define LOG_PREFIX "sw_limits"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize a software limit instance
|
* Initialize a software limit instance
|
||||||
*
|
*
|
||||||
|
@ -129,17 +131,23 @@ SR_PRIV void sr_sw_limits_acquisition_start(struct sr_sw_limits *limits)
|
||||||
SR_PRIV gboolean sr_sw_limits_check(struct sr_sw_limits *limits)
|
SR_PRIV gboolean sr_sw_limits_check(struct sr_sw_limits *limits)
|
||||||
{
|
{
|
||||||
if (limits->limit_samples) {
|
if (limits->limit_samples) {
|
||||||
if (limits->samples_read >= limits->limit_samples)
|
if (limits->samples_read >= limits->limit_samples) {
|
||||||
|
sr_dbg("Requested number of samples (%" PRIu64
|
||||||
|
") reached.", limits->limit_samples);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (limits->limit_msec) {
|
if (limits->limit_msec) {
|
||||||
guint64 now;
|
guint64 now;
|
||||||
now = g_get_monotonic_time();
|
now = g_get_monotonic_time();
|
||||||
if (now > limits->start_time &&
|
if (now > limits->start_time &&
|
||||||
now - limits->start_time > limits->limit_msec)
|
now - limits->start_time > limits->limit_msec) {
|
||||||
|
sr_dbg("Requested sampling time (%" PRIu64
|
||||||
|
"ms) reached.", limits->limit_msec / 1000);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue