fprintf(ofp, "\n");
fprintf(ofp, " -h, --help Show this help\n");
fprintf(ofp, " --list-options Simple listing of options\n");
- fprintf(ofp, " -s, --session Apply on session name\n");
- fprintf(ofp, " -c, --channel Apply on this channel\n");
+ fprintf(ofp, " -s, --session Apply to session name\n");
+ fprintf(ofp, " -c, --channel Apply to this channel\n");
fprintf(ofp, " -a, --all Enable all tracepoints\n");
fprintf(ofp, " -k, --kernel Apply for the kernel tracer\n");
#if 0
- fprintf(ofp, " -u, --userspace [CMD] Apply for the user-space tracer\n");
+ fprintf(ofp, " -u, --userspace [CMD] Apply to the user-space tracer\n");
fprintf(ofp, " If no CMD, the domain used is UST global\n");
fprintf(ofp, " or else the domain is UST EXEC_NAME\n");
fprintf(ofp, " -p, --pid PID If -u, apply to specific PID (domain: UST PID)\n");
#else
- fprintf(ofp, " -u, --userspace Apply for the user-space tracer\n");
+ fprintf(ofp, " -u, --userspace Apply to the user-space tracer\n");
#endif
fprintf(ofp, "\n");
fprintf(ofp, "Event options:\n");
return ret;
}
+/*
+ * Maps this from string to value
+ *
+ * TRACE_EMERG = 0,
+ * TRACE_ALERT = 1,
+ * TRACE_CRIT = 2,
+ * TRACE_ERR = 3,
+ * TRACE_WARNING = 4,
+ * TRACE_NOTICE = 5,
+ * TRACE_INFO = 6,
+ * TRACE_SYSTEM = 7,
+ * TRACE_PROCESS = 8,
+ * TRACE_MODULE = 9,
+ * TRACE_UNIT = 10,
+ * TRACE_CLASS = 11,
+ * TRACE_OBJECT = 12,
+ * TRACE_FUNCTION = 13,
+ * TRACE_PRINTF = 14,
+ * TRACE_DEBUG = 15,
+ */
+static
+int loglevel_str_to_value(const char *str)
+{
+ if (!strcmp(str, "TRACE_EMERG")) {
+ return 0;
+ } else if (!strcmp(str, "TRACE_ALERT")) {
+ return 1;
+ } else if (!strcmp(str, "TRACE_CRIT")) {
+ return 2;
+ } else if (!strcmp(str, "TRACE_ERR")) {
+ return 3;
+ } else if (!strcmp(str, "TRACE_WARNING")) {
+ return 4;
+ } else if (!strcmp(str, "TRACE_NOTICE")) {
+ return 5;
+ } else if (!strcmp(str, "TRACE_INFO")) {
+ return 6;
+ } else if (!strcmp(str, "TRACE_SYSTEM")) {
+ return 7;
+ } else if (!strcmp(str, "TRACE_PROCESS")) {
+ return 8;
+ } else if (!strcmp(str, "TRACE_MODULE")) {
+ return 9;
+ } else if (!strcmp(str, "TRACE_UNIT")) {
+ return 10;
+ } else if (!strcmp(str, "TRACE_CLASS")) {
+ return 11;
+ } else if (!strcmp(str, "TRACE_OBJECT")) {
+ return 12;
+ } else if (!strcmp(str, "TRACE_FUNCTION")) {
+ return 13;
+ } else if (!strcmp(str, "TRACE_PRINTF")) {
+ return 14;
+ } else if (!strcmp(str, "TRACE_DEBUG")) {
+ return 15;
+ } else {
+ return -1;
+ }
+}
+
/*
* Enabling event using the lttng API.
*/
}
/* kernel loglevels not implemented */
- ev.loglevel_type = opt_loglevel_type;
- ev.loglevel[0] = '\0';
+ ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
} else if (opt_userspace) { /* User-space tracer action */
#if 0
if (opt_cmd_name != NULL || opt_pid) {
case LTTNG_EVENT_FUNCTION_ENTRY:
case LTTNG_EVENT_SYSCALL:
default:
+ ERR("Event type not available for user-space tracing");
ret = CMD_UNDEFINED;
goto error;
}
ev.loglevel_type = opt_loglevel_type;
if (opt_loglevel) {
- strncpy(ev.loglevel, opt_loglevel, LTTNG_SYMBOL_NAME_LEN);
- ev.loglevel[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
- } else {
- ev.loglevel[0] = '\0';
+ ev.loglevel = loglevel_str_to_value(opt_loglevel);
+ if (ev.loglevel == -1) {
+ ERR("Unknown loglevel %s", opt_loglevel);
+ goto error;
+ }
}
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
opt_userspace = 1;
break;
case OPT_LOGLEVEL:
- opt_loglevel_type = LTTNG_EVENT_LOGLEVEL;
+ opt_loglevel_type = LTTNG_EVENT_LOGLEVEL_RANGE;
opt_loglevel = poptGetOptArg(pc);
break;
case OPT_LOGLEVEL_ONLY:
- opt_loglevel_type = LTTNG_EVENT_LOGLEVEL_ONLY;
+ opt_loglevel_type = LTTNG_EVENT_LOGLEVEL_SINGLE;
opt_loglevel = poptGetOptArg(pc);
break;
case OPT_LIST_OPTIONS: