LTTNG_ERR_UST_CHAN_NOT_FOUND = 59, /* UST channel not found */
LTTNG_ERR_UST_CHAN_DISABLE_FAIL = 60, /* UST disable channel failed */
LTTNG_ERR_UST_CHAN_ENABLE_FAIL = 61, /* UST enable channel failed */
- /* 62 */
+ LTTNG_ERR_CHAN_EXIST = 62, /* Channel already exists. */
LTTNG_ERR_UST_ENABLE_FAIL = 63, /* UST enable event failed */
LTTNG_ERR_UST_DISABLE_FAIL = 64, /* UST disable event failed */
LTTNG_ERR_UST_META_FAIL = 65, /* UST open metadata failed */
* Domain types: the different possible tracers.
*/
enum lttng_domain_type {
- LTTNG_DOMAIN_KERNEL = 1,
- LTTNG_DOMAIN_UST = 2,
-
- /*
- * For now, the domains below are not implemented. However, we keep them
- * here in order to retain their enum values for future development. Note
- * that it is on the roadmap to implement them.
- *
- LTTNG_DOMAIN_UST_EXEC_NAME = 3,
- LTTNG_DOMAIN_UST_PID = 4,
- LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN = 5,
- */
+ LTTNG_DOMAIN_KERNEL = 1, /* Linux Kernel tracer. */
+ LTTNG_DOMAIN_UST = 2, /* Global Userspace tracer. */
+ LTTNG_DOMAIN_JUL = 3, /* Java Util Logging. */
};
/*
}
break;
+ case LTTNG_DOMAIN_JUL:
+ {
+ ret = LTTNG_ERR_UNKNOWN_DOMAIN;
+ goto error;
+ }
case LTTNG_DOMAIN_UST:
{
if (!ust_app_supported()) {
if (cmd_ctx->lsm->cmd_type == LTTNG_START_TRACE ||
cmd_ctx->lsm->cmd_type == LTTNG_STOP_TRACE) {
switch (cmd_ctx->lsm->domain.type) {
+ case LTTNG_DOMAIN_JUL:
case LTTNG_DOMAIN_UST:
if (uatomic_read(&ust_consumerd_state) != CONSUMER_STARTED) {
ret = LTTNG_ERR_NO_USTCONSUMERD;
} else if (opt_userspace) {
dom.type = LTTNG_DOMAIN_UST;
} else {
- ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
+ print_missing_domain();
ret = CMD_ERROR;
goto error;
}
} else if (opt_userspace) {
dom.type = LTTNG_DOMAIN_UST;
} else {
- ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
+ print_missing_domain();
ret = CMD_ERROR;
goto error;
}
} else if (opt_userspace) {
dom.type = LTTNG_DOMAIN_UST;
} else {
- ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
+ print_missing_domain();
ret = CMD_ERROR;
goto error;
}
warn = 1;
} else {
MSG("%s channel %s disabled for session %s",
- opt_kernel ? "Kernel" : "UST", channel_name, session_name);
+ get_domain_str(dom.type), channel_name, session_name);
}
/* Next channel */
static char *opt_session_name;
static int opt_userspace;
static int opt_disable_all;
+static int opt_jul;
#if 0
/* Not implemented yet */
static char *opt_cmd_name;
{"session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
{"all-events", 'a', POPT_ARG_VAL, &opt_disable_all, 1, 0, 0},
{"channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0},
+ {"jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0},
{"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
#if 0
/* Not implemented yet */
fprintf(ofp, " -a, --all-events Disable all tracepoints\n");
fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n");
fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n");
+ fprintf(ofp, " -j, --jul Apply for Java application using JUL\n");
fprintf(ofp, "\n");
}
dom.type = LTTNG_DOMAIN_KERNEL;
} else if (opt_userspace) {
dom.type = LTTNG_DOMAIN_UST;
+ } else if (opt_jul) {
+ dom.type = LTTNG_DOMAIN_JUL;
} else {
- ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
+ print_missing_domain();
ret = CMD_ERROR;
goto error;
}
}
MSG("All %s events are disabled in channel %s",
- opt_kernel ? "kernel" : "UST",
- print_channel_name(channel_name));
+ get_domain_str(dom.type), print_channel_name(channel_name));
goto end;
}
warn = 1;
} else {
MSG("%s event %s disabled in channel %s for session %s",
- opt_kernel ? "kernel" : "UST", event_name,
+ get_domain_str(dom.type), event_name,
print_channel_name(channel_name),
session_name);
}
DEFAULT_UST_PID_CHANNEL_OUTPUT == LTTNG_EVENT_MMAP ? output_mmap : output_splice,
DEFAULT_KERNEL_CHANNEL_OUTPUT == LTTNG_EVENT_MMAP ? output_mmap : output_splice,
DEFAULT_METADATA_OUTPUT == LTTNG_EVENT_MMAP ? output_mmap : output_splice);
- fprintf(ofp, " --buffers-uid Use per UID buffer (-u only)\n");
- fprintf(ofp, " --buffers-pid Use per PID buffer (-u only)\n");
+ fprintf(ofp, " --buffers-uid Use per UID buffer (-u/-j only)\n");
+ fprintf(ofp, " --buffers-pid Use per PID buffer (-u/-j only)\n");
fprintf(ofp, " --buffers-global Use shared buffer for the whole system (-k only)\n");
fprintf(ofp, " -C, --tracefile-size SIZE\n");
fprintf(ofp, " Maximum size of each tracefile within a stream (in bytes). 0 means unlimited.\n");
dom.buf_type = LTTNG_BUFFER_PER_UID;
}
} else {
- ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
+ print_missing_domain();
ret = CMD_ERROR;
goto error;
}
switch (-ret) {
case LTTNG_ERR_KERN_CHAN_EXIST:
case LTTNG_ERR_UST_CHAN_EXIST:
+ case LTTNG_ERR_CHAN_EXIST:
WARN("Channel %s: %s (session %s)", channel_name,
lttng_strerror(ret), session_name);
goto error;
warn = 1;
} else {
MSG("%s channel %s enabled for session %s",
- opt_kernel ? "Kernel" : "UST", channel_name,
- session_name);
+ get_domain_str(dom.type), channel_name, session_name);
}
/* Next event */
static int opt_kernel;
static char *opt_session_name;
static int opt_userspace;
+static int opt_jul;
static int opt_enable_all;
static char *opt_probe;
static char *opt_function;
{"channel", 'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0},
{"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
{"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0},
+ {"jul", 'j', POPT_ARG_VAL, &opt_jul, 1, 0, 0},
{"tracepoint", 0, POPT_ARG_NONE, 0, OPT_TRACEPOINT, 0, 0},
{"probe", 0, POPT_ARG_STRING, &opt_probe, OPT_PROBE, 0, 0},
{"function", 0, POPT_ARG_STRING, &opt_function, OPT_FUNCTION, 0, 0},
fprintf(ofp, " -a, --all Enable all tracepoints and syscalls\n");
fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n");
fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n");
+ fprintf(ofp, " -j, --jul Apply for Java application using JUL\n");
fprintf(ofp, "\n");
fprintf(ofp, "Event options:\n");
fprintf(ofp, " --tracepoint Tracepoint event (default)\n");
dom.type = LTTNG_DOMAIN_UST;
/* Default. */
dom.buf_type = LTTNG_BUFFER_PER_UID;
+ } else if (opt_jul) {
+ dom.type = LTTNG_DOMAIN_JUL;
+ /* Default. */
+ dom.buf_type = LTTNG_BUFFER_PER_UID;
} else {
- ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
+ print_missing_domain();
ret = CMD_ERROR;
goto error;
}
case LTTNG_EVENT_TRACEPOINT:
if (opt_loglevel) {
MSG("All %s tracepoints are enabled in channel %s for loglevel %s",
- opt_kernel ? "kernel" : "UST",
+ get_domain_str(dom.type),
print_channel_name(channel_name),
opt_loglevel);
} else {
MSG("All %s tracepoints are enabled in channel %s",
- opt_kernel ? "kernel" : "UST",
+ get_domain_str(dom.type),
print_channel_name(channel_name));
}
case LTTNG_EVENT_ALL:
if (opt_loglevel) {
MSG("All %s events are enabled in channel %s for loglevel %s",
- opt_kernel ? "kernel" : "UST",
+ get_domain_str(dom.type),
print_channel_name(channel_name),
opt_loglevel);
} else {
MSG("All %s events are enabled in channel %s",
- opt_kernel ? "kernel" : "UST",
+ get_domain_str(dom.type),
print_channel_name(channel_name));
}
break;
} else {
ev.loglevel = -1;
}
+ } else if (opt_jul) {
+ if (opt_event_type != LTTNG_EVENT_ALL &&
+ opt_event_type != LTTNG_EVENT_TRACEPOINT) {
+ ERR("Event type not supported for JUL domain.");
+ ret = CMD_UNSUPPORTED;
+ goto error;
+ }
+ ev.type = LTTNG_EVENT_TRACEPOINT;
+ strncpy(ev.name, event_name, LTTNG_SYMBOL_NAME_LEN);
+ ev.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
} else {
- ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
+ print_missing_domain();
ret = CMD_ERROR;
goto error;
}
warn = 1;
} else {
MSG("%s event %s created in channel %s",
- opt_kernel ? "kernel": "UST", event_name,
+ get_domain_str(dom.type), event_name,
print_channel_name(channel_name));
}
}
*/
#define _GNU_SOURCE
+#include <assert.h>
#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
#include "utils.h"
#include "command.h"
+static const char *str_kernel = "Kernel";
+static const char *str_ust = "UST";
+static const char *str_jul = "JUL";
+
/*
* get_session_name
*
return fls_ulong(x - 1);
}
+
+const char *get_domain_str(enum lttng_domain_type domain)
+{
+ const char *str_dom;
+
+ switch (domain) {
+ case LTTNG_DOMAIN_KERNEL:
+ str_dom = str_kernel;
+ break;
+ case LTTNG_DOMAIN_UST:
+ str_dom = str_ust;
+ break;
+ case LTTNG_DOMAIN_JUL:
+ str_dom = str_jul;
+ break;
+ default:
+ /* Should not have an unknown domain or else define it. */
+ assert(0);
+ }
+
+ return str_dom;
+}
#include <popt.h>
+#include <lttng/lttng.h>
+
struct cmd_struct;
char *get_session_name(void);
*/
int get_count_order_ulong(unsigned long x);
+const char *get_domain_str(enum lttng_domain_type domain);
+
+static inline
+void print_missing_domain(void)
+{
+ ERR("Please specify a domain (-k/-u/-j).");
+}
+
#endif /* _LTTNG_UTILS_H */
[ ERROR_INDEX(LTTNG_ERR_SNAPSHOT_OUTPUT_EXIST) ] = "Snapshot output already exists",
[ ERROR_INDEX(LTTNG_ERR_START_SESSION_ONCE) ] = "Session needs to be started once",
[ ERROR_INDEX(LTTNG_ERR_SNAPSHOT_FAIL) ] = "Snapshot record failed",
+ [ ERROR_INDEX(LTTNG_ERR_CHAN_EXIST) ] = "Channel already exists",
/* Last element */
[ ERROR_INDEX(LTTNG_ERR_NR) ] = "Unknown error code"
switch (src->type) {
case LTTNG_DOMAIN_KERNEL:
case LTTNG_DOMAIN_UST:
+ case LTTNG_DOMAIN_JUL:
memcpy(dst, src, sizeof(struct lttng_domain));
break;
default: