m4_define([_DEFAULT_CHANNEL_LIVE_TIMER], [0])
m4_define([_DEFAULT_CHANNEL_READ_TIMER], [200000])
m4_define([_DEFAULT_CHANNEL_MONITOR_TIMER], [1000000])
+m4_define([_DEFAULT_CHANNEL_BLOCKING_TIMEOUT], [0])
_AC_DEFINE_AND_SUBST([DEFAULT_AGENT_TCP_PORT], [5345])
_AC_DEFINE_AND_SUBST([DEFAULT_APP_SOCKET_RW_TIMEOUT], [5])
_AC_DEFINE_AND_SUBST([DEFAULT_CHANNEL_SUBBUF_SIZE], [_DEFAULT_CHANNEL_SUBBUF_SIZE])
_AC_DEFINE_AND_SUBST([DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE], [1048576])
_AC_DEFINE_AND_SUBST([DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER], [_DEFAULT_CHANNEL_SWITCH_TIMER])
_AC_DEFINE_AND_SUBST([DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER], [_DEFAULT_CHANNEL_MONITOR_TIMER])
+_AC_DEFINE_AND_SUBST([DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT], [_DEFAULT_CHANNEL_BLOCKING_TIMEOUT])
_AC_DEFINE_AND_SUBST([DEFAULT_LTTNG_LIVE_TIMER], [1000000])
_AC_DEFINE_AND_SUBST([DEFAULT_METADATA_CACHE_SIZE], [4096])
_AC_DEFINE_AND_SUBST([DEFAULT_METADATA_READ_TIMER], [0])
_AC_DEFINE_AND_SUBST([DEFAULT_NETWORK_VIEWER_PORT], [5344])
_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_LIVE_TIMER], [_DEFAULT_CHANNEL_LIVE_TIMER])
_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_READ_TIMER], [0])
+_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT], [0])
_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM], [_DEFAULT_CHANNEL_SUBBUF_NUM])
_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE], [_DEFAULT_CHANNEL_SUBBUF_SIZE])
_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER], [_DEFAULT_CHANNEL_SWITCH_TIMER])
_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER], [_DEFAULT_CHANNEL_MONITOR_TIMER])
_AC_DEFINE_AND_SUBST([DEFAULT_UST_UID_CHANNEL_LIVE_TIMER], [_DEFAULT_CHANNEL_LIVE_TIMER])
_AC_DEFINE_AND_SUBST([DEFAULT_UST_UID_CHANNEL_READ_TIMER], [0])
+_AC_DEFINE_AND_SUBST([DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT], [0])
_AC_DEFINE_AND_SUBST([DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM], [_DEFAULT_CHANNEL_SUBBUF_NUM])
_AC_DEFINE_AND_SUBST([DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE], [524288])
_AC_DEFINE_AND_SUBST([DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER], [_DEFAULT_CHANNEL_SWITCH_TIMER])
[option:--overwrite] [option:--buffers-pid]
[option:--subbuf-size='SIZE'] [option:--num-subbuf='COUNT']
[option:--switch-timer='PERIODUS'] [option:--read-timer='PERIODUS']
+ [option:--blocking-timeout='TIMEOUTUS']
[option:--tracefile-size='SIZE'] [option:--tracefile-count='COUNT']
[option:--session='SESSION'] 'CHANNEL'
* option:--kernel option: {default_kernel_channel_switch_timer}
* `metadata` channel: {default_metadata_switch_timer}
+Timeouts
+~~~~~~~~
+option:--blocking-timeout:
+ Set the channel's blocking timeout value to 'TIMEOUTUS' µs. 0
+ (default) does not block. -1 blocks forever until room is
+ available in the buffer to write the event. Positive
+ values are a timeout bounding the maximum blocking time
+ when trying to write into the buffer. Note that this option
+ only affects applications launched with the
+ LTTNG_UST_ALLOW_BLOCKING environment variable set.
include::common-cmd-help-options.txt[]
SEE ALSO
--------
man:lttng-disable-channel(1),
-man:lttng(1)
+man:lttng(1),
+man:lttng-ust(3)
uint64_t discarded_events;
uint64_t lost_packets;
uint64_t monitor_timer_interval;
+ int64_t blocking_timeout;
} LTTNG_PACKED;
#endif /* LTTNG_CHANNEL_INTERNAL_H */
extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan,
uint64_t monitor_timer_interval);
+extern int lttng_channel_get_blocking_timeout(struct lttng_channel *chan,
+ int64_t *blocking_timeout);
+
+extern int lttng_channel_set_blocking_timeout(struct lttng_channel *chan,
+ int64_t blocking_timeout);
+
#ifdef __cplusplus
}
#endif
chan->attr.switch_timer_interval = DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER;
chan->attr.read_timer_interval = DEFAULT_KERNEL_CHANNEL_READ_TIMER;
chan->attr.live_timer_interval = DEFAULT_KERNEL_CHANNEL_LIVE_TIMER;
+ extended_attr->blocking_timeout = DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT;
extended_attr->monitor_timer_interval =
DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER;
break;
DEFAULT_UST_UID_CHANNEL_READ_TIMER;
chan->attr.live_timer_interval =
DEFAULT_UST_UID_CHANNEL_LIVE_TIMER;
+ extended_attr->blocking_timeout = DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT;
extended_attr->monitor_timer_interval =
DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER;
break;
DEFAULT_UST_PID_CHANNEL_READ_TIMER;
chan->attr.live_timer_interval =
DEFAULT_UST_PID_CHANNEL_LIVE_TIMER;
+ extended_attr->blocking_timeout = DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT;
extended_attr->monitor_timer_interval =
DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER;
break;
return 0;
}
+static int channel_validate_kernel(struct lttng_channel *attr)
+{
+ /* Kernel channels do not support blocking timeout. */
+ if (((struct lttng_channel_extended *)attr->attr.extended.ptr)->blocking_timeout) {
+ return -1;
+ }
+ return 0;
+}
+
/*
* Create kernel channel of the kernel session and notify kernel thread.
*/
goto error;
}
+ if (channel_validate_kernel(attr) < 0) {
+ ret = LTTNG_ERR_INVALID;
+ goto error;
+ }
+
/* Channel not found, creating it */
ret = kernel_create_channel(ksession, attr);
if (ret < 0) {
chan_exts[i].lost_packets = lost_packets;
chan_exts[i].monitor_timer_interval =
extended->monitor_timer_interval;
+ chan_exts[i].blocking_timeout = 0;
i++;
}
}
chan_exts[i].monitor_timer_interval =
uchan->monitor_timer_interval;
+ chan_exts[i].blocking_timeout =
+ uchan->attr.u.s.blocking_timeout;
ret = get_ust_runtime_stats(session, uchan,
&discarded_events, &lost_packets);
uint64_t session_id_per_pid,
unsigned int monitor,
uint32_t ust_app_uid,
+ int64_t blocking_timeout,
const char *root_shm_path,
const char *shm_path)
{
msg->u.ask_channel.tracefile_count = tracefile_count;
msg->u.ask_channel.monitor = monitor;
msg->u.ask_channel.ust_app_uid = ust_app_uid;
+ msg->u.ask_channel.blocking_timeout = blocking_timeout;
memcpy(msg->u.ask_channel.uuid, uuid, sizeof(msg->u.ask_channel.uuid));
uint64_t session_id_per_pid,
unsigned int monitor,
uint32_t ust_app_uid,
+ int64_t blocking_timeout,
const char *root_shm_path,
const char *shm_path);
void consumer_init_stream_comm_msg(struct lttcomm_consumer_msg *msg,
unsigned int switch_timer_interval; /* usec */
unsigned int read_timer_interval; /* usec */
enum lttng_ust_output output; /* splice, mmap */
- char padding[LTTNG_UST_CHANNEL_ATTR_PADDING];
+ union {
+ struct {
+ int64_t blocking_timeout; /* Retry timeout (usec) */
+ } s;
+ char padding[LTTNG_UST_CHANNEL_ATTR_PADDING];
+ } u;
} LTTNG_PACKED;
#define LTTNG_UST_TRACEPOINT_ITER_PADDING 16
enum lttng_ust_output output; /* splice, mmap */
uint32_t chan_id; /* channel ID */
unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
+ int64_t blocking_timeout; /* Retry timeout (usec) */
} LTTNG_PACKED;
/*
luc->attr.output = (enum lttng_ust_output) chan->attr.output;
luc->monitor_timer_interval = ((struct lttng_channel_extended *)
chan->attr.extended.ptr)->monitor_timer_interval;
+ luc->attr.u.s.blocking_timeout = ((struct lttng_channel_extended *)
+ chan->attr.extended.ptr)->blocking_timeout;
/* Translate to UST output enum */
switch (luc->attr.output) {
attr->switch_timer_interval = uattr->switch_timer_interval;
attr->read_timer_interval = uattr->read_timer_interval;
attr->output = uattr->output;
+ attr->blocking_timeout = uattr->u.s.blocking_timeout;
}
/*
ua_chan->attr.switch_timer_interval = attr->switch_timer_interval;
ua_chan->attr.read_timer_interval = attr->read_timer_interval;
ua_chan->attr.output = attr->output;
+ ua_chan->attr.blocking_timeout = attr->u.s.blocking_timeout;
}
/* By default, the channel is a per cpu channel. */
ua_chan->attr.type = LTTNG_UST_CHAN_PER_CPU;
ua_chan->attr.read_timer_interval = uchan->attr.read_timer_interval;
ua_chan->monitor_timer_interval = uchan->monitor_timer_interval;
ua_chan->attr.output = uchan->attr.output;
+ ua_chan->attr.blocking_timeout = uchan->attr.u.s.blocking_timeout;
+
/*
* Note that the attribute channel type is not set since the channel on the
* tracing registry side does not have this information.
ua_sess->id,
ua_sess->output_traces,
ua_sess->uid,
+ ua_chan->attr.blocking_timeout,
root_shm_path, shm_path);
health_code_update();
bool set;
uint32_t interval;
} opt_monitor_timer;
+static struct {
+ bool set;
+ int64_t value;
+} opt_blocking_timeout;
static struct mi_writer *writer;
OPT_LIST_OPTIONS,
OPT_TRACEFILE_SIZE,
OPT_TRACEFILE_COUNT,
+ OPT_BLOCKING_TIMEOUT,
};
static struct lttng_handle *handle;
{"buffers-global", 0, POPT_ARG_VAL, &opt_buffer_global, 1, 0, 0},
{"tracefile-size", 'C', POPT_ARG_INT, 0, OPT_TRACEFILE_SIZE, 0, 0},
{"tracefile-count", 'W', POPT_ARG_INT, 0, OPT_TRACEFILE_COUNT, 0, 0},
+ {"blocking-timeout", 0, POPT_ARG_INT, 0, OPT_BLOCKING_TIMEOUT, 0, 0},
{0, 0, 0, 0, 0, 0, 0}
};
memset(&dom, 0, sizeof(dom));
+ /* Validate options. */
+ if (opt_kernel) {
+ if (opt_blocking_timeout.set) {
+ ERR("Retry timeout option not supported for kernel domain (-k)");
+ ret = CMD_ERROR;
+ goto error;
+ }
+ }
+
/* Create lttng domain */
if (opt_kernel) {
dom.type = LTTNG_DOMAIN_KERNEL;
goto error;
}
}
+ if (opt_blocking_timeout.set) {
+ ret = lttng_channel_set_blocking_timeout(channel,
+ opt_blocking_timeout.value);
+ if (ret) {
+ ERR("Failed to set the channel's blocking timeout");
+ error = 1;
+ goto error;
+ }
+ }
DBG("Enabling channel %s", channel_name);
DBG("Channel monitor timer interval set to %d", opt_monitor_timer.interval);
break;
}
+ case OPT_BLOCKING_TIMEOUT:
+ {
+ long long v; /* in usec */
+ long long v_msec;
+
+ errno = 0;
+ opt_arg = poptGetOptArg(pc);
+ v = strtoll(opt_arg, NULL, 0);
+ if (errno != 0 || (!isdigit(opt_arg[0]) && opt_arg[0] != '-')
+ || v < -1) {
+ ERR("Wrong value in --blocking-timeout parameter: %s", opt_arg);
+ ret = CMD_ERROR;
+ goto end;
+ }
+ if (v >= 0) {
+ /*
+ * While LTTng-UST and LTTng-tools will accept
+ * a blocking timeout expressed in µs, the
+ * current tracer implementation relies on
+ * poll() which takes an "int timeout" parameter
+ * expressed in msec.
+ *
+ * Since the error reporting from the tracer
+ * is not precise, we perform this check here
+ * to provide a helpful error message in case of
+ * overflow.
+ *
+ * The setter (liblttng-ctl) also performs an
+ * equivalent check.
+ */
+ v_msec = v / 1000;
+ if (v_msec != (int32_t) v_msec) {
+ ERR("32-bit milliseconds overflow in --blocking-timeout parameter: %s", opt_arg);
+ ret = CMD_ERROR;
+ goto end;
+ }
+ } else if (v != -1) {
+ ERR("Invalid negative value passed as --blocking-timeout parameter; -1 (block forever) is the only valid negative value");
+ }
+ opt_blocking_timeout.value = (int64_t) v;
+ opt_blocking_timeout.set = true;
+ DBG("Channel blocking timeout set to %" PRId64 " (µs)",
+ opt_blocking_timeout.value);
+ break;
+ }
case OPT_USERSPACE:
opt_userspace = 1;
break;
{
int ret;
uint64_t discarded_events, lost_packets, monitor_timer_interval;
+ int64_t blocking_timeout;
ret = lttng_channel_get_discarded_event_count(channel,
&discarded_events);
return;
}
+ ret = lttng_channel_get_blocking_timeout(channel,
+ &blocking_timeout);
+ if (ret) {
+ ERR("Failed to retrieve blocking timeout of channel");
+ return;
+ }
+
MSG("- %s:%s\n", channel->name, enabled_string(channel->enabled));
MSG("%sAttributes:", indent4);
MSG("%sswitch timer interval: %u", indent6, channel->attr.switch_timer_interval);
MSG("%sread timer interval: %u", indent6, channel->attr.read_timer_interval);
MSG("%smonitor timer interval: %" PRIu64, indent6, monitor_timer_interval);
+ MSG("%sblocking timeout (µs): %" PRId64, indent6, blocking_timeout);
MSG("%strace file count: %" PRIu64, indent6, channel->attr.tracefile_count);
MSG("%strace file size (bytes): %" PRIu64, indent6, channel->attr.tracefile_size);
MSG("%sdiscarded events: %" PRIu64, indent6, discarded_events);
extern const char * const config_element_switch_timer_interval;
extern const char * const config_element_read_timer_interval;
extern const char * const config_element_monitor_timer_interval;
+extern const char * const config_element_blocking_timeout;
extern const char * const config_element_output;
extern const char * const config_element_output_type;
extern const char * const config_element_tracefile_size;
const char * const config_element_switch_timer_interval = "switch_timer_interval";
const char * const config_element_read_timer_interval = "read_timer_interval";
const char * const config_element_monitor_timer_interval = "monitor_timer_interval";
+const char * const config_element_blocking_timeout = "blocking_timeout";
const char * const config_element_output = "output";
const char * const config_element_output_type = "output_type";
const char * const config_element_tracefile_size = "tracefile_size";
</xs:restriction>
</xs:simpleType>
+<!--
+Maps to the range allowed for blocking timeout: -1 (block forever),
+0 (do not block), positive integer value (blocking time in usec) limited
+by its signed 32-bit representation when converted to msec.
+-->
+<xs:simpleType name="blocking_timeout_type">
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="-1" />
+ <xs:maxInclusive value="2147483648000" />
+ </xs:restriction>
+</xs:simpleType>
+
<xs:simpleType name="channel_overwrite_mode_type">
<xs:restriction base="xs:string">
<xs:enumeration value="DISCARD"/>
<xs:element name="subbuffer_count" type="uint64_type" default="4" minOccurs="0"/>
<xs:element name="switch_timer_interval" type="uint32_type" default="0" minOccurs="0"/> <!-- usec -->
<xs:element name="read_timer_interval" type="uint32_type"/> <!-- usec -->
+ <xs:element name="blocking_timeout" type="blocking_timeout_type" default="0" minOccurs="0" /> <!-- usec -->
<xs:element name="output_type" type="event_output_type"/>
<xs:element name="tracefile_size" type="uint64_type" default="0" minOccurs="0"/> <!-- bytes -->
<xs:element name="tracefile_count" type="uint64_type" default="0" minOccurs="0"/>
#define DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER
#define DEFAULT_KERNEL_CHANNEL_READ_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_READ_TIMER
#define DEFAULT_KERNEL_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_LIVE_TIMER
+#define DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT
/* User space defaults */
#define DEFAULT_UST_PID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_READ_TIMER
#define DEFAULT_UST_UID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_READ_TIMER
+#define DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT
+#define DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT CONFIG_DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT
+
/*
* Default timeout value for the sem_timedwait() call. Blocking forever is not
* wanted so a timeout is used to control the data flow and not freeze the
</xs:restriction>
</xs:simpleType>
+ <!--
+ Maps to the range allowed for blocking timeout: -1 (block
+ forever), 0 (do not block), positive integer value (blocking
+ time in usec) limited by its signed 32-bit representation when
+ converted to msec.
+ -->
+ <xs:simpleType name="blocking_timeout_type">
+ <xs:restriction base="xs:integer">
+ <xs:minInclusive value="-1" />
+ <xs:maxInclusive value="2147483648000" />
+ </xs:restriction>
+ </xs:simpleType>
+
<!-- Maps to the char name[LTTNG_SYMBOL_NAME_LEN] -->
<xs:simpleType name="name_type">
<xs:restriction base="xs:string">
<xs:element name="discarded_events" type="tns:uint64_type" default="0" minOccurs="0" />
<xs:element name="lost_packets" type="tns:uint64_type" default="0" minOccurs="0" />
<xs:element name="monitor_timer_interval" type="tns:uint64_type" default="0" minOccurs="0" />
+ <xs:element name="blocking_timeout" type="tns:blocking_timeout_type" default="0" minOccurs="0" />
</xs:all>
</xs:complexType>
struct lttng_channel *chan = caa_container_of(attr,
struct lttng_channel, attr);
uint64_t discarded_events, lost_packets, monitor_timer_interval;
+ int64_t blocking_timeout;
assert(attr);
goto end;
}
+ ret = lttng_channel_get_blocking_timeout(chan,
+ &blocking_timeout);
+ if (ret) {
+ goto end;
+ }
+
/* Opening Attributes */
ret = mi_lttng_writer_open_element(writer, config_element_attributes);
if (ret) {
goto end;
}
+ /* Retry timeout in usec */
+ ret = mi_lttng_writer_write_element_signed_int(writer,
+ config_element_blocking_timeout,
+ blocking_timeout);
+ if (ret) {
+ goto end;
+ }
+
/* Event output */
ret = mi_lttng_writer_write_element_string(writer,
config_element_output_type,
* because the application can be in the tracing for instance.
*/
uint32_t ust_app_uid;
+ int64_t blocking_timeout;
char root_shm_path[PATH_MAX];
char shm_path[PATH_MAX];
} LTTNG_PACKED ask_channel;
attr.read_timer_interval = msg.u.ask_channel.read_timer_interval;
attr.chan_id = msg.u.ask_channel.chan_id;
memcpy(attr.uuid, msg.u.ask_channel.uuid, sizeof(attr.uuid));
+ attr.blocking_timeout= msg.u.ask_channel.blocking_timeout;
/* Match channel buffer type to the UST abi. */
switch (msg.u.ask_channel.output) {
if (extended) {
extended->monitor_timer_interval =
DEFAULT_KERNEL_CHANNEL_MONITOR_TIMER;
+ extended->blocking_timeout =
+ DEFAULT_KERNEL_CHANNEL_BLOCKING_TIMEOUT;
}
break;
case LTTNG_DOMAIN_UST:
if (extended) {
extended->monitor_timer_interval =
DEFAULT_UST_UID_CHANNEL_MONITOR_TIMER;
+ extended->blocking_timeout =
+ DEFAULT_UST_UID_CHANNEL_BLOCKING_TIMEOUT;
}
break;
case LTTNG_BUFFER_PER_PID:
if (extended) {
extended->monitor_timer_interval =
DEFAULT_UST_PID_CHANNEL_MONITOR_TIMER;
+ extended->blocking_timeout =
+ DEFAULT_UST_PID_CHANNEL_BLOCKING_TIMEOUT;
}
break;
}
return ret;
}
+int lttng_channel_get_blocking_timeout(struct lttng_channel *chan,
+ int64_t *blocking_timeout)
+{
+ int ret = 0;
+
+ if (!chan || !blocking_timeout) {
+ ret = -LTTNG_ERR_INVALID;
+ goto end;
+ }
+
+ if (!chan->attr.extended.ptr) {
+ ret = -LTTNG_ERR_INVALID;
+ goto end;
+ }
+
+ *blocking_timeout = ((struct lttng_channel_extended *)
+ chan->attr.extended.ptr)->blocking_timeout;
+end:
+ return ret;
+}
+
+int lttng_channel_set_blocking_timeout(struct lttng_channel *chan,
+ int64_t blocking_timeout)
+{
+ int ret = 0;
+ int64_t msec_timeout;
+
+ if (!chan || !chan->attr.extended.ptr) {
+ ret = -LTTNG_ERR_INVALID;
+ goto end;
+ }
+
+ if (blocking_timeout < 0 && blocking_timeout != -1) {
+ ret = -LTTNG_ERR_INVALID;
+ goto end;
+ }
+
+ /*
+ * LTTng-ust's use of poll() to implement this timeout mechanism forces
+ * us to accept a narrower range of values (msecs expressed as a signed
+ * 32-bit integer).
+ */
+ msec_timeout = blocking_timeout / 1000;
+ if (msec_timeout != (int32_t) msec_timeout) {
+ ret = -LTTNG_ERR_INVALID;
+ goto end;
+ }
+
+ ((struct lttng_channel_extended *)
+ chan->attr.extended.ptr)->blocking_timeout =
+ blocking_timeout;
+end:
+ return ret;
+}
+
/*
* Check if session daemon is alive.
*
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../../..
SESSION_NAME="blocking"
+CHANNEL_NAME="testchan"
TESTAPP_PATH="$TESTDIR/utils/testapp"
TESTAPP_NAME="gen-ust-events"
TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
EVENT_NAME="tp:tptest"
-NUM_TESTS=45
+NUM_TESTS=49
source $TESTDIR/utils/utils.sh
function test_ust_implicit_no_blocking()
{
- NUM_EVENT=500000
+ NUM_EVENT=5000000
diag "UST implicit non-blocking mode (default): will hang if fails"
- # Test without the plugin
start_lttng_sessiond
+ # session in no-output mode
create_lttng_session_no_output $SESSION_NAME
enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME"
start_lttng_tracing_ok $SESSION_NAME
ok 0 "Does not hang"
}
-function test_ust_explicit_no_blocking()
+function test_ust_implicit_no_blocking_with_channel_blocking()
{
- NUM_EVENT=500000
- diag "UST explicit non-blocking mode: will hang if fails"
+ NUM_EVENT=5000000
+ diag "UST implicit non-blocking mode (default) with blocking-timeout=-1 channel: will hang if fails"
- # Test without the plugin
start_lttng_sessiond
+ # session in no-output mode
create_lttng_session_no_output $SESSION_NAME
- enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME"
+ enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME "--blocking-timeout=-1"
+ enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" $CHANNEL_NAME
start_lttng_tracing_ok $SESSION_NAME
- LTTNG_UST_BLOCKING_RETRY_TIMEOUT=0 run_app
+ run_app
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
stop_lttng_sessiond
function test_ust_timeout_no_blocking()
{
NUM_EVENT=12500
- diag "UST 1ms timeout retry mode: will hang if fails"
+ diag "UST 1ms timeout blocking mode: will hang if fails"
start_lttng_sessiond
+ # session in no-output mode
create_lttng_session_no_output $SESSION_NAME
- enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME"
+ # blocking timeout 1ms
+ enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME "--blocking-timeout=1000"
+ enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" $CHANNEL_NAME
start_lttng_tracing_ok $SESSION_NAME
- # retry timeout 1ms
- LTTNG_UST_BLOCKING_RETRY_TIMEOUT=1 run_app
+ LTTNG_UST_ALLOW_BLOCKING=1 run_app
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
stop_lttng_sessiond
function test_ust_snapshot_no_blocking()
{
- NUM_EVENT=500000
+ NUM_EVENT=5000000
diag "UST blocking mode: don't block in snapshot mode"
# Test without the plugin
start_lttng_sessiond
create_lttng_session_ok $SESSION_NAME $TRACE_PATH --snapshot
- enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME"
+ # blocking timeout 1ms
+ enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME "--blocking-timeout=1000"
+ enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" $CHANNEL_NAME
start_lttng_tracing_ok $SESSION_NAME
- LTTNG_UST_BLOCKING_RETRY_TIMEOUT=-1 run_app
+ LTTNG_UST_ALLOW_BLOCKING=1 run_app
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
stop_lttng_sessiond
function test_ust_blocking_no_discard()
{
- NUM_EVENT=500000
+ NUM_EVENT=5000000
diag "UST blocking mode: no event discarded"
# Test without the plugin
start_lttng_sessiond
create_lttng_session_ok $SESSION_NAME $TRACE_PATH
- enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME"
+ # infinite blocking timeout
+ enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME "--blocking-timeout=-1"
+ enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" $CHANNEL_NAME
start_lttng_tracing_ok $SESSION_NAME
- # infinite retry timeout
- LTTNG_UST_BLOCKING_RETRY_TIMEOUT=-1 run_app
+ LTTNG_UST_ALLOW_BLOCKING=1 run_app
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
stop_lttng_sessiond
TESTS=(
"test_ust_implicit_no_blocking"
- "test_ust_explicit_no_blocking"
+ "test_ust_implicit_no_blocking_with_channel_blocking"
"test_ust_timeout_no_blocking"
"test_ust_snapshot_no_blocking"
"test_ust_blocking_no_discard"